diff --git a/CMakeLists.txt b/CMakeLists.txt index 12c3af8771..04ae173b1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,11 +141,13 @@ if(rocksdb) endif() # OpenTelemetry distributed tracing (optional). -# When ON, links against opentelemetry-cpp and defines XRPL_ENABLE_TELEMETRY +# When on, links against opentelemetry-cpp and defines XRPL_ENABLE_TELEMETRY # so that SpanGuard factory methods produce real OTel spans. -# When OFF (default), all tracing code compiles to no-ops with zero overhead. -# Enable via: conan install -o telemetry=True, or cmake -Dtelemetry=ON. -option(telemetry "Enable OpenTelemetry tracing" ON) +# When off, all tracing code compiles to no-ops with zero overhead. +# +# There is no CMake option. The one switch is `conan install -o telemetry=`, +# which decides whether opentelemetry-cpp is fetched and sets the variable read +# below through the generated toolchain. if(telemetry) find_package(opentelemetry-cpp CONFIG REQUIRED) add_compile_definitions(XRPL_ENABLE_TELEMETRY) diff --git a/docs/build/telemetry.md b/docs/build/telemetry.md index 0d6f886b55..696c799b50 100644 --- a/docs/build/telemetry.md +++ b/docs/build/telemetry.md @@ -29,9 +29,9 @@ When enabled, it instruments RPC requests with trace spans that are exported via OTLP/HTTP to an OpenTelemetry Collector, which forwards them to a tracing backend such as Grafana Tempo. -Telemetry is **off by default** at both compile time and runtime: +Telemetry is gated twice — once at compile time and once at runtime: -- **Compile time**: The Conan option `telemetry` and CMake option `telemetry` must be set to `True`/`ON`. +- **Compile time**: The Conan option `telemetry` must be `True`. It is the only switch: there is no CMake option, because `conan install` writes the value into the generated toolchain and CMake reads it from there. When disabled, all `SpanGuard` calls compile to inline no-ops (defined in `SpanGuard.h`) with zero overhead — no OTel SDK dependency required. - **Runtime**: The `[telemetry]` config section must set `enabled=1`.