Skip to content

HarmonyOS Application Data Collection


After collecting application data to TrueWatch, you can customize scenarios and configure anomaly detection events through the TrueWatch console.

Data Types

TrueWatch's RUM includes six data types:

Type Description
session Records user session information. Within the current session, access data related to user views, resources, actions, errors, and long tasks will be aggregated based on the session dimension.
view A view record is generated each time a user accesses a page of the mobile application. When a user stays on the same page, resource, long task, error, and action records will be linked to the relevant RUM view via the view_id attribute.
resource Records information about resources loaded when a user accesses a page.
error Exceptions or crashes issued 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 a specified duration threshold.
action Records user activities within the mobile application (application startup, clicks, swipes, back, etc.). Each action is attached with a unique action_id.

Global Attributes

Scenarios 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 SDK package information (JSON format)

Application Attributes

Field Type Description
app_id string Required. The unique ID for the RUM application, automatically generated when creating the monitor in the TrueWatch console.
env string Required. Environment field. Attribute values: prod/gray/pre/common/local. Where:
prod: Production environment
gray: Gray environment
pre: Pre-release environment
common: Daily environment
local: Local environment
version string Required. Version number.
service string Optional. The name of the associated business or service. Fixed value: df_rum_harmonyos
application_uuid string Application unique identifier. Applications with the same Build share the same UUID.

User & Session Attributes

Field Type Description
userid string Uses a random uuid as userid for non-logged-in users; uses the user id generated by the application backend for logged-in users.
user_name string Optional. User name.
user_email string Optional. User email.
session_id string Session id. A new session_id is generated after 15 minutes of inactivity.
session_type string Session type. Reference values: user & synthetics
user: Data generated by RUM features;
synthetics: Data generated by headless synthetic tests.
is_signin boolean Whether it is a registered user. Attribute values: T & F.

Device & Resolution Attributes

Field Type Description
device string Mobile device manufacturer
model string Mobile device model
device_uuid string Mobile device unique ID
os string Operating system information, fixed as HarmonyOS
os_version string Operating system version
os_version_major string Operating system major version
screen_size string Screen resolution
arch string System architecture (e.g., aarch64)

Geographic & Network Attributes

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

Custom Attributes

In addition to global attributes, scenarios and event alerts can also be constructed using custom attributes (The SDK supports users adding custom tag data). Custom attributes are non-global attributes. Through custom attributes, you can track the entire process of user access to the application, locate and discover affected user access situations, and monitor user access performance.

Other Data Type Attributes

Session

Attributes

Field Type Description
session_id string Session id
session_type string Session type. Reference values: user & test
user: Data generated by RUM features;
test: Data generated by headless synthetic tests.

View

Attributes

Field Type Description
view_id string Unique ID generated for each page access
view_referrer string Page source, the parent of the page
view_name string Page name

Metrics

Field Type Description
loading_time number (ns) Page load time
time_spent number (ns) Page dwell time
is_active boolean Determines if the user is still active. Reference values: true & false

Statistical Metrics

Field Type Description
view_error_count number Number of errors that occurred during the page load
view_resource_count number Number of resources requested during the page load
view_long_task_count number Number of long tasks generated during the page load
view_action_count number Number of actions performed during the page view

Monitoring Metrics

Field Type Description
cpu_tick_count number Optional. The number of CPU ticks for this page
cpu_tick_count_per_second number Optional. Average 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 for each page access
view_referrer string Page source, the parent of the page
view_name string Page name

Action Attributes

Field Type Description
action_id string Unique ID generated for a user page action
action_name string Action name
action_type string Action type (cold/hot startup, click, etc.)

Resource Attributes

Field Type Description
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 for the resource URL
trace_id string Trace ID (optional, when trace is enabled)
span_id string Trace Span ID (optional, when trace 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)

Metrics

Field Type Description
resource_size number Resource size, default unit: byte
resource_dns number (ns) Resource load DNS resolution time
Calculation: domainLookupEnd - domainLookupStart
resource_tcp number (ns) Resource load TCP connection time
Calculation: connectEnd - connectStart
resource_ssl number (ns) Resource load SSL connection time
Calculation: connectEnd - secureConnectStart
resource_ttfb number (ns) Resource load request response time
Calculation: responseStart - requestStart
resource_trans number (ns) Resource load content transmission time
Calculation: responseEnd - responseStart
resource_first_byte number (ns) Resource load first byte time
Calculation: responseStart - domainLookupStart
duration number (ns) Resource load time
Calculation: duration(responseEnd-startTime)
request_header string Resource request header
response_header string Resource response header

Error

View Attributes

Field Type Description
view_id string Unique ID generated for each page access
view_referrer string Page source, the parent of the page
view_name string Page name

Action Attributes

Field Type Description
action_id string Unique ID generated for a user page action
action_name string Action name
action_type string Action type (cold/hot startup, click, etc.)

Error Attributes

Field Type Description
error_source string Error source. Reference values: logger | network
error_type string Error type
logger error type: java_crash | native_crash | anr_error | anr_crash
network error type: network_error
error_situation string Timing of the error occurrence. Reference values: startup and run (runtime)

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

Field Type Description
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 memory
memory_use number Optional. Memory usage rate
cpu_use number Optional. CPU usage rate
battery_use number Optional. Current battery level of the phone
locale string Current system language

Metrics

Field Type Description
error_message string Error message
error_stack string Error stack

Long Task

View Attributes

Field Type Description
view_id string Unique ID generated for each page access
view_referrer string Page source, the parent of the page
view_name string Page name

Action Attributes

Field Type Description
action_id string Unique ID generated for a user page action
action_name string Action name
action_type string Action type (cold/hot startup, click, etc.)

Metrics

Field Type Description
duration number (ns) Freeze duration
long_task_message string Freeze information
long_task_stack string Freeze stack

Action

View Attributes

Field Type Description
view_id string Unique ID generated for each page access
view_referrer string Page source, the parent of the page
view_name string Page name

Action Attributes

Field Type Description
action_id string Unique ID generated for a user page action
action_name string Action name
action_type string Action type (cold/hot startup, click, etc.)

Metrics

Field Type Description
duration number (ns) Time spent on the page action

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