Skip to content

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:

  1. Create a C++ application in Real User Monitoring (RUM) and obtain the RUM App ID.
  2. Confirm that DataKit is installed and the RUM Collector is configured.
  3. Confirm that the current device can access the DataKit address configured in setServerUrl.
  4. Install the SDK. For details, see Application Access.

Integration Steps

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

  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 API once in your application code.
  3. Confirm that the device can reach DataKit over the network.
  4. Return to the console and confirm that the corresponding RUM or log data is displayed.

For further troubleshooting, see Troubleshooting.

Next Steps

Feedback

Is this page helpful?