From f68cf0d00989d553cc0b8da07ee30ddc52a72173 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 3 Sep 2026 15:09:19 +0100 Subject: [PATCH 1/2] refactor(telemetry): name the traces endpoint for its signal [telemetry] endpoint carried one OTLP signal while its name implied it covered every signal. That asymmetry is what let the metrics URL be guessed later by rewriting this one's path suffix, so anything not ending /v1/traces silently posted metrics to the traces path. Renames the key to traces_endpoint and Setup::exporterEndpoint to tracesEndpoint. The default value is unchanged and the URL is still used verbatim, with no path derived from it. The startup log line and the compose-file example name the new key, the latter being where an operator copies it from. No metrics_endpoint is added here: this branch has no metrics pipeline, so the key would parse into a member nothing reads. --- docker/telemetry/docker-compose.yml | 2 +- include/xrpl/telemetry/Telemetry.h | 5 +++-- src/libxrpl/telemetry/Telemetry.cpp | 4 ++-- src/libxrpl/telemetry/TelemetryConfig.cpp | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docker/telemetry/docker-compose.yml b/docker/telemetry/docker-compose.yml index a910e1a940..0b3f268aaf 100644 --- a/docker/telemetry/docker-compose.yml +++ b/docker/telemetry/docker-compose.yml @@ -15,7 +15,7 @@ # Configure xrpld to export traces by adding to xrpld.cfg: # [telemetry] # enabled=1 -# endpoint=http://localhost:4318/v1/traces +# traces_endpoint=http://localhost:4318/v1/traces services: # OpenTelemetry Collector: receives spans from xrpld via OTLP protocol, diff --git a/include/xrpl/telemetry/Telemetry.h b/include/xrpl/telemetry/Telemetry.h index a7156c0bfa..678a41c50b 100644 --- a/include/xrpl/telemetry/Telemetry.h +++ b/include/xrpl/telemetry/Telemetry.h @@ -168,9 +168,10 @@ public: std::string serviceInstanceId; /** - * OTLP/HTTP endpoint URL where spans are sent. + * Full OTLP/HTTP URL where spans are sent, including the signal path. + * Used verbatim: no other endpoint is derived from it. */ - std::string exporterEndpoint = "http://localhost:4318/v1/traces"; + std::string tracesEndpoint = "http://localhost:4318/v1/traces"; /** * Whether to use TLS for the exporter connection. diff --git a/src/libxrpl/telemetry/Telemetry.cpp b/src/libxrpl/telemetry/Telemetry.cpp index d07f480a58..6c72b2ed20 100644 --- a/src/libxrpl/telemetry/Telemetry.cpp +++ b/src/libxrpl/telemetry/Telemetry.cpp @@ -286,12 +286,12 @@ public: void start() override { - JLOG(journal_.info()) << "Telemetry starting: endpoint=" << setup_.exporterEndpoint + JLOG(journal_.info()) << "Telemetry starting: traces_endpoint=" << setup_.tracesEndpoint << " sampling=" << setup_.samplingRatio; // Configure OTLP HTTP exporter otlp_http::OtlpHttpExporterOptions exporterOpts; - exporterOpts.url = setup_.exporterEndpoint; + exporterOpts.url = setup_.tracesEndpoint; if (setup_.useTls) { exporterOpts.ssl_ca_cert_path = setup_.tlsCertPath; diff --git a/src/libxrpl/telemetry/TelemetryConfig.cpp b/src/libxrpl/telemetry/TelemetryConfig.cpp index 828b303c58..4cbbbf2a98 100644 --- a/src/libxrpl/telemetry/TelemetryConfig.cpp +++ b/src/libxrpl/telemetry/TelemetryConfig.cpp @@ -31,7 +31,7 @@ namespace key { constexpr char const* enabled = "enabled"; constexpr char const* serviceName = "service_name"; constexpr char const* serviceInstanceId = "service_instance_id"; -constexpr char const* endpoint = "endpoint"; +constexpr char const* tracesEndpoint = "traces_endpoint"; constexpr char const* useTls = "use_tls"; constexpr char const* tlsCaCert = "tls_ca_cert"; constexpr char const* batchSize = "batch_size"; @@ -54,7 +54,7 @@ constexpr char const* traceLedger = "trace_ledger"; */ namespace dflt { constexpr char const* serviceName = "xrpld"; -constexpr char const* endpoint = "http://localhost:4318/v1/traces"; +constexpr char const* tracesEndpoint = "http://localhost:4318/v1/traces"; constexpr std::uint32_t batchSize = 512u; constexpr std::uint32_t batchDelayMs = 5000u; constexpr std::uint32_t maxQueueSize = 2048u; @@ -97,7 +97,7 @@ makeTelemetrySetup( setup.serviceVersion = version; setup.serviceInstanceId = section.valueOr(key::serviceInstanceId, nodePublicKey); - setup.exporterEndpoint = section.valueOr(key::endpoint, dflt::endpoint); + setup.tracesEndpoint = section.valueOr(key::tracesEndpoint, dflt::tracesEndpoint); setup.useTls = section.valueOr(key::useTls, 0) != 0; setup.tlsCertPath = section.valueOr(key::tlsCaCert, ""); From d00a550895e7866172421356ef00f3e24ba0d2e7 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 3 Sep 2026 15:15:09 +0100 Subject: [PATCH 2/2] test(telemetry): follow the traces_endpoint rename in the config test The rename arrived from phase-1b by merge, which left this test naming a member that no longer exists. Updates both assertions to tracesEndpoint and the section key to traces_endpoint. The key matters as much as the member: had only the member been renamed, the parse would have fallen back to the default and the test would have compared the collector URL against localhost. --- src/tests/libxrpl/telemetry/TelemetryConfig.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/libxrpl/telemetry/TelemetryConfig.cpp b/src/tests/libxrpl/telemetry/TelemetryConfig.cpp index 82b0fe70c6..152511e0a5 100644 --- a/src/tests/libxrpl/telemetry/TelemetryConfig.cpp +++ b/src/tests/libxrpl/telemetry/TelemetryConfig.cpp @@ -13,7 +13,7 @@ TEST(TelemetryConfig, setup_defaults) EXPECT_EQ(s.serviceName, "xrpld"); EXPECT_TRUE(s.serviceVersion.empty()); EXPECT_TRUE(s.serviceInstanceId.empty()); - EXPECT_EQ(s.exporterEndpoint, "http://localhost:4318/v1/traces"); + EXPECT_EQ(s.tracesEndpoint, "http://localhost:4318/v1/traces"); EXPECT_FALSE(s.useTls); EXPECT_TRUE(s.tlsCertPath.empty()); EXPECT_DOUBLE_EQ(s.samplingRatio, 1.0); @@ -53,7 +53,7 @@ TEST(TelemetryConfig, parse_full_section) section.set("service_name", "my-rippled"); section.set("service_instance_id", "custom-id"); section.set("exporter", "otlp_http"); - section.set("endpoint", "http://collector:4318/v1/traces"); + section.set("traces_endpoint", "http://collector:4318/v1/traces"); section.set("use_tls", "1"); section.set("tls_ca_cert", "/etc/ssl/ca.pem"); section.set("batch_size", "256"); @@ -70,7 +70,7 @@ TEST(TelemetryConfig, parse_full_section) EXPECT_TRUE(setup.enabled); EXPECT_EQ(setup.serviceName, "my-rippled"); EXPECT_EQ(setup.serviceInstanceId, "custom-id"); - EXPECT_EQ(setup.exporterEndpoint, "http://collector:4318/v1/traces"); + EXPECT_EQ(setup.tracesEndpoint, "http://collector:4318/v1/traces"); EXPECT_TRUE(setup.useTls); EXPECT_EQ(setup.tlsCertPath, "/etc/ssl/ca.pem"); EXPECT_EQ(setup.batchSize, 256u);