Skip to content

HarmonyOS Application Data Collection


After application data is collected into Guance, you can use the Guance console to customize use cases and configure anomaly detection events.

Data Types

Real User Monitoring (RUM) in Guance includes six data types. The HarmonyOS SDK natively reports five types of data directly: view, resource, error, long_task, and action; session is aggregated data based on the session dimension.

Type Description
session User session information. In the current session, session-level access data related to user pages, resources, actions, errors, and long tasks is generated.
view A view record is generated each time a user visits a page in the mobile application. While the user stays on the same page, resource, long task, error, and action records are linked to the related RUM view through the view_id attribute.
resource Information about resources loaded when a user visits a page.
error Exceptions or crashes thrown by the mobile application.
long_task A long task event is generated for any task in the application that blocks the main thread for longer than the specified duration threshold.
action Records user activities in the mobile application (app launch, tap, swipe, back, etc.). Each action is attached with a unique action_id.

Global Attributes

Both use case construction and event alerts for RUM can be queried using the following global attributes.

SDK Attributes

Field Type Description
sdk_name string Collector name. Fixed value: df_harmonyos_rum_sdk
sdk_version string Collector version information
sdk_pkg_info string Collection of collector version information, including internal module version information of the SDK.

Application Attributes

Field Type Description
app_id string Required. Unique ID of the RUM application, automatically generated when a monitor is created in the Guance console.
env string Required. Environment field. Values: prod/gray/pre/common/local, where:
prod: production environment
gray: canary environment
pre: pre-release environment
common: daily environment
local: local environment
version string Required. Version number.
service string Optional. Name of the business or service to which it belongs. Fixed value: df_rum_harmonyos
application_uuid string Unique application identifier. Applications with the same build have the same application UUID.

User & Session Attributes

Field Type Description
userid string For users who are not signed in, a random UUID is used as userid; for signed-in users, the user ID generated by the application backend is used.
user_name string Optional. User name.
user_email string Optional. User email.
session_id string Session ID. Updated after 15 minutes of no user activity or when the session lasts longer than 4 hours.
session_type string Session type. Reference values: user & synthetics
user: data generated by RUM;
synthetics: data generated by headless synthetic tests.
is_signin boolean Whether the user is a registered user. Values: T & F.

Device & Resolution Attributes

Field Type Description
device string Mobile device vendor
model string Mobile device model
device_uuid string Unique mobile device ID
os string OS information, fixed to HarmonyOS
os_version string OS version
os_version_major string OS major version
screen_size string Screen resolution
arch string System architecture (for example, aarch64)

Geographic & Network Attributes

Field Type Description
network_type string Network connection type. Reference values:
wifi & 2g & 3g & 4g & 5g & unknown (unknown network) & unreachable (network unavailable)

Custom Attributes

In addition to global attributes, you can also use custom attributes (the SDK supports user-defined tag data) to build use cases and configure event alerts. Custom attributes are non-global attributes. Through custom attributes, you can track the entire process of a user visiting the application, locate and identify affected user visits, and monitor user access performance.

Attributes of Other Data Types

Session

Session-related data is server-side session-level aggregated data, not a measurement directly reported natively by the HarmonyOS SDK.

Attributes

Field Type Description
session_id string Session ID
session_type string Session type. Reference values: user & synthetics
user: data generated by RUM;
synthetics: data generated by headless synthetic tests.
has_replay boolean Whether the current session is associated with Session Replay data

View

Attributes

Field Type Description
view_id string Unique ID generated each time a page is visited
view_referrer string Page source, parent of the page
view_name string Page name

Metrics

Field Type Description
loading_time number (ns) Page loading time
time_spent number (ns) Page time spent
is_active boolean Whether the user is still active. Reference values: true & false
session_has_replay boolean Whether the current page is associated with Session Replay data

Statistical Metrics

Field Type Description
view_error_count number Number of errors that occur each time the page is loaded
view_resource_count number Number of resources requested each time the page is loaded
view_long_task_count number Number of long tasks generated each time the page is loaded
view_long_task_rate number Proportion of long task duration within the page lifecycle, range [0,1]
view_action_count number Number of actions performed during page viewing

Monitoring Metrics

Field Type Description
cpu_tick_count number Optional. Number of CPU ticks for the page
cpu_tick_count_per_second number Optional. Average number of CPU ticks per second
fps_avg number Optional. Average frames per second for the page
fps_mini number Optional. Minimum frames per second for the page
memory_avg number Optional. Average memory usage for the page
memory_max number Optional. Peak memory usage for the page
battery_current_avg number Optional. Average battery current for the page
battery_current_max number Optional. Maximum battery current for the page

Resource

View Attributes

Field Type Description
view_id string Unique ID generated each time a page is visited
view_referrer string Page source, parent of the page
view_name string Page name

Action Attributes

Field Type Description
action_id string Unique ID generated when a user performs an action on the page
action_name string Action name
action_type string Action type (cold/warm launch, click, and other actions)

Resource Attributes

Field Type Description
resource_id string Stable unique ID of the resource
resource_url string Resource URL
resource_url_host string Domain part of the resource URL
resource_url_path string Path part of the resource URL
resource_url_path_group string Resource URL path group
resource_type string Resource category
resource_method string Resource request method
resource_status string Status value returned by the resource request
resource_status_group string Status group value returned by the resource request
resource_host_ip string Target IP address accessed by the resource URL
trace_id string Distributed Tracing ID (optional when Distributed Tracing is enabled)
span_id string Distributed Tracing Span ID (optional when Distributed Tracing is enabled)
response_connection string Response connection type (optional)
response_content_type string Response content type (optional)
response_content_encoding string Response content encoding (optional)
resource_http_protocol string HTTP protocol used for the resource request (optional)
resource_connection_reuse boolean Whether the resource request reuses a connection (optional)
session_has_replay boolean Whether the current resource is associated with Session Replay data

Metrics

Field Type Description
resource_size number Resource size. Default unit: byte
resource_dns number (ns) Resource DNS resolution time during loading
Calculation: nameLookupTimeMs * 1000000
resource_tcp number (ns) Resource TCP connection time during loading
Calculation: ((tlsHandshakeTimeMs ?? connectTimeMs) - nameLookupTimeMs) * 1000000
resource_ssl number (ns) Resource SSL connection time during loading
Calculation: (tlsHandshakeTimeMs - connectTimeMs) * 1000000
resource_ttfb number (ns) Resource request response time during loading
Calculation: (startTransferTimeMs - preTransferTimeMs) * 1000000
resource_trans number (ns) Resource content transfer time during loading
Calculation: (totalTimeMs - tlsHandshakeTimeMs) * 1000000
resource_first_byte number (ns) Resource first byte time during loading
Calculation: (startTransferTimeMs - preTransferTimeMs) * 1000000
duration number (ns) Resource loading time
Calculation: totalTimeMs * 1000000
resource_request_size number Resource request size. Default unit: byte
resource_dns_time object Resource DNS resolution time, format: {duration: number(ns), start: number(ns)}
resource_connect_time object Resource connection duration, same format as resource_dns_time
resource_first_byte_time object Resource first byte time during loading, same format as resource_dns_time
resource_ssl_time object Resource SSL connection duration, same format as resource_dns_time
resource_download_time object Resource download duration, same format as resource_dns_time
request_header string Resource request header
response_header string Resource response header

Network Snapshot Metrics

Field Type Description
network_available boolean Whether the network was available when the resource request started
network_validated boolean Whether the network had been validated by the system when the resource request started
network_downlink_kbps number Network downlink bandwidth when the resource request started, unit: kbps
network_uplink_kbps number Network uplink bandwidth when the resource request started, unit: kbps
network_signal_strength number Network signal strength when the resource request started; the value definition depends on the network type

Error

View Attributes

Field Type Description
view_id string Unique ID generated each time a page is visited
view_referrer string Page source, parent of the page
view_name string Page name

Action Attributes

Field Type Description
action_id string Unique ID generated when a user performs an action on the page
action_name string Action name
action_type string Action type (cold/warm launch, click, and other actions)

Error Attributes

Field Type Description
error_source string Error source. Reference values: logger | network
error_type string Error type, such as js_crash, native_crash, anr_error, anr_crash, network_error, custom
error_situation string Application state when the error occurred. Reference values for native reporting: run, background, unknown
session_has_replay boolean Whether the current error is associated with Session Replay data

When type=network, the following Network Error attributes are added.

Field Type Description
resource_id string Stable unique ID of the corresponding resource
resource_status string Status value returned by the resource request
resource_url string Resource URL
resource_url_host string Domain part of the resource URL
resource_url_path string Path part of the resource URL
resource_url_path_group string Resource URL path group
resource_method string Resource request method

Error Monitoring Attributes

Field Type Description
memory_total string Optional. Total device memory
memory_use number Optional. Current application memory usage
cpu_use number Optional. Current application CPU usage
battery_use number Optional. Device battery consumption percentage
locale string Current system language

Metrics

Field Type Description
error_message string Error message
error_stack string Error stack
foreground_crash_free_duration number (ns) Foreground crash-free duration
background_crash_free_duration number (ns) Background crash-free duration

Long Task

View Attributes

Field Type Description
view_id string Unique ID generated each time a page is visited
view_referrer string Page source, parent of the page
view_name string Page name

Action Attributes

Field Type Description
action_id string Unique ID generated when a user performs an action on the page
action_name string Action name
action_type string Action type (cold/warm launch, click, and other actions)

Metrics

Field Type Description
duration number (ns) Jank duration
long_task_message string Jank information
long_task_stack string Jank stack
session_has_replay boolean Whether the current long task is associated with Session Replay data

Action

View Attributes

Field Type Description
view_id string Unique ID generated each time a page is visited
view_referrer string Page source, parent of the page
view_name string Page name

Action Attributes

Field Type Description
action_id string Unique ID generated when a user performs an action on the page
action_name string Action name
action_type string Action type (for example, click, launch_cold)
app_launch_type string Launch type of a cold start action. Reference values: foreground (launched from the foreground), background (launched from the background), foreground_and_background (launched from the foreground, enters the background before the first frame, and returns to the foreground). Supported in ft-sdk 0.1.18 and later versions

Metrics

Field Type Description
duration number (ns) Time spent on the page action
app_pre_application_init_time object For cold starts, the phase from process start to application initialization. Format: {start: number(ns), duration: number(ns)}
app_application_init_time object For cold starts, the phase from application initialization to the creation of the first UIAbility. Same format as above
app_first_frame_init_time object For cold starts, the phase from the creation of the first UIAbility to the first rendered frame. Same format as above
session_has_replay boolean Whether the current action is associated with Session Replay data

Statistical Metrics

Field Type Description
action_long_task_count number Number of long tasks associated with the action
action_resource_count number Number of resource requests associated with the action
action_error_count number Number of errors associated with the action

Feedback

Is this page helpful?