From e52f235356c60e4f18375a9aa777dc3f37e5952f Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 17 Sep 2026 16:54:03 +0100 Subject: [PATCH] build: make the Conan option the only telemetry switch CMakeLists declared option(telemetry) with a default of its own, so the setting had two homes and they were free to disagree. The Conan option already reaches CMake without it: conanfile.py forwards the option into the generated toolchain, which sets the variable this file reads, and every build here goes through Conan. Drop the option() call and keep the if(telemetry) test. docs/build/telemetry.md told readers a CMake option had to be set as well, so that goes with it. --- CMakeLists.txt | 10 ++++++---- docs/build/telemetry.md | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb3c29b8c8..a054226ace 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 tracing macros in TracingInstrumentation.h are compiled in. -# 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 14f40c355b..047a949977 100644 --- a/docs/build/telemetry.md +++ b/docs/build/telemetry.md @@ -28,9 +28,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`.