Quick Start¶
This document provides the shortest integration path for the C++ RUM SDK to help you complete a verifiable data report with minimal steps.
Because the C++ SDK currently does not provide automatic capture capabilities, after initialization you also need to report View, Action, Resource, Error, or LongTask data by manually calling SDK APIs.
The application supports Agent Auto-Access and Manual Access. The following steps describe the minimal configuration for manual access.
Prerequisites¶
Before you begin, complete the following preparations:
- Create a C++ application in Real User Monitoring (RUM) and obtain the
RUM App ID. - Confirm that DataKit is installed and the RUM Collector is configured.
- Confirm that the current device can access the DataKit address configured in
setServerUrl. - Install the SDK. For details, see Application Access.
Integration Steps¶
- Install
datakit-sdk-cppin the project. - Include
FTSDKFactory.h. - Initialize
FTSDKConfig. - Initialize
FTRUMConfig. - Trigger a
View,Action,Resource,Error, orLongTaskreport by manually calling an SDK API. - Confirm in the console that the data has been successfully integrated.
Minimal Initialization Example¶
#include "datakit-sdk-cpp/FTSDKFactory.h"
//...
auto sdk = FTSDKFactory::get();
sdk->init();
FTSDKConfig sdkConfig;
sdkConfig.setServerUrl("http://10.0.0.1:9529")
.setEnableFileDBCache(true);
sdk->install(sdkConfig);
FTRUMConfig rumConfig;
rumConfig.setRumAppId("appid_xxxx");
sdk->initRUMWithConfig(rumConfig);
Manually Calling the SDK After Initialization¶
After initialization, the SDK does not automatically monitor page switches, click actions, or network requests. You need to actively call the collection APIs in your application code.
For example:
sdk->startView("main_view");
sdk->startAction("launch", "click");
sdk->stopAction();
sdk->stopView();
To manually collect data such as Resource, Error, and LongTask, see Custom Collection Rules.
Optional: Initialize Log and Trace¶
If you also need log collection or distributed tracing, you can add the following initialization:
FTLogConfig logConfig;
logConfig.setEnableCustomLog(true)
.setEnableLinkRumData(true);
sdk->initLogWithConfig(logConfig);
FTTraceConfig traceConfig;
traceConfig.setTraceType(TraceType::DDTRACE)
.setEnableLinkRUMData(true);
sdk->initTraceWithConfig(traceConfig);
Verify Successful Integration¶
- Enable
enable_sdk_loginft_sdk_config.json. - Run the program and manually call a
View,Action,Resource,Error,LongTask, orLogAPI once in your application code. - Confirm that the device can reach DataKit over the network.
- Return to the console and confirm that the corresponding RUM or log data is displayed.
For further troubleshooting, see Troubleshooting.
Next Steps¶
- For complete installation instructions, see Application Access.
- For SDK initialization and runtime capabilities, see SDK Initialization.
- For detailed RUM configuration, see RUM Configuration.
- For Log and Trace configuration, see Log Configuration and Trace Configuration.
- For custom collection capabilities, see Custom Collection Rules.