Skip to main content

How App Monitoring Works

How Android SDK Works

The Mobile SDK uses bytecode technology at compile time or hook technology at runtime to embed performance monitoring code into application code, collecting performance data in real-time without affecting user code logic.

Whenever the App runs, the Mobile SDK collects data in real-time during application execution and reports data at certain intervals (default is 60 seconds) to the server data processing end for analysis and display in platform reports.

When the application switches to the background (30s) or exits, the Mobile SDK stops data collection and reporting to reduce unnecessary traffic consumption.

How iOS SDK Works

Leveraging Objective-C's runtime characteristics through Method Swizzle technology, it's possible to replace the method implementation corresponding to a selector at runtime, achieving the purpose of hooking methods. After embedding the Mobile SDK, at the beginning of application startup, the Mobile SDK performs Swizzle operations on the corresponding methods. When calling a function that has been Swizzled, the SDK's custom function will be called first, performing data collection operations, and then the SDK function will call back to the original function implementation without affecting the original application logic.

How HarmonyOS NEXT SDK Works

Embedding Method: The HarmonyOS NEXT SDK adopts a non-intrusive embedding strategy, utilizing system features and development frameworks provided by HarmonyOS 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 user code.

Collection Methods:

  • Event Subscription Mechanism: After SDK startup, through HarmonyOS's event subscription mechanism, it registers to monitor key performance indicators such as application lifecycle, user interface rendering, and system resource usage.

  • Exception Monitoring: Using system APIs to monitor application crashes and freezes, once an exception is detected, the SDK captures relevant stack information and context data to provide a basis for subsequent analysis.

  • Network Request Monitoring: By registering interceptors in the application's network request library, the SDK can capture the initiation, execution, and response processes of network requests without modifying application code, achieving network performance monitoring.

  • API Encapsulation: For critical system calls and third-party service requests, the SDK inserts monitoring logic through API encapsulation, ensuring the comprehensiveness and accuracy of data collection.

Upload Methods:

  • Data Caching: Collected performance data is first cached locally to reduce the impact on application runtime performance.
  • Intelligent Reporting Strategy: The SDK adopts an intelligent reporting strategy based on network conditions and application usage scenarios, choosing the optimal reporting timing and frequency to ensure data timeliness and completeness.
  • Data Encryption: During the data upload process, the SDK uses industry-standard encryption algorithms (national cryptographic standards) to ensure data transmission security and user privacy protection.
  • Server-side Processing: After uploading to the server, data will be analyzed and processed by a professional data processing system, ultimately presented to users in the form of charts and reports on the monitoring platform.

The HarmonyOS NEXT SDK, with its efficient, secure, and non-intrusive characteristics, provides a comprehensive performance monitoring solution for HarmonyOS applications. We are committed to providing developers with the highest quality tools to help them deeply understand application performance and optimize user experience.

Reported Data Processing

  • Network Data: By hooking network protocol libraries (OkHttp, NSURLSession, etc.), it captures network access requests (Http and Https standard protocols) made in the user's App in real-time, monitors Http errors (40X or 50X) and network errors (request timeout, unknown host, etc.) occurring during network access, and uploads data at a frequency of once per minute, ensuring data timeliness and accuracy while minimizing resource consumption.

  • Crash Data Collection: By setting up handlers to collect crash data, when the application crashes, the SDK immediately collects crash stack information, user interaction trajectory, user context information, and user-defined additional information, waiting to report to the server when the application starts next time, allowing crash information to be viewed through reports. In case of data upload failure (network interruption), crash data will be cached until the next initialization before uploading to the server.

  • Freeze Data Collection: By monitoring system message events to collect freeze data, when the main thread cannot normally receive and process messages, it can be considered that the main thread is in a frozen state. At this time, it collects stack information during the freeze, user interaction trajectory, request data during the freeze, user context information, and user-defined additional information, and immediately reports to the server, allowing freeze information to be viewed in reports within two to three minutes. In case of data upload failure (network interruption), freeze data will be cached until the next initialization before uploading to the server.

  • User Experience Data Collection: By monitoring native application system interfaces to collect data on application launches, page loading, and user operations, when users experience "slow events" (slow startup, slow interactivity, and slow operations) during use, it can provide detailed code call waterfall diagrams and user context information without manual instrumentation, quickly assisting development personnel in locating performance issues and optimizing user experience.