mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-02 08:17:13 +00:00
leftover clang-tidy fixes
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
This commit is contained in:
@@ -165,12 +165,12 @@ public:
|
||||
|
||||
// Factory functions
|
||||
std::unique_ptr<Telemetry>
|
||||
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);
|
||||
|
||||
@@ -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.).
|
||||
|
||||
@@ -143,8 +143,8 @@
|
||||
- `virtual bool shouldTraceRpc() const = 0;`
|
||||
- `virtual bool shouldTraceTransactions() const = 0;`
|
||||
- `virtual bool shouldTraceConsensus() const = 0;`
|
||||
- Factory: `std::unique_ptr<Telemetry> 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<Telemetry> 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()),
|
||||
|
||||
@@ -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`:
|
||||
|
||||
2
docs/build/telemetry.md
vendored
2
docs/build/telemetry.md
vendored
@@ -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 |
|
||||
|
||||
@@ -78,7 +78,7 @@ setupTelemetry(
|
||||
setup.traceLedger = section.valueOr<int>("trace_ledger", 1) != 0;
|
||||
|
||||
setup.consensusTraceStrategy =
|
||||
section.value_or<std::string>("consensus_trace_strategy", "deterministic");
|
||||
section.valueOr<std::string>("consensus_trace_strategy", "deterministic");
|
||||
|
||||
return setup;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<int64_t>(ledger.ledger_->header().seq) + 1);
|
||||
span.setAttribute(cs::attr::ledgerSeq, static_cast<int64_t>(ledger.ledger->header().seq) + 1);
|
||||
span.setAttribute(cs::attr::mode, toDisplayString(mode).c_str());
|
||||
span.setAttribute(
|
||||
cs::attr::txCountOpen, static_cast<int64_t>(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
|
||||
|
||||
@@ -1717,7 +1717,7 @@ Consensus<Adaptor>::updateOurPositions(std::unique_ptr<std::stringstream> const&
|
||||
|
||||
span.setAttribute(consensus::span::attr::haveCloseTimeConsensus, haveCloseTimeConsensus_);
|
||||
span.setAttribute(
|
||||
consensus::span::attr::closeTimeThreshold, static_cast<int64_t>(parms.avCT_CONSENSUS_PCT));
|
||||
consensus::span::attr::closeTimeThreshold, static_cast<int64_t>(parms.avCtConsensusPct));
|
||||
|
||||
if (!ourNewSet &&
|
||||
((consensusCloseTime != asCloseTime(result_->position.closeTime())) ||
|
||||
@@ -1879,7 +1879,7 @@ Consensus<Adaptor>::haveConsensus(std::unique_ptr<std::stringstream> const& clog
|
||||
span.setAttribute(consensus::span::attr::haveCloseTimeConsensus, haveCloseTimeConsensus_);
|
||||
span.setAttribute(
|
||||
consensus::span::attr::thresholdPercent,
|
||||
static_cast<int64_t>(adaptor_.parms().avCT_CONSENSUS_PCT));
|
||||
static_cast<int64_t>(adaptor_.parms().avCtConsensusPct));
|
||||
span.setAttribute(
|
||||
consensus::span::attr::proposersFinished, static_cast<int64_t>(currentFinished));
|
||||
span.setAttribute(consensus::span::attr::consensusStalled, stalled);
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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<std::uint8_t const*>(tc.span_id().data()),
|
||||
tc.span_id().size(),
|
||||
tc.has_trace_flags() ? static_cast<std::uint8_t>(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
|
||||
|
||||
Reference in New Issue
Block a user