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.
FieldSourceDescription
sourceFixed valueAlways harmony
serviceConfigurationBuilder.setService() or application bundle idService name for filtering
versionHarmonyOS bundle informationApplication version
application.idRumConfigurationBuilder(applicationId)RUM application ID
session.idGenerated by SDKUser session ID
os.name / os.version@kit.BasicServicesKit.deviceInfoOS name and version
device.brand / device.model / device.typedeviceInfoDevice brand, model, and type
connectivity.statusSDK network contextCurrently defaults to unknown
usr.id / usr.name / usr.emailsetUserInfo()Identified user information; the server does not accept other user fields
context.*Global or per-event attributesCustom business context
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.
RuleCurrent behavior
Session samplingThe SDK performs one random sampling decision when a session is created; unsampled sessions write no events
Inactivity timeoutA session expires after 15 minutes without real events; keep-alive does not refresh inactivity
Maximum durationA single session lasts up to 4 hours
View keep-aliveThe active view refreshes time_spent every 30 seconds
Start conditionkeepAlive never creates a new session; only real view, action, error, or resource events do

View events

A view represents a page or business screen. Generate views through automatic route tracking or manual APIs.
import { GlobalRumMonitor } from '@flashcatcloud/rum';

const monitor = GlobalRumMonitor.get();

monitor.startView('product-detail', 'ProductDetail', {
  'view.url': 'pages/ProductDetail'
});

monitor.stopView('product-detail');
View events include:
FieldDescription
view.idUnique view ID generated by the SDK
view.nameView name
view.urlUses the view.url attribute first, then falls back to the view key
view.time_spentDuration from view start to the current update, in nanoseconds
view.is_activeWhether the view is still active
view.action.countNumber of actions under the view
view.error.countNumber of errors under the view
view.resource.countNumber of resources under the view
view.crash.countNumber of is_crash errors under the view, used to calculate crash-free rate
_dd.document_versionUpdate version for the same view

Action events

An action represents user interaction. Record instantaneous actions with addAction(), or timed actions with startAction() and stopAction().
import {
  GlobalRumMonitor,
  RumActionType
} from '@flashcatcloud/rum';

const monitor = GlobalRumMonitor.get();

monitor.addAction(RumActionType.TAP, 'pay_button');

monitor.startAction(RumActionType.SCROLL, 'feed_scroll');
monitor.stopAction(RumActionType.SCROLL, 'feed_scroll');
Supported action types:
EnumValue
RumActionType.TAPtap
RumActionType.SCROLLscroll
RumActionType.SWIPEswipe
RumActionType.CLICKclick
RumActionType.BACKback
RumActionType.CUSTOMcustom
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 manually call GlobalRumMonitor.get().startResource() and stopResource()
import {
  GlobalRumMonitor,
  RumResourceKind,
  RumResourceMethod
} from '@flashcatcloud/rum';

const monitor = GlobalRumMonitor.get();

monitor.startResource('order-request', RumResourceMethod.GET, 'https://api.example.com/orders');
monitor.stopResource('order-request', 200, 2048, RumResourceKind.NATIVE);
Resource events include:
FieldDescription
resource.idResource ID generated by the SDK
resource.typeResource type; automatic network collection classifies by response Content-Type and falls back to native when unrecognized
resource.urlRequest URL
resource.methodRequest method
resource.status_codeHTTP status code
resource.sizeResponse body size in bytes
resource.durationRequest duration in nanoseconds
_dd.trace_id / _dd.span_idWritten when the request received traceparent, used to correlate backend Trace
Automatic network collection maps resource types as follows:
Response Content-Typeresource.type
image/*image
video/* / audio/*media
font/*font
text/csscss
text/javascriptjs
Other or missingnative
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, network errors, crashes, or hangs.
import {
  GlobalRumMonitor,
  RumErrorSource
} from '@flashcatcloud/rum';

GlobalRumMonitor.get().addError(
  'checkout failed',
  RumErrorSource.CUSTOM,
  'at checkout'
);
Supported error sources:
EnumValueDescription
NETWORKnetworkNetwork request failure
SOURCEsourceArkTS / JS runtime error or crash
CONSOLEconsoleConsole-originated error
WEBVIEWwebviewWebView-originated error
AGENTagentAgent-originated error
CUSTOMcustomBusiness-defined manual error
Error events include:
FieldDescription
error.messageError message
error.sourceError source
error.stackError stack, when present
error.handlinghandled or unhandled
error.is_crashtrue for crashes and hangs
error.categoryCrash module writes Exception or App Hang
error.source_typeCrash module writes harmony
error.binary_imagesDynamic library symbol information for native crashes
build_idBuild-id used to match native symbols

Crashes and hangs

The Crash module listens to HarmonyOS hiAppEvent for APP_CRASH and APP_FREEZE. The system persists faults and replays them on the next launch, so enable the Crash module early in startup. 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.
BehaviorCurrent implementation
Upload URL{site}/api/v2/rum; the default site is https://browser.flashcat.cloud
Request methodPOST
Content-Typetext/plain;charset=UTF-8
AuthenticationDD-API-KEY: <clientToken> request header
User-Agentflashcat-sdk-harmony/0.1.3
Query parametersddsource=harmony; ddtags includes sdk_version:0.1.3 and appends env, service, and version when present
Default upload interval5 seconds
Network timeout30-second connect timeout and 30-second read timeout
RetryNetwork errors, 401, 403, 408, 429, and 5xx keep the batch and retry with exponential backoff
DropOther 4xx responses are treated as permanent errors and drop the current batch
Force flushError and crash events trigger faster flushing
Background flushWhen the application backgrounds, the SDK refreshes the active view and triggers upload

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
  • Network connectivity changes; connectivity.status currently remains unknown