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"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-05 UTC."],[[["This document outlines how to enable and use OpenTelemetry tracing within the Google Cloud C++ client library, covering various versions from 2.10.1 up to the latest release candidate, 2.37.0-rc."],["Enabling OpenTelemetry tracing allows the client library to generate traces, which are handled using a global tracer provider, and requires the library to be compiled with OpenTelemetry support."],["To activate tracing, users must supply this tracing option to the `Make*Connection(...)` factory functions, or `Make*Credentials(...)` if custom credentials are used, and is toggled by the environment variable `GOOGLE_CLOUD_CPP_OPENTELEMETRY_TRACING`."],["The document highlights that enabling tracing merely generates the traces, and users must separately configure trace export, recommending `google::cloud::otel::ConfigureBasicTracing()` to send traces to Google Cloud Trace."],["The structure `google::cloud::OpenTelemetryTracingOption` is used to enable or disable tracing, it has a type alias of `bool` and is used throughout versions 2.10.1 and up to 2.37.0-rc."]]],[]]