On October 22, 2024, at the Native HarmonyOS Night event, HarmonyOS NEXT (version 5.0.0, starting from API 12) was released. Unlike the "dual-framework, dual-ecosystem" transitional form of the previous HarmonyOS 3.1 and 4.0, NEXT directly bids farewell to Android Open Source Project (AOSP) and fully switches to the HarmonyOS kernel, becoming a "pure HarmonyOS" in the true sense.



Compilation products: Module compilation results have three formats to meet different deployment state requirements.


At this point, the basic outline of HarmonyOS NEXT is clear. It is not just a mobile OS, but a native neural system for the era of the Internet of Everything. As the HarmonyOS NEXT ecosystem flourishes, application performance monitoring becomes increasingly important. The SDK for HarmonyOS NEXT, developed by the Alibaba Cloud Application Real-Time Monitoring Service (ARMS) team, provides an industry-leading end-to-end monitoring solution for HarmonyOS applications. It is not just an SDK, but an intelligent partner for you to gain insights into user experience and optimize application performance.

A session refers to the behavior trajectory of a user from entering a host application to exiting it. When the application starts, a session begins. The unique SessionID is written to a global variable. When an event occurs, the current SessionID is written into the metrics of the event.

In other words, a session is a means for the SDK to link and manage user behavior trajectories. Developers can view the session trajectory in the console to understand the context of the user's operational behavior within the application, and then conduct analysis from various perspectives. A new session is started when the user directly kills the application or the time spent in the background exceeds 60s.
For data collection in different scenarios, the SDK adopts different collection schemes based on the characteristics of HarmonyOS. In general, the following three non-intrusive collection schemes are adopted.
As mentioned earlier, HarmonyOS provides a variety of Kits. We mainly use the HiAppEvent capability of the Performance Analysis Kit to collect data on exceptions, lags, and startup time. This API provides the capability to subscribe to system events. We perform operations such as data collection in the callback function when a subscribed event occurs.
HiAppEvent provides the capability to subscribe to application events and system events. System events mainly refer to performance, power consumption, and stability issues that occur when applications are running. The exception events, lag events, and startup events that the SDK is concerned with all fall into the category of system events. For example, for crash events, HiAppEvent provides the ability to detect crashes of the NativeCrash and JsError types. After the system completes collecting crash information, it generates and reports an event. The SDK is only concerned with the operations after the event is reported and performs data analysis and processing based on the properties of the reported parameters, and finally reports the data. The following figure shows how the crash event is collected.

For events with a lifecycle, the SDK implements collection by listening to the lifecycle. For example, UiContext provides the UiObserver capability for the NavDestination component. The interface on(type: 'navDestinationSwitch', callback: Callback<observer.NavDestinationSwitchInfo>): void provides the capability to listen for Navigation page switch events. During SDK initialization, a listener is registered, and a callback function for data processing is constructed to handle data differently at various lifecycle stages.
As shown in the following figure, the page dwell time can be calculated from the difference between the onHidden and onShown time points. It is worth mentioning that when you need to unregister the navDestinationSwitch listener, you must specify the corresponding callback function to be unregistered. Otherwise, all global listeners for navDestinationSwitch become invalid, which may cause certain application features to fail.

During the data collection process, the system does not provide the listening capability for some events, and these events do not have a complete lifecycle to listen to. To achieve non-intrusive data collection, the SDK adopts aspect-oriented programming (AOP) to implement non-intrusive instrumentation during code compilation. The overall development idea for the plug-in refers to Huolala's open-source solution at https://github.com/HuolalaTech/AspectPro/tree/master, which implements code replacement during the code compilation process.

For example, each httpRequest corresponds to an HTTP request task in the network framework ohos.net.http. The SDK instruments the key code http.createHttp(), adds crucial processing logic, records performance metrics for network success and failure, and then generates a network span to report the data.
In the new era of HarmonyOS NEXT, Alibaba Cloud ARMS Real User Monitoring (RUM) SDK, as a performance and experience monitoring tool, can serve as a powerful assistant for application O&M. ARMS RUM SDK for HarmonyOS NEXT has been officially released. For more information, see the integration documentation. If you have any questions, you can join the RUM support DingTalk group (group ID: 67370002064) for consultation.
619 posts | 54 followers
FollowAlibaba Cloud Native Community - November 11, 2025
Alibaba Cloud Indonesia - November 30, 2023
Alibaba Cloud Native - September 12, 2024
Alibaba Cloud Community - April 24, 2024
Alibaba Clouder - December 22, 2020
Alibaba Cloud Native Community - October 11, 2025
619 posts | 54 followers
Follow
Application Real-Time Monitoring Service
Build business monitoring capabilities with real time response based on frontend monitoring, application monitoring, and custom business monitoring capabilities
Learn More
Real-Time Livestreaming Solutions
Stream sports and events on the Internet smoothly to worldwide audiences concurrently
Learn More
Managed Service for Prometheus
Multi-source metrics are aggregated to monitor the status of your business and services in real time.
Learn More
Elastic High Performance Computing Solution
High Performance Computing (HPC) and AI technology helps scientific research institutions to perform viral gene sequencing, conduct new drug research and development, and shorten the research and development cycle.
Learn MoreMore Posts by Alibaba Cloud Native Community