refactor(telemetry): drop dotted ledger hash; share peer validation attrs

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.
This commit is contained in:
Pratik Mankawde
2026-06-11 23:11:23 +01:00
parent e97878c5d7
commit ae114c5341
3 changed files with 13 additions and 5 deletions

View File

@@ -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 =============================================

View File

@@ -2413,7 +2413,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> 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(),

View File

@@ -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