mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-27 07:26:51 +00:00
Span kind was derived from TraceCategory alone, so every Rpc-category span was kServer. A category cannot tell an inbound handler from the internal work under it, and trace backends pair kServer with kClient, so internal spans left as kServer become unpaired edges in a service graph and read as extra inbound requests. SpanRole is a new xrpl-owned enum, orthogonal to TraceCategory: the category names the subsystem and gates the span on config, the role says whether the span handles a remote call. It is a defaulted fourth parameter on span(), freshRoot() and the ScopedSpanGuard equivalents, defaulting to SpanRole::FromCategory, so no existing call site changes. resolveSpanKind() applies an explicit role and falls back to the category map, which keeps its single responsibility. The telemetry-disabled stubs mirror all four signatures. No call site passes a role yet. The two that need it are on a later branch. Also fixes a ScopedSpanGuard example that passed a bare op:: suffix to childSpan(), which takes the name verbatim. Naming the child rpc.command made it a child of rpc.command.<cmd>, inverting the hierarchy, so the example's parent is now rpc.process and the command attribute moved onto the command span.