The Real User Monitoring (RUM) sub-service of Application Real-Time Monitoring Service (ARMS) provides comprehensive monitoring capabilities for PC apps and dynamic libraries in C and C++ languages. This topic describes how to use RUM SDKs for C and C++ to integrate Windows and macOS apps into RUM.
Supported versions and architecture
RUM SDKs for C and C++ support the following Windows and macOS versions and architecture.
Operating system | Operating system version | Architecture |
Windows | 7+ | x86 and x86-64 |
macOS | 10.13+ | x86-64 and ARM64 |
Step 1: Create an app
Log on to the ARMS console.
In the left-side navigation pane, choose . In the top navigation bar, select a region.
On the Applications page, click Add Application.
In the Create Application panel, select Windows or macOS.
In the Windows or macOS panel, enter the app name and description, and click Create.
Then, an address to which monitoring data is reported (ConfigAddress) and an app ID (AppID) are automatically generated for the app.
Step 2: Integrate the SDK
1. Download the SDK
Operating system | Architecture | Dynamic library |
Windows |
| https://rum-sdk.oss-cn-hangzhou.aliyuncs.com/native/AlibabaCloud_RUM_Windows_0.2.1.zip |
macOS |
| https://rum-sdk.oss-cn-hangzhou.aliyuncs.com/native/AlibabaCloud_RUM_macOS_0.2.1.zip |
SDK description:
Features:
Collection of page view and unique visitor statistics
Crash data capture
Collection of network service data from libcurl and Chromium Embedded Framework (CEF)
Custom event reporting
Dynamic libraries:
macOS:
dylibWindows:
dll
Currently, data collection can be configured only for dynamic libraries.
2. Initialize the SDK
Import the header file.
Both Windows and macOS require header files.
#include "alibabacloud_rum.h"Initialize the SDK.
The SDK offers extensive configuration options. For more information, see Sample configurations of the RUM SDK for PC apps.
alibabacloud_rum_options_t *options = alibabacloud_rum_options_new(); // Required. Specify the address. alibabacloud_rum_options_set_config_address(options, "<your config address>"); // Required. Specify the app ID. alibabacloud_rum_options_set_app_id(options, "<your appId>"); // Required. Specify the app version. alibabacloud_rum_options_set_app_version(options, "0.1.0"); // Optional. Specify whether you are using a development environment or a production environment. The default value is ALIBABACLOUD_RUM_ENV_PROD. alibabacloud_rum_options_set_env(options, ALIBABACLOUD_RUM_ENV_PROD); // Optional. Specify whether to enable crash data capture. By default, this feature is enabled. alibabacloud_rum_options_set_auto_crash_tracking(options, 1); // Optional. Specify whether to enable curl network data collection. By default, this feature is enabled. alibabacloud_rum_options_set_auto_curl_tracking(options, 1); // Optional. Specify whether to enable CEF network request data collection. By default, this feature is disabled. alibabacloud_rum_options_set_auto_cef_tracking(options, 1); // Optional. Configure collection filters for network request data. The following configurations are supported: // 1. When the should_tracing function returns 0, the end-to-end connection for the current URL is not enabled. The default value is 0, indicating that end-to-end connection is not supported for all URL requests. // 2. When the should_record_request function returns 0, the current URL is not collected. The default value is 1, indicating that all URL requests are collected. alibabacloud_rum_network_options_t *network_options = alibabacloud_rum_network_options_new(); network_options->should_tracing = example_should_tracing; network_options->should_record_request = example_should_record_request; alibabacloud_rum_options_set_network_options(options, network_options); // Required. Initialize the SDK. alibabacloud_rum_init(options);
Verify the result
If the [AlibabaCloud-RUM] [INFO] [Init] alibabacloud rum init success. log appears after the app runs, the SDK initialization is successful.
Sample log entry:
2024-07-25 17:27:27.647 [AlibabaCloud-RUM] [INFO] [Init] alibabacloud rum init success.Disable the SDK
If you no longer want to use the RUM SDK to monitor your PC app, you can call the following function to disable the SDK.
After you call the function, the SDK configurations will be destroyed, all SDK features will be stopped, and memory resources will be revoked.
alibabacloud_rum_close();A brief block may occur when you call the function because the system needs to revoke the resources, and complete the backend asynchronous operations.