mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-23 15:10:34 +00:00
Add two free functions in xrpl::telemetry that wrap the required "detach a live SpanGuard held in a container" idiom so call sites write one line instead of the make_shared/emplace rebuild by hand: void detachInPlace(std::optional<SpanGuard>&); std::shared_ptr<SpanGuard> detachInPlace(std::shared_ptr<SpanGuard>); Both are no-ops on an empty/null/inactive guard. The #else branch adds matching inline no-op stubs so callers compile with telemetry disabled. Pure API addition, no behavior change; consumer call sites are rewritten on phase4 in a follow-up. The unit tests for these helpers land on phase2, where the telemetry test module (in-memory-exporter harness + SpanGuardScope.cpp) exists — mirroring how the detached()/rootSpan() tests were placed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>