diff --git a/OpenTelemetryPlan/04-code-samples.md b/OpenTelemetryPlan/04-code-samples.md index d4d5c0bdc0..d242de1764 100644 --- a/OpenTelemetryPlan/04-code-samples.md +++ b/OpenTelemetryPlan/04-code-samples.md @@ -165,12 +165,12 @@ public: // Factory functions std::unique_ptr -make_Telemetry( +makeTelemetry( Telemetry::Setup const& setup, beast::Journal journal); Telemetry::Setup -setup_Telemetry( +setupTelemetry( Section const& section, std::string const& nodePublicKey, std::string const& version); diff --git a/OpenTelemetryPlan/05-configuration-reference.md b/OpenTelemetryPlan/05-configuration-reference.md index 493a4bfc56..11a7af00f5 100644 --- a/OpenTelemetryPlan/05-configuration-reference.md +++ b/OpenTelemetryPlan/05-configuration-reference.md @@ -128,7 +128,7 @@ namespace xrpl { namespace telemetry { Telemetry::Setup -setup_Telemetry( +setupTelemetry( Section const& section, std::string const& nodePublicKey, std::string const& version) @@ -213,8 +213,8 @@ class ApplicationImp : public Application, public BasicApp // Member initializer list (excerpt): // ... // , telemetry_( - // telemetry::make_Telemetry( - // telemetry::setup_Telemetry( + // telemetry::makeTelemetry( + // telemetry::setupTelemetry( // config_->section("telemetry"), // "", // Updated later via setServiceInstanceId() // BuildInfo::getVersionString()), @@ -629,8 +629,8 @@ flowchart TB end subgraph init["Initialization"] - parse["setup_Telemetry()"] - factory["make_Telemetry()"] + parse["setupTelemetry()"] + factory["makeTelemetry()"] end subgraph runtime["Runtime Components"] @@ -663,7 +663,7 @@ flowchart TB **Reading the diagram:** - **Configuration Sources**: `xrpld.cfg` provides runtime settings (endpoint, sampling) while the CMake flag controls whether telemetry is compiled in at all. -- **Initialization**: `setup_Telemetry()` parses config values, then `make_Telemetry()` constructs the provider, processor, and exporter objects. +- **Initialization**: `setupTelemetry()` parses config values, then `makeTelemetry()` constructs the provider, processor, and exporter objects. - **Runtime Components**: The `TracerProvider` creates spans, the `BatchProcessor` buffers them, and the `OTLP Exporter` serializes and sends them over the wire. - **OTLP arrow to Collector**: Trace data leaves the xrpld process via OTLP (gRPC or HTTP) and enters the external Collector pipeline. - **Collector Pipeline**: `Receivers` ingest OTLP data, `Processors` apply sampling/filtering/enrichment, and `Exporters` forward traces to storage backends (Tempo, etc.). diff --git a/OpenTelemetryPlan/POC_taskList.md b/OpenTelemetryPlan/POC_taskList.md index ef9ea332c1..112c0359fe 100644 --- a/OpenTelemetryPlan/POC_taskList.md +++ b/OpenTelemetryPlan/POC_taskList.md @@ -143,8 +143,8 @@ - `virtual bool shouldTraceRpc() const = 0;` - `virtual bool shouldTraceTransactions() const = 0;` - `virtual bool shouldTraceConsensus() const = 0;` - - Factory: `std::unique_ptr make_Telemetry(Setup const&, beast::Journal);` - - Config parser: `Telemetry::Setup setup_Telemetry(Section const&, std::string const& nodePublicKey, std::string const& version);` + - Factory: `std::unique_ptr makeTelemetry(Setup const&, beast::Journal);` + - Config parser: `Telemetry::Setup setupTelemetry(Section const&, std::string const& nodePublicKey, std::string const& version);` - Create `include/xrpl/telemetry/SpanGuard.h`: - RAII guard with static factory methods (`rpcSpan()`, `txSpan()`, `consensusSpan()`, etc.) that access the global `Telemetry::getInstance()` singleton internally. @@ -196,10 +196,10 @@ - `shouldTraceRpc()` etc. read from `Setup` fields - Create `src/libxrpl/telemetry/TelemetryConfig.cpp`: - - `setup_Telemetry()` parses the `[telemetry]` config section from `xrpld.cfg` + - `setupTelemetry()` parses the `[telemetry]` config section from `xrpld.cfg` - Maps config keys: `enabled`, `exporter`, `endpoint`, `sampling_ratio`, `trace_rpc`, `trace_transactions`, `trace_consensus`, `trace_peer` -- Wire `make_Telemetry()` factory: +- Wire `makeTelemetry()` factory: - If `setup.enabled` is true AND `XRPL_ENABLE_TELEMETRY` is defined: return `TelemetryImpl` - Otherwise: return `NullTelemetry` @@ -217,7 +217,7 @@ **Reference**: - [04-code-samples.md §4.1](./04-code-samples.md) — `Telemetry` interface that `TelemetryImpl` must implement -- [05-configuration-reference.md §5.2](./05-configuration-reference.md) — `setup_Telemetry()` config parser implementation +- [05-configuration-reference.md §5.2](./05-configuration-reference.md) — `setupTelemetry()` config parser implementation - [02-design-decisions.md §2.2](./02-design-decisions.md) — OTLP/gRPC exporter config (endpoint, TLS options) - [02-design-decisions.md §2.4.1](./02-design-decisions.md) — Resource attributes: `service.name`, `service.version`, `service.instance.id`, `xrpl.network.id` - [03-implementation-strategy.md §3.4](./03-implementation-strategy.md) — Per-operation CPU costs and overhead budget for span creation @@ -242,8 +242,8 @@ `serviceInstanceId` (node identity is not yet known): ```cpp , telemetry_( - telemetry::make_Telemetry( - telemetry::setup_Telemetry( + telemetry::makeTelemetry( + telemetry::setupTelemetry( config_->section("telemetry"), "", // Updated later via setServiceInstanceId() BuildInfo::getVersionString()), diff --git a/OpenTelemetryPlan/Phase2_taskList.md b/OpenTelemetryPlan/Phase2_taskList.md index 6b64210e6b..1d01a8165e 100644 --- a/OpenTelemetryPlan/Phase2_taskList.md +++ b/OpenTelemetryPlan/Phase2_taskList.md @@ -67,7 +67,7 @@ - `src/tests/libxrpl/telemetry/TelemetryConfig.cpp`: - Test Setup defaults (all fields have correct initial values) - - Test `setup_Telemetry` config parser (empty section, full section, edge cases) + - Test `setupTelemetry` config parser (empty section, full section, edge cases) - Test `samplingRatio` clamping (values outside 0.0-1.0) - `src/tests/libxrpl/telemetry/SpanGuardFactory.cpp`: diff --git a/docs/build/telemetry.md b/docs/build/telemetry.md index d71a752aee..ed585cb64f 100644 --- a/docs/build/telemetry.md +++ b/docs/build/telemetry.md @@ -258,7 +258,7 @@ The Conan package provides a single umbrella target | `include/xrpl/telemetry/SpanGuard.h` | RAII span guard with `discard()` for dropping unwanted spans | | `include/xrpl/telemetry/DiscardFlag.h` | Thread-local discard flag (zero-dependency header) | | `src/libxrpl/telemetry/Telemetry.cpp` | OTel SDK setup, `FilteringSpanProcessor`, provider lifecycle | -| `src/libxrpl/telemetry/TelemetryConfig.cpp` | Config parser (`setup_Telemetry()`) | +| `src/libxrpl/telemetry/TelemetryConfig.cpp` | Config parser (`setupTelemetry()`) | | `src/libxrpl/telemetry/NullTelemetry.cpp` | No-op implementation (used when disabled) | | `src/libxrpl/telemetry/SpanGuard.cpp` | Pimpl implementation for SpanGuard (all OTel types confined) | | `src/xrpld/rpc/detail/ServerHandler.cpp` | RPC entry point instrumentation | diff --git a/src/libxrpl/telemetry/TelemetryConfig.cpp b/src/libxrpl/telemetry/TelemetryConfig.cpp index 2a392c9a88..b99c5de0b3 100644 --- a/src/libxrpl/telemetry/TelemetryConfig.cpp +++ b/src/libxrpl/telemetry/TelemetryConfig.cpp @@ -78,7 +78,7 @@ setupTelemetry( setup.traceLedger = section.valueOr("trace_ledger", 1) != 0; setup.consensusTraceStrategy = - section.value_or("consensus_trace_strategy", "deterministic"); + section.valueOr("consensus_trace_strategy", "deterministic"); return setup; } diff --git a/src/tests/libxrpl/telemetry/TelemetryConfig.cpp b/src/tests/libxrpl/telemetry/TelemetryConfig.cpp index 6ee77482f0..84bb3c991a 100644 --- a/src/tests/libxrpl/telemetry/TelemetryConfig.cpp +++ b/src/tests/libxrpl/telemetry/TelemetryConfig.cpp @@ -34,7 +34,7 @@ TEST(TelemetryConfig, setup_defaults) TEST(TelemetryConfig, parse_empty_section) { Section const section; - auto setup = telemetry::setup_Telemetry(section, "nHUtest123", "2.0.0", 0); + auto setup = telemetry::setupTelemetry(section, "nHUtest123", "2.0.0", 0); EXPECT_FALSE(setup.enabled); EXPECT_EQ(setup.serviceName, "xrpld"); @@ -68,7 +68,7 @@ TEST(TelemetryConfig, parse_full_section) section.set("trace_peer", "1"); section.set("trace_ledger", "0"); - auto setup = telemetry::setup_Telemetry(section, "nHUtest123", "2.0.0", 1); + auto setup = telemetry::setupTelemetry(section, "nHUtest123", "2.0.0", 1); EXPECT_TRUE(setup.enabled); EXPECT_EQ(setup.serviceName, "my-rippled"); @@ -94,7 +94,7 @@ TEST(TelemetryConfig, null_telemetry_factory) beast::Journal::Sink& sink = beast::Journal::getNullSink(); beast::Journal const j(sink); - auto tel = telemetry::make_Telemetry(setup, j); + auto tel = telemetry::makeTelemetry(setup, j); EXPECT_TRUE(tel != nullptr); EXPECT_FALSE(tel->isEnabled()); EXPECT_FALSE(tel->shouldTraceRpc()); @@ -112,11 +112,11 @@ TEST(TelemetryConfig, sampling_ratio_clamped) { Section section; section.set("sampling_ratio", "2.5"); - auto setup = telemetry::setup_Telemetry(section, "nHUtest123", "2.0.0", 0); + auto setup = telemetry::setupTelemetry(section, "nHUtest123", "2.0.0", 0); EXPECT_DOUBLE_EQ(setup.samplingRatio, 1.0); Section section2; section2.set("sampling_ratio", "-0.5"); - auto setup2 = telemetry::setup_Telemetry(section2, "nHUtest123", "2.0.0", 0); + auto setup2 = telemetry::setupTelemetry(section2, "nHUtest123", "2.0.0", 0); EXPECT_DOUBLE_EQ(setup2.samplingRatio, 0.0); } diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 21710157c1..e9df430c48 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -347,7 +347,7 @@ RCLConsensus::Adaptor::onClose( auto span = telemetry::SpanGuard::span( telemetry::TraceCategory::Consensus, telemetry::seg::consensus, cs::op::ledgerClose); - span.setAttribute(cs::attr::ledgerSeq, static_cast(ledger.ledger_->header().seq) + 1); + span.setAttribute(cs::attr::ledgerSeq, static_cast(ledger.ledger->header().seq) + 1); span.setAttribute(cs::attr::mode, toDisplayString(mode).c_str()); span.setAttribute( cs::attr::txCountOpen, static_cast(app_.getOpenLedger().current()->txCount())); @@ -1243,7 +1243,7 @@ RCLConsensus::Adaptor::startRoundTracing(RCLCxLedger const& prevLgr) telemetry::TraceCategory::Consensus, cs::round, prevLgr.id().data(), - prevLgr.id().bytes, + prevLgr.id().kBytes, link)); } else diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index c2ca9f0058..dbbcc8a0a9 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -1717,7 +1717,7 @@ Consensus::updateOurPositions(std::unique_ptr const& span.setAttribute(consensus::span::attr::haveCloseTimeConsensus, haveCloseTimeConsensus_); span.setAttribute( - consensus::span::attr::closeTimeThreshold, static_cast(parms.avCT_CONSENSUS_PCT)); + consensus::span::attr::closeTimeThreshold, static_cast(parms.avCtConsensusPct)); if (!ourNewSet && ((consensusCloseTime != asCloseTime(result_->position.closeTime())) || @@ -1879,7 +1879,7 @@ Consensus::haveConsensus(std::unique_ptr const& clog span.setAttribute(consensus::span::attr::haveCloseTimeConsensus, haveCloseTimeConsensus_); span.setAttribute( consensus::span::attr::thresholdPercent, - static_cast(adaptor_.parms().avCT_CONSENSUS_PCT)); + static_cast(adaptor_.parms().avCtConsensusPct)); span.setAttribute( consensus::span::attr::proposersFinished, static_cast(currentFinished)); span.setAttribute(consensus::span::attr::consensusStalled, stalled); diff --git a/src/xrpld/consensus/ConsensusTypes.h b/src/xrpld/consensus/ConsensusTypes.h index 7f0e4f4686..825b18a428 100644 --- a/src/xrpld/consensus/ConsensusTypes.h +++ b/src/xrpld/consensus/ConsensusTypes.h @@ -73,13 +73,13 @@ toDisplayString(ConsensusMode m) { switch (m) { - case ConsensusMode::proposing: + case ConsensusMode::Proposing: return "Proposing"; - case ConsensusMode::observing: + case ConsensusMode::Observing: return "Observing"; - case ConsensusMode::wrongLedger: + case ConsensusMode::WrongLedger: return "Wrong Ledger"; - case ConsensusMode::switchedLedger: + case ConsensusMode::SwitchedLedger: return "Switched Ledger"; default: return "Unknown"; diff --git a/src/xrpld/telemetry/TxTracing.h b/src/xrpld/telemetry/TxTracing.h index 68b4903f88..fe47d4f068 100644 --- a/src/xrpld/telemetry/TxTracing.h +++ b/src/xrpld/telemetry/TxTracing.h @@ -36,7 +36,7 @@ txReceiveSpan(uint256 const& txID, [[maybe_unused]] protocol::TMTransaction cons TraceCategory::Transactions, tx_span::receive, txID.data(), - txID.bytes, + txID.kBytes, reinterpret_cast(tc.span_id().data()), tc.span_id().size(), tc.has_trace_flags() ? static_cast(tc.trace_flags()) @@ -45,7 +45,7 @@ txReceiveSpan(uint256 const& txID, [[maybe_unused]] protocol::TMTransaction cons } #endif return SpanGuard::hashSpan( - TraceCategory::Transactions, tx_span::receive, txID.data(), txID.bytes); + TraceCategory::Transactions, tx_span::receive, txID.data(), txID.kBytes); } /** Create a "tx.process" span for transaction processing in NetworkOPs. @@ -55,7 +55,7 @@ inline SpanGuard txProcessSpan(uint256 const& txID) { return SpanGuard::hashSpan( - TraceCategory::Transactions, tx_span::process, txID.data(), txID.bytes); + TraceCategory::Transactions, tx_span::process, txID.data(), txID.kBytes); } } // namespace xrpl::telemetry