Merge branch 'pratik/otel-phase7-native-metrics' into pratik/otel-phase8-log-correlation

This commit is contained in:
Pratik Mankawde
2026-06-11 23:18:36 +01:00
13 changed files with 323 additions and 82 deletions

View File

@@ -34,7 +34,7 @@
* | attrs: queue_size, ledger_changed |
* | |
* | +--------------------------------------------------+ |
* | | txq.accept.tx (per queued transaction) | |
* | | txq.accept_tx (per queued transaction) | |
* | | attrs: tx_hash, ter_code, retries_remaining | |
* | +--------------------------------------------------+ |
* +-------------------------------------------------------+

View File

@@ -1856,7 +1856,7 @@ Consensus<Adaptor>::haveConsensus(std::unique_ptr<std::stringstream> const& clog
consensus::span::attr::proposersFinished, static_cast<int64_t>(currentFinished));
span.setAttribute(consensus::span::attr::consensusStalled, stalled);
span.setAttribute(
consensus::span::attr::establishCounter, static_cast<int64_t>(establishCounter_));
consensus::span::attr::establishCount, static_cast<int64_t>(establishCounter_));
std::string_view stateStr = consensus::span::val::no;
if (result_->state == ConsensusState::Yes)

View File

@@ -125,10 +125,14 @@ inline constexpr auto phaseOpen = join(seg::consensus, op::phaseOpen);
// ===== 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 peer.validation.receive span — same
/// concept, same key, distinguished by span name (not an emitter prefix).
using ::xrpl::telemetry::attr::closeResolutionMs;
using ::xrpl::telemetry::attr::closeTime;
using ::xrpl::telemetry::attr::closeTimeCorrect;
using ::xrpl::telemetry::attr::fullValidation;
using ::xrpl::telemetry::attr::ledgerHash;
using ::xrpl::telemetry::attr::ledgerSeq;
/// Domain-qualified attrs (rule 5 — bare name ambiguous across domains).
@@ -159,11 +163,10 @@ inline constexpr auto peerPositionsAtClose = makeStr("peer_positions_at_close");
inline constexpr auto txCountOpen = makeStr("tx_count_open");
/// Establish/check additional state.
inline constexpr auto proposersFinished = makeStr("proposers_finished");
inline constexpr auto establishCounter = makeStr("establish_counter");
/// Accept/apply enrichment.
inline constexpr auto disputesResolvedCount = makeStr("disputes_resolved_count");
/// Validation send/receive enrichment.
inline constexpr auto fullValidation = makeStr("full_validation");
/// Validation send/receive enrichment. (`full_validation` is shared — see the
/// `using` re-export above.)
inline constexpr auto validationSignTime = makeStr("validation_sign_time");
/// Receive-side hash prefixes for cross-peer correlation.
inline constexpr auto prevLedgerPrefix = makeStr("prev_ledger_prefix");
@@ -191,8 +194,6 @@ inline constexpr auto modeNew = makeStr("mode_new");
/// "is_bow_out" — whether this proposal is a bow-out (resigning from round).
inline constexpr auto isBowOut = makeStr("is_bow_out");
/// "ledger_hash" — full hash of the ledger being validated/accepted.
inline constexpr auto ledgerHash = makeStr("ledger_hash");
/// Transaction/dispute attrs used in consensus accept spans.
inline constexpr auto txId = makeStr("tx_id");
@@ -201,7 +202,12 @@ inline constexpr auto disputeYays = makeStr("dispute_yays");
inline constexpr auto disputeNays = makeStr("dispute_nays");
inline constexpr auto txCount = makeStr("tx_count");
inline constexpr auto disputesCount = makeStr("disputes_count");
inline constexpr auto trusted = makeStr("trusted");
/// Trust flag (is the message origin a trusted UNL validator). Qualified by
/// message type, shared with the peer.{proposal,validation}.receive spans:
/// consensus.proposal.receive uses `proposal_trusted`, consensus.validation.
/// receive uses `validation_trusted`. Same concept on both emitters → same key.
inline constexpr auto proposalTrusted = makeStr("proposal_trusted");
inline constexpr auto validationTrusted = makeStr("validation_trusted");
} // namespace attr
// ===== Event names ===========================================================

View File

@@ -1869,7 +1869,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProposeSet> const& m)
calcNodeID(app_.getValidatorManifests().getMasterKey(publicKey))});
auto consSpan = std::make_shared<telemetry::SpanGuard>(telemetry::proposalReceiveSpan(set));
consSpan->setAttribute(telemetry::consensus::span::attr::trusted, isTrusted);
consSpan->setAttribute(telemetry::consensus::span::attr::proposalTrusted, isTrusted);
consSpan->setAttribute(
telemetry::consensus::span::attr::round, static_cast<int64_t>(set.proposeseq()));
// First 16 hex chars (8 bytes) of each hash — enough to disambiguate
@@ -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(),
@@ -2470,7 +2470,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
auto consSpan =
std::make_shared<telemetry::SpanGuard>(telemetry::validationReceiveSpan(*m));
consSpan->setAttribute(telemetry::consensus::span::attr::trusted, isTrusted);
consSpan->setAttribute(telemetry::consensus::span::attr::validationTrusted, isTrusted);
if (val->isFieldPresent(sfLedgerSequence))
{
consSpan->setAttribute(

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