fix(telemetry): phase-6 peer.proposal/validation.receive use ScopedSpanGuard::freshRoot

These peer-level entry spans (introduced on phase-6) used the removed
SpanGuard::rootSpan(). They are scoped on the peer thread and end there, so
use ScopedSpanGuard::freshRoot() — a scoped fresh trace root that does not
inherit any span left active on the peer thread.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-07-22 10:56:47 +01:00
parent 6c21cc4af5
commit 9725f5b48f

View File

@@ -1758,7 +1758,8 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProposeSet> const& m)
using namespace telemetry;
// root: inbound peer message entry point (kConsumer); must not inherit
// any span left active on this peer thread.
auto span = SpanGuard::rootSpan(TraceCategory::Peer, seg::peer, peer_span::op::proposalReceive);
auto span =
ScopedSpanGuard::freshRoot(TraceCategory::Peer, seg::peer, peer_span::op::proposalReceive);
span.setAttribute(peer_span::attr::peerId, static_cast<int64_t>(id_));
protocol::TMProposeSet const& set = *m;
@@ -2381,8 +2382,8 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
using namespace telemetry;
// root: inbound peer message entry point (kConsumer); must not inherit
// any span left active on this peer thread.
auto valSpan =
SpanGuard::rootSpan(TraceCategory::Peer, seg::peer, peer_span::op::validationReceive);
auto valSpan = ScopedSpanGuard::freshRoot(
TraceCategory::Peer, seg::peer, peer_span::op::validationReceive);
valSpan.setAttribute(peer_span::attr::peerId, static_cast<int64_t>(id_));
if (m->validation().size() < 50)