Skip to content

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:

  1. Create a C++ application in RUM and obtain the RUM App ID.
  2. Confirm that DataKit is installed and the RUM collector configuration is complete.
  3. Confirm that the current device can access the DataKit address configured in setServerUrl.
  4. Complete SDK installation. For specific methods, please refer to Application Access.

Integration Steps

  1. Install datakit-sdk-cpp in your project.
  2. Include FTSDKFactory.h.
  3. Initialize FTSDKConfig.
  4. Initialize FTRUMConfig.
  5. Trigger an upload of View, Action, Resource, Error, or LongTask by manually calling an SDK interface.
  6. 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

  1. Enable enable_sdk_log in ft_sdk_config.json.
  2. Run the program and manually call a View, Action, Resource, Error, LongTask, or Log interface once in your business code.
  3. Confirm network connectivity from the device to DataKit.
  4. 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