Quick Start¶
This document provides the shortest path to integrate the C++ RUM SDK, helping you complete a verifiable data upload with minimal steps.
Since the C++ SDK currently does not offer automatic capture capabilities, after completing initialization, you still need to manually call SDK interfaces to upload View, Action, Resource, Error, or LongTask data.
Prerequisites¶
Before starting, please complete the following preparations:
- Create a C++ application in RUM and obtain the
RUM App ID. - Confirm that DataKit is installed and the RUM collector configuration is complete.
- Confirm that the current device can access the DataKit address configured in
setServerUrl. - Complete SDK installation. For specific methods, please refer to Application Access.
Integration Steps¶
- Install
datakit-sdk-cppin your project. - Include
FTSDKFactory.h. - Initialize
FTSDKConfig. - Initialize
FTRUMConfig. - Trigger an upload of
View,Action,Resource,Error, orLongTaskby manually calling an SDK interface. - Confirm in the console that the data has been successfully ingested.
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);
Manual SDK Calls After Initialization¶
After initialization, the SDK does not automatically monitor page switches, click behaviors, or network requests. You need to actively call the collection interfaces in your business code.
For example:
sdk->startView("main_view");
sdk->startAction("launch", "click");
sdk->stopAction();
sdk->stopView();
If you need to manually collect data such as Resource, Error, or LongTask, please read Custom Collection Rules.
Optional: Initialize Log and Trace¶
If you also need log collection or APM, you can continue by adding 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, orLoginterface once in your business code. - Confirm network connectivity from the device to DataKit.
- Return to the console and confirm that the corresponding RUM or log data has appeared.
If further troubleshooting is needed, please refer to Troubleshooting.
Next Steps¶
- For complete installation instructions, please read Application Access.
- For SDK initialization and runtime capabilities, please read SDK Initialization.
- For detailed RUM configuration, please read RUM Configuration.
- For Log and Trace configuration, please read Log Configuration and Trace Configuration.
- For custom collection capabilities, please read Custom Collection Rules.