From dfd67b81249e8ea5e803e99561bb1b89057f9933 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:23:59 +0100 Subject: [PATCH] fix(telemetry): eliminate duplicate suppressed attribute on tx.receive span The OTel C++ SDK's SetAttribute appends rather than overwrites on in-flight spans. Setting suppressed=false as a default then overriding to true resulted in both values appearing in the exported span. Fix: remove the default-false set, place suppressed=false once after the HashRouter check passes (non-suppressed path), and suppressed=true remains only in the suppressed path. Co-Authored-By: Claude Opus 4.6 --- src/xrpld/overlay/detail/PeerImp.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 3e9c0a44dc..a1805db22c 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -1334,11 +1334,8 @@ PeerImp::handleTransaction( span->setAttribute(tx_span::attr::txType, fmt->getName().c_str()); if (auto const version = getVersion(); !version.empty()) span->setAttribute(tx_span::attr::peerVersion, version.c_str()); - // Set defaults for conditional attributes so they are always present - // on the span. The suppressed path overrides these when the - // transaction has already been seen via HashRouter. - span->setAttribute(tx_span::attr::suppressed, false); - span->setAttribute(tx_span::attr::txStatus, "new"); + // Note: suppressed and txStatus are set once at each exit path + // (not as defaults here) to avoid OTel SDK attribute duplication. // Charge strongly for attempting to relay a txn with tfInnerBatchTxn // LCOV_EXCL_START @@ -1403,6 +1400,7 @@ PeerImp::handleTransaction( return; } + span->setAttribute(tx_span::attr::suppressed, false); JLOG(pJournal_.debug()) << "Got tx " << txID; bool checkSignature = true;