fix(telemetry): scope ledger.build so tx.apply nests under it

ledger.build was left as unscoped SpanGuard after the type split, so tx.apply
(created synchronously during applyTxs on the same JtAccept worker) no longer
nested under it. buildLedgerImpl runs synchronously with no yield, so
ScopedSpanGuard is safe and restores the ledger.build -> tx.apply edge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-07-22 13:11:53 +01:00
parent 7bdc14eee5
commit beb5b2dddc

View File

@@ -50,7 +50,9 @@ buildLedgerImpl(
ApplyTxs&& applyTxs)
{
using namespace telemetry;
auto buildSpan = SpanGuard::span(TraceCategory::Ledger, seg::ledger, ledger_span::op::build);
// Scoped so tx.apply (created synchronously below during applyTxs on this
// thread) nests under it. buildLedgerImpl runs synchronously with no yield.
auto buildSpan = ScopedSpanGuard(TraceCategory::Ledger, seg::ledger, ledger_span::op::build);
auto built = std::make_shared<Ledger>(*parent, closeTime);