From b1f1e30450e8d088ba0957feab5a82f8728097bf Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 22 Jul 2026 13:10:21 +0100 Subject: [PATCH] fix(telemetry): scope pathfind.request/compute so children nest pathfind.request (PathFind.cpp) and pathfind.compute (PathRequest.cpp doUpdate) were left as unscoped SpanGuard after the type split, so pathfind.compute and pathfind.discover no longer nested under them. Both handlers run synchronously with no coroutine yield, so ScopedSpanGuard is safe and restores the request -> compute -> discover sub-tree. rpc.command.* stays unscoped (callMethod wraps doRipplePathFind which holds across a yield), so pathfind.request parents to rpc.process. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/xrpld/rpc/detail/PathRequest.cpp | 4 +++- src/xrpld/rpc/handlers/orderbook/PathFind.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xrpld/rpc/detail/PathRequest.cpp b/src/xrpld/rpc/detail/PathRequest.cpp index 4fb11ab10c..28a6ad3c5c 100644 --- a/src/xrpld/rpc/detail/PathRequest.cpp +++ b/src/xrpld/rpc/detail/PathRequest.cpp @@ -739,7 +739,9 @@ PathRequest::doUpdate( { using namespace std::chrono; using namespace telemetry; - auto span = SpanGuard::span( + // Scoped so pathfind.discover (created synchronously below via findPaths) + // nests under it. doUpdate does not yield, so scoping is safe. + auto span = ScopedSpanGuard( TraceCategory::Rpc, pathfind_span::prefix::pathfind, pathfind_span::op::compute); span.setAttribute(pathfind_span::attr::fast, fast); span.setAttribute(pathfind_span::attr::destCurrency, to_string(saDstAmount_.asset()).c_str()); diff --git a/src/xrpld/rpc/handlers/orderbook/PathFind.cpp b/src/xrpld/rpc/handlers/orderbook/PathFind.cpp index f04756be15..bf7fdfe264 100644 --- a/src/xrpld/rpc/handlers/orderbook/PathFind.cpp +++ b/src/xrpld/rpc/handlers/orderbook/PathFind.cpp @@ -19,7 +19,9 @@ json::Value doPathFind(RPC::JsonContext& context) { using namespace telemetry; - auto span = SpanGuard::span( + // Scoped so pathfind.compute/discover (created synchronously below on this + // thread) nest under it. doPathFind does not yield, so scoping is safe. + auto span = ScopedSpanGuard( TraceCategory::Rpc, pathfind_span::prefix::pathfind, pathfind_span::op::request); // Addresses are hashed before emission for privacy. if (auto const& src = context.params[jss::source_account]; src.isString())