From ae114c53415f8aacfecbb59689849c4deb2e01e5 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 11 Jun 2026 23:11:23 +0100 Subject: [PATCH] refactor(telemetry): drop dotted ledger hash; share peer validation attrs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The peer.validation.receive span recorded the ledger hash under the dotted xrpl.ledger.hash form — the only dotted span attribute, and inconsistent with the bare ledger_hash the consensus validation spans use for the same value. Make the base SpanNames.h ledgerHash bare (ledger_hash) and add the shared fullValidation key, so the peer and consensus validation spans share one key per concept (told apart by span name, not an emitter prefix). PeerSpanNames now re-exports both from the base; the peer validation_full key folds into the shared full_validation. The peer trust attrs (proposal_trusted / validation_trusted) already follow the convention and are unchanged. --- include/xrpl/telemetry/SpanNames.h | 8 +++++++- src/xrpld/overlay/detail/PeerImp.cpp | 2 +- src/xrpld/overlay/detail/PeerSpanNames.h | 8 +++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/xrpl/telemetry/SpanNames.h b/include/xrpl/telemetry/SpanNames.h index 951947ac34..732bc0c41c 100644 --- a/include/xrpl/telemetry/SpanNames.h +++ b/include/xrpl/telemetry/SpanNames.h @@ -125,7 +125,13 @@ inline constexpr auto ledgerSeq = makeStr("ledger_seq"); inline constexpr auto closeTime = makeStr("close_time"); inline constexpr auto closeTimeCorrect = makeStr("close_time_correct"); inline constexpr auto closeResolutionMs = makeStr("close_resolution_ms"); -inline constexpr auto ledgerHash = join(join(seg::xrpl, seg::ledger), makeStr("hash")); +/// Shared validation attrs — reused by the consensus and peer validation +/// spans. Same concept, same key on every span; the span name tells them +/// apart, so neither is emitter-prefixed. `ledgerHash` is a ledger-object +/// property (bare, like ledgerSeq); `fullValidation` is the is-full-validation +/// flag. Never the dotted xrpl. form (reserved for resource attrs). +inline constexpr auto ledgerHash = makeStr("ledger_hash"); +inline constexpr auto fullValidation = makeStr("full_validation"); } // namespace attr // ===== Shared attribute values ============================================= diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 18372f3557..e58e97ea65 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -2413,7 +2413,7 @@ PeerImp::onMessage(std::shared_ptr const& m) val->setSeen(closeTime); } valSpan.setAttribute(peer_span::attr::ledgerHash, to_string(val->getLedgerHash()).c_str()); - valSpan.setAttribute(peer_span::attr::validationFull, val->isFull()); + valSpan.setAttribute(peer_span::attr::fullValidation, val->isFull()); if (!isCurrent( app_.getValidations().parms(), diff --git a/src/xrpld/overlay/detail/PeerSpanNames.h b/src/xrpld/overlay/detail/PeerSpanNames.h index fd2081f778..3e6530c486 100644 --- a/src/xrpld/overlay/detail/PeerSpanNames.h +++ b/src/xrpld/overlay/detail/PeerSpanNames.h @@ -25,13 +25,15 @@ inline constexpr auto validationReceive = makeStr("validation.receive"); // ===== Attribute keys ======================================================== namespace attr { -/// Canonical shared constants (defined in SpanNames.h). +/// Canonical shared constants (defined in SpanNames.h). `ledgerHash` and +/// `fullValidation` are shared with the consensus validation spans — same +/// concept, same key, told apart by span name. +using ::xrpl::telemetry::attr::fullValidation; using ::xrpl::telemetry::attr::ledgerHash; using ::xrpl::telemetry::attr::peerId; -/// Domain-owned bare attrs. +/// Trust flag qualified by message type, shared with consensus.*.receive. inline constexpr auto proposalTrusted = makeStr("proposal_trusted"); -inline constexpr auto validationFull = makeStr("validation_full"); inline constexpr auto validationTrusted = makeStr("validation_trusted"); } // namespace attr