All Products
Search
Document Center

Application Real-Time Monitoring Service:Use Jaeger to report C++ application data

Last Updated:Mar 11, 2026

Instrument a C++ application with the Jaeger client library to report trace data to Managed Service for OpenTelemetry. After integration, the ARMS console displays application topology, traces, abnormal and slow transactions, and SQL analysis data.

Important

The Jaeger project no longer maintains its client SDKs. All users are advised to migrate to OpenTelemetry. Connect your application through OpenTelemetry Protocol (OTLP) for broader feature support and better tracing capabilities. For OTLP integration instructions, see Preparations.

How data reporting works

There are two ways to report trace data to the backend:

  • Direct reporting (without Jaeger Agent): Your application sends spans directly to the Managed Service for OpenTelemetry backend over HTTP or gRPC.

    image

  • Agent-based reporting (with Jaeger Agent): Your application sends spans to a local Jaeger Agent, which forwards them to the backend.

    image

Prerequisites

Before you begin, make sure you have:

  • CMake installed

  • GCC V4.9.2 or later

Get a reporting endpoint

  1. Log on to the ARMS console. In the left-side navigation pane, click Integration Center.

  2. On the Integration Center page, click the Jaeger card in the Server-side Applications section.

  3. In the Jaeger panel, click the Start Integration tab, then select the region where you want to report data.

    Note

    When you access a region for the first time, resources are automatically initialized.

  4. Set Connection Type and Export Protocol, then copy the endpoint.

    ParameterOptionsRecommendation
    Connection TypeAlibaba Cloud VPC Network, Public NetworkSelect Alibaba Cloud VPC Network if your service runs on Alibaba Cloud in the selected region. Otherwise, select Public Network.
    Export ProtocolHTTP, gRPCSelect HTTP (recommended) or gRPC, depending on the protocol your client supports.

    image.png

Quick start

Build the Jaeger C++ client, run the built-in example, and verify that trace data reaches the console.

  1. Download jaeger-client-cpp:

    wget https://github.com/jaegertracing/jaeger-client-cpp/archive/master.zip && unzip master.zip
  2. Enter the project directory and build:

    mkdir build
    cd build
    cmake ..
    make
  3. Download the Jaeger Agent and start it. Replace <endpoint> with the endpoint you copied in Get a reporting endpoint.

    # The reporter.grpc.host-port value is your region-specific endpoint.
    nohup ./jaeger-agent --reporter.grpc.host-port=tracing-analysis-dc-sz.aliyuncs.com:1883 --jaeger.tags=<endpoint>
  4. Run the built-in example:

    ./app ../examples/config.yml
  5. Verify trace data in the console:

    1. Log on to the ARMS console.

    2. In the left-side navigation pane, choose Application Monitoring > Applications.

    3. Click your application name to view trace data.

    Note

    If the image icon appears in the Language column, the application is connected to Application Monitoring. If a hyphen (-) appears, the application is connected to Managed Service for OpenTelemetry.

Instrument your application

To instrument your own C++ application with the Jaeger Agent, complete the following steps: install the client, create a tracer, create spans, and start the agent to forward data.

Step 1: Install the Jaeger client

Download and build jaeger-client-cpp. For installation instructions and source code, see jaeger-client-cpp.

Step 2: Create a tracer

Create a tracer from a YAML configuration file. The tracer is registered as a global singleton so all parts of your application can access it.

void setUpTracer(const char* configFilePath)
{
    auto configYAML = YAML::LoadFile(configFilePath);
    // Parse the YAML configuration.
    auto config = jaegertracing::Config::parse(configYAML);
    // Create a tracer with a service name and logger.
    auto tracer = jaegertracing::Tracer::make(
        "example-service", config, jaegertracing::logging::consoleLogger());
    // Register the tracer as the global tracer.
    opentracing::Tracer::InitGlobal(
        std::static_pointer_cast<opentracing::Tracer>(tracer));
}

The following YAML file configures the tracer to sample all requests and log spans to the console:

disabled: false
reporter:
  logSpans: true
sampler:
  type: const
  param: 1

Step 3: Create spans

Create a root span for top-level operations and child spans for sub-operations:

// Create a child span under an existing parent span.
void tracedSubroutine(const std::unique_ptr<opentracing::Span>& parentSpan)
{
    auto span = opentracing::Tracer::Global()->StartSpan(
        "tracedSubroutine", { opentracing::ChildOf(&parentSpan->context()) });
}

// Create a root span with no parent.
void tracedFunction()
{
    auto span = opentracing::Tracer::Global()->StartSpan("tracedFunction");
    tracedSubroutine(span);
}

Step 4: Start the Jaeger Agent and report data

Download the Jaeger Agent and start it. Replace <endpoint> with the endpoint you copied in Get a reporting endpoint.

# The reporter.grpc.host-port value is your region-specific endpoint.
nohup ./jaeger-agent --reporter.grpc.host-port=tracing-analysis-dc-sz.aliyuncs.com:1883 --jaeger.tags=<endpoint>