Working Principle
How the Android SDK works
Wukong SDK collects performance data in real time by implanting performance monitoring code in application code through bytecode technology at compile time or hook technology at run time. This process does not affect user code logic.
Whenever the App is running, Wukong SDK will collect data in real time during the running of the application, and report the data according to a certain time interval (60 seconds by default), which will be analyzed and processed by the server data processing terminal and displayed in the platform report.
When the application switches to the background (30s) or exits, Wukong SDK will stop data collection and reporting to reduce unnecessary traffic consumption.
How the iOS SDK works
By using the runtime feature of objective-c and the Method Swizzle technology, the method implementation corresponding to selector can be replaced at runtime to achieve the purpose of hooking the method. That is to say, after the Wukong SDK is embedded, at the beginning of the application program, the Wukong SDK will execute the Swizzle operation on the corresponding method, so that when a function after Swizzle is called, the corresponding user-defined function of the SDK will be called first, and some data acquisition operations will be executed in the SDK function. The SDK function will then call back to the implementation of the original function without affecting the original application logic.
How the HarmonyOS NEXT SDK works
Embedding Method: The HarmonyOS NEXT SDK adopts a non-intrusive embedding strategy, leveraging HarmonyOS's system features and development framework to monitor application performance. The SDK does not modify user business code during application compilation and runtime, ensuring transparency in the monitoring process and integrity of the user code.
Collection Method:
-
Event Subscription Mechanism: After the SDK starts, it registers to listen to key performance indicators such as application lifecycle events, user interface rendering, and system resource usage via HarmonyOS’s event subscription mechanism.
-
Exception Monitoring: Utilizing system APIs to monitor application crashes and lags, the SDK captures relevant stack information and contextual data upon detecting anomalies, providing a basis for subsequent analysis.
-
Network Request Monitoring: By registering interceptors in the application's network request library, the SDK captures the initiation, execution, and response process of network requests without modifying the application code, thereby monitoring network performance.
-
API Wrapping: For critical system calls and third-party service requests, the SDK inserts monitoring logic by wrapping APIs, ensuring comprehensive and accurate data collection.
Upload Method:
- Data Caching: Collected performance data is first cached locally to minimize impact on application runtime performance.
- Intelligent Reporting Strategy: The SDK uses an intelligent reporting strategy based on network conditions and application usage scenarios to select the optimal reporting timing and frequency, ensuring data timeliness and completeness.
- Data Encryption: During data upload, the SDK uses industry-standard encryption algorithms (national encryption) to ensure data transmission security and user privacy protection.
- Server-side Processing: After upload, data is analyzed and processed by a professional data processing system and is ultimately presented to users on the monitoring platform in the form of charts and reports.
The HarmonyOS NEXT SDK offers a comprehensive performance monitoring solution for HarmonyOS applications with its efficient, secure, and non-intrusive features. We are committed to providing developers with high-quality tools to help them delve into application performance and optimize user experience.
Report data processing
-
Network data: Capture the network access requests (HTTP and Https standard protocols) in the user's App in real time through the Hook network protocol class library (OkHttp, NSURLSession, etc.), and monitor the HTTP errors (40X or 50X) and network errors (request timeout, unknown host, etc.) occurring in the network access. And the data is uploaded at the frequency of once a minute, so that the real-time property and the accuracy of the data are ensured under the condition of reducing the resource consumption as much as possible.
-
Crash data collection: Collect crash data by setting the handler. When an application crashes, the SDK will immediately collect crash stack information, user interaction tracks, user context information, and user-defined additional information. When the application is started next time, it will be reported to the server. Crash information can be viewed through the report. In case of data upload failure (network interruption), the crashed data will be cached and uploaded to the server after the next initialization.
-
Stuck data collection: Stuck data is collected by monitoring system message events. When the main thread cannot receive and process messages normally, it can be considered that the main thread is in a stuck state at this time. At this time, the stack information, user interaction track, request data, user context information and user-defined additional information in the process of stuttering are collected and reported to the server immediately, and the stuttering information can be viewed in the report in two to three minutes. If the data upload fails (network interruption), the data will be cached until the next initialization and then uploaded to the server.
-
Collection of user experience data: collect data about application launching, page loading and user operations by monitoring the interfaces of native application systems; provide detailed waterfall diagrams of code calls and user context information without manual code insertion when "slow events" (slow launching, slow interaction and slow operation) occur during the use of the software, so as to quickly assist developers in locating performance issues. Optimize the user experience.