OpenTelemetry#

Portions of Arrow C++ are instrumented with theOpenTelemetry C++ SDK which makes it possible to generatedetailed tracing information which can be analyzed in other tools.

Creating a Build with OpenTelemetry Tracing Enabled#

OpenTelemetry tracing is not turned on by default so you must first create acustom build of Arrow C++ with tracing turned on. SeeBuilding Arrow C++ for general instructions on creating a custom build.

To enable tracing, specifyARROW_WITH_OPENTELEMETRY=ON when generating yourbuild. You may also want to specifyCMAKE_BUILD_TYPE=RelWithDebInfo in orderto get representative timings while retaining debug information.

Exporting Tracing Information#

By default, no tracing information is exported until a tracing backend has beenspecified. The choice of tracing backend is controlled with theARROW_TRACING_BACKEND environment variable. Possible values are:

  • ostream: emit textual log messages to stdout

  • otlp_http: emit OTLP JSON encoded traces to a HTTP server (by default,the endpoint URL is “http://localhost:4318/v1/traces”)

  • arrow_otlp_stdout: emit JSON traces to stdout

  • arrow_otlp_stderr: emit JSON traces to stderr

For example, to enable exporting JSON traces to stdout, set:

exportARROW_TRACING_BACKEND=arrow_otlp_stdout

At this point, running the program you’ve linked to your custom build ofArrow C++ should produce JSON traces on stdout.

Visualizing Traces with Jaeger UI#

Analyzing trace information exported to stdout/stderr may involve writing customprocessing scripts. As an alternative – or even a complement – to thisprocess, the “all-in-one”JaegerDocker image is a relatively straightforward way ofvisualizing trace data and is suitable for local development and testing.

Note: This assumes you haveDocker installed.

First, change your tracing backend tootlp_http:

exportARROW_TRACING_BACKEND=otlp_http

Then start the Jaeger all-in-one container:

dockerrun \-eCOLLECTOR_OTLP_ENABLED=true \-p16686:16686 \-p4317:4317 \-p4318:4318 \jaegertracing/all-in-one:1.35

Now you should be able to run your program and view any traces in a web browserathttp://localhost:16686. Note that unlike with other methods of exportingtraces, no output will be made to stdout/stderr. However, if you tail yourDocker container logs, you should see output when traces are received by theall-in-one container.