Setting this option enables the generation of traces by the client library. The library uses the global tracer provider to generate traces.
To create a client that traces, this option must be provided to the Make*Connection(...) factory functions. It does not have an effect when passed to a client's constructor. If you use custom credentials, this option must also be provided to the Make*Credentials(...) factory functions in order to trace the authentication components.
Exporting traces
Providing this option only enables the generation of traces. It does not enable the export of traces.
In order to export the traces, the application must set the global tracer provider. The client library recommends using #google::cloud::otel::ConfigureBasicTracing() to configure the global tracer provider. This will send the traces generated by the client library to Cloud Trace, Google Cloud's visualizer for distributed traces.
This option is controlled by the GOOGLE_CLOUD_CPP_OPENTELEMETRY_TRACING environment variable. If the environment variable is set to a non-empty value, tracing with OpenTelemetry is enabled.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-26 UTC."],[[["This document outlines the different versions of the `OpenTelemetryTracingOption` for the C++ client library, with version 2.37.0-rc being the latest."],["Enabling this option activates the generation of traces by the client library, utilizing the global tracer provider."],["The library must be compiled with OpenTelemetry for tracing to work, and a quickstart guide for this is linked."],["Exporting traces requires setting the global tracer provider, with a recommendation to use `google::cloud::otel::ConfigureBasicTracing()` for Cloud Trace integration."],["The `GOOGLE_CLOUD_CPP_OPENTELEMETRY_TRACING` environment variable can also be used to enable tracing."]]],[]]