mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 00:36:48 +00:00
fix: address PR review round 2 — event name constants, span timing
- Add cons_span::event namespace with disputeResolve and txIncluded constants; replace hardcoded strings in Consensus.h and RCLConsensus.cpp - Move proposal.receive and validation.receive spans in PeerImp into shared_ptr captured by job lambdas so they measure checkPropose and checkValidation timing, not just message parsing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -223,6 +223,15 @@ inline constexpr auto disputesCount = join(xrplConsensus, makeStr("disputes_coun
|
||||
inline constexpr auto trusted = join(xrplConsensus, makeStr("trusted"));
|
||||
} // namespace attr
|
||||
|
||||
// ===== Event names ===========================================================
|
||||
|
||||
namespace event {
|
||||
/// "dispute.resolve"
|
||||
inline constexpr auto disputeResolve = join(makeStr("dispute"), makeStr("resolve"));
|
||||
/// "tx.included"
|
||||
inline constexpr auto txIncluded = join(makeStr("tx"), makeStr("included"));
|
||||
} // namespace event
|
||||
|
||||
// ===== Attribute values ======================================================
|
||||
|
||||
namespace val {
|
||||
|
||||
@@ -612,7 +612,9 @@ RCLConsensus::Adaptor::doAccept(
|
||||
JLOG(j_.debug()) << " Tx: " << item.key();
|
||||
++txCount;
|
||||
auto const txHash = to_string(item.key());
|
||||
doAcceptSpan.addEvent("tx.included", {{telemetry::cons_span::attr::txId, txHash}});
|
||||
doAcceptSpan.addEvent(
|
||||
telemetry::cons_span::event::txIncluded,
|
||||
{{telemetry::cons_span::attr::txId, txHash}});
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
|
||||
@@ -1557,7 +1557,7 @@ Consensus<Adaptor>::updateOurPositions(std::unique_ptr<std::stringstream> const&
|
||||
auto const yaysStr = std::to_string(dispute.getYays());
|
||||
auto const naysStr = std::to_string(dispute.getNays());
|
||||
span.addEvent(
|
||||
"dispute.resolve",
|
||||
cons_span::event::disputeResolve,
|
||||
{{cons_span::attr::txId, to_string(txId)},
|
||||
{cons_span::attr::disputeOurVote, dispute.getOurVote() ? "yes" : "no"},
|
||||
{cons_span::attr::disputeYays, yaysStr},
|
||||
|
||||
@@ -1946,13 +1946,6 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProposeSet> const& m)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
using namespace telemetry;
|
||||
auto span = SpanGuard::span(
|
||||
TraceCategory::Consensus, seg::consensus, cons_span::op::proposalReceive);
|
||||
span.setAttribute(cons_span::attr::trusted, isTrusted);
|
||||
}
|
||||
|
||||
JLOG(p_journal_.trace()) << "Proposal: " << (isTrusted ? "trusted" : "untrusted");
|
||||
|
||||
auto proposal = RCLCxPeerPos(
|
||||
@@ -1970,8 +1963,8 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProposeSet> const& m)
|
||||
// Create a receive span that links to the sender's trace context
|
||||
// (if propagated). shared_ptr keeps it alive across the job boundary.
|
||||
auto span = std::make_shared<telemetry::SpanGuard>(telemetry::proposalReceiveSpan(set));
|
||||
span->setAttribute("xrpl.consensus.trusted", isTrusted);
|
||||
span->setAttribute("xrpl.consensus.round", static_cast<int64_t>(set.proposeseq()));
|
||||
span->setAttribute(telemetry::cons_span::attr::trusted, isTrusted);
|
||||
span->setAttribute(telemetry::cons_span::attr::round, static_cast<int64_t>(set.proposeseq()));
|
||||
|
||||
std::weak_ptr<PeerImp> const weak = shared_from_this();
|
||||
app_.getJobQueue().addJob(
|
||||
|
||||
Reference in New Issue
Block a user