Skip to main content
The HarmonyOS SDK assembles RUM data as NDJSON batches and uploads them to Flashduty. The current version collects four RUM event types: view, action, resource, and error. Crashes and hangs enter the same pipeline as error events with is_crash.

Default context

After initialization, the SDK attaches shared context to every event.
clientToken is only used for report authentication and is never attached to RUM events.

Session rules

The SDK manages sampling and lifecycle at the session level.

View events

A view represents a page or business screen. Generate views through automatic route tracking or manual APIs.
View events include:

Action events

An action represents user interaction. Record instantaneous actions with addAction(), or timed actions with startAction() and stopAction().
Supported action types: Action events include action.id, action.type, action.target.name, and action.loading_time. Actions recorded through FlashcatRum.trackTap() use type tap.

Resource events

A resource represents a network request. The SDK generates resources in these cases:
  • You use an rcp session with FlashcatTrace.interceptor()
  • You use FlashcatHttp.request() to wrap @kit.NetworkKit requests
  • You wire an axios instance up with trackAxios() from @flashcatcloud/axios
  • You wire another network stack up with FlashcatTrace.startTracedResource()
All four require setTrackNetworkRequests(true). You can also record resources manually with GlobalRumMonitor.get().startResource() and stopResource(), which the toggle does not affect.
Resource events include: Automatic network collection maps resource types as follows: If the request fails, the SDK generates an error event with source: "network" and includes method, status code, and URL in error.resource.

Error events

Errors represent manually reported errors, unhandled ArkTS exceptions, unhandled Promise rejections, network errors, crashes, or hangs.
Supported error sources: RUM automatically listens to errorManager.on('error') and errorManager.on('unhandledRejection'). Unhandled Promise rejections are reported as ordinary, non-crashing errors and never trigger exit or recovery policies. Error events include:

Crashes and hangs

The Crash module collects faults through live and post-mortem paths:
  • Uncaught main-thread ArkTS exceptions enter the live JS crash-policy path. REPORT_THEN_EXIT and REPORT_AND_RECOVER synchronously persist an SDK pending crash incident before the process exits or restarts
  • On the next launch, the Crash module replays its own pending incident into RUM, marks it as consumed, and deletes the persisted file
  • HarmonyOS hiAppEvent replays APP_CRASH and APP_FREEZE on a later launch to capture ArkTS crashes, native C/C++ crashes, and hangs
One ArkTS crash can reach onUnhandledException, onException, and the later hiAppEvent.APP_CRASH. The SDK deduplicates the two live callbacks by fingerprint and uses a persisted consumed record to deduplicate the system replay, ensuring that one policy-managed crash produces exactly one crash error event in the RUM pipeline. Unhandled Promise rejections are collected separately as ordinary, non-crashing RUM errors with error.source_type: promise. They do not terminate the process or enter the crash-policy path.

Crash attribution

Crashes and hangs are attributed to the session and view the application was actually in when the fault happened, not to the launch that replays them. The two kinds of fault are attributed from different sources:
  • Faults the SDK can observe in-process (uncaught main-thread ArkTS exceptions) record their RUM session and view into the pending incident before the process exits, and the next launch replays them against that record
  • Faults the SDK cannot observe in-process (native signal crashes, hangs) kill the process with no chance to record anything. Starting in 0.3.2, the SDK snapshots every view event it writes to local storage, then reads that snapshot on the next launch (deleting it immediately after the read) to recover the session and view the crash belongs to. On 0.3.1 and earlier these faults landed in the live post-restart session at replay time, which put the crash in a session the user never crashed in and left the session that actually died reading crash-free
When replaying such a fault, the SDK writes two documents: an is_crash error stamped with the real fault time, and an updated view document (document_version incremented, is_active set to false, crash and error counts each incremented by one). The pending incident is deleted only after both are persisted; if only one write succeeds the incident is retained and retried on the next launch, so the session never settles as crash-free. The SDK falls back to reporting into the current session at the current time — preserving the real fault time in the crash.crashed_at_ms attribute — in these cases:
  • The view behind the snapshot started more than 4 hours ago. That is the maximum session lifetime, so the session has already closed on the backend and its document must not be rewritten
  • The fault happened more than 23 hours ago. The intake silently discards events older than 24 hours, so a backdated crash would be marked delivered yet actually lost
  • The crash happened before the first session was established, or no view snapshot is available locally
Crash events are reported through the RUM error pipeline:
  • ArkTS / JS stacks are parsed as V8-style frames
  • Native C/C++ stacks are parsed in #NN pc <address> <lib.so> form
  • If you upload sourceMaps.map, nameCache.json, and unstripped .so files, the server resolves source files, function names, lines, columns, and native symbols

Upload behavior

The SDK uploads events as NDJSON batches.

Currently not collected

The current HarmonyOS SDK does not automatically collect:
  • Session Replay
  • Web Vitals or browser page performance metrics
  • HarmonyOS page rendering performance metrics
  • Automatic frustration events