From 737bd7211e08c73800854fc0f7f928e72e183e29 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 22 Jul 2026 22:21:08 +0100 Subject: [PATCH] feat(telemetry): correlate consensus doAccept logs via non-owning span activation Activate the accept span as ambient context at the top of doAccept using the non-owning ScopedActivation, so doAccept's log lines (and any spans created in the body) carry the accept span's trace_id. doAccept runs to completion on the JtAccept worker with no coroutine yield, so the activation is thread-local and safe; the acceptSpan still owns and ends the span. The accept.apply child span keeps its explicit childSpan(acceptApply, acceptSpanContext_) parentage -- activation only adds log correlation and does not alter parent linkage. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/xrpld/app/consensus/RCLConsensus.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index b10e709b67..30b3e4db32 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -556,6 +556,13 @@ RCLConsensus::Adaptor::doAccept( { namespace cs = telemetry::consensus::span; + // Make the accept span ambient for the whole accept so doAccept's log lines + // (and any spans created here) correlate to it. Non-owning: acceptSpan still + // owns/ends the span. doAccept runs to completion on the JtAccept worker + // (no coroutine yield), so this scope is thread-local and safe. + auto acceptActivation = + (acceptSpan && *acceptSpan) ? acceptSpan->activate() : telemetry::ScopedActivation{}; + prevProposers_ = result.proposers; prevRoundTime_ = result.roundTime.read();