Skip to content

[#16670] dist-trace: span/scope API and its direct callers#13

Open
ellabaron-code wants to merge 1 commit into
dist-trace-01-protofrom
dist-trace-02-distlib
Open

[#16670] dist-trace: span/scope API and its direct callers#13
ellabaron-code wants to merge 1 commit into
dist-trace-01-protofrom
dist-trace-02-distlib

Conversation

@ellabaron-code

Copy link
Copy Markdown

Rework the dist_trace library into the span+scope API the rest of the stack
builds on, and update every in-tree caller of the changed API in lockstep so the
tree keeps building:

  • SpanWithScope (a span bundled with an activated thread-local scope), plus
    Start{Client,Server}SpanWithScope and ActivateParentScope.
  • GetActiveSpanContext / GetActiveTraceparent for cross-boundary propagation.
  • InitDistTrace now takes a service name; CleanupDistTrace -> ShutdownDistTrace
    (mirrored in ybc_dist_trace and its pg_yb_utils.c caller).
  • Replace the RpcSpanAttrs pending-attr buffer with a plain string-pair vector
    drained internally by StartClientSpanWithScope; drop the now-unused public
    GetPendingRpcAttrPairs/ClearPendingRpcAttrs.

Callers updated:

  • outbound_call: client span via StartClientSpanWithScope, write trace_context
    into the RPC RequestHeader, restore the parent around the completion callback.
  • pg_client / pg_session: shared-memory client span and pending RPC attributes.
  • dist_trace-test: new InitDistTrace signature and ShutdownDistTrace rename.

The shared-memory trace_context propagation itself (PgClient::PrepareAndSend)
lands in a later PR.

@ellabaron-code

Copy link
Copy Markdown
Author

Misfiled: reopening against yugabyte/yugabyte-db.

@ellabaron-code
ellabaron-code force-pushed the dist-trace-02-distlib branch from bd290ce to 28f5f4f Compare July 11, 2026 02:15
@ellabaron-code ellabaron-code changed the title dist-trace: span/scope API and its direct callers [#16670] dist-trace: span/scope API and its direct callers Jul 11, 2026
@ellabaron-code
ellabaron-code force-pushed the dist-trace-02-distlib branch from 28f5f4f to 24f800a Compare July 13, 2026 15:13
Rework the dist_trace library into the span+scope API the rest of the stack
builds on, and update every in-tree caller of the changed API in lockstep so the
tree keeps building:

  - SpanWithScope (a span bundled with an activated thread-local scope), plus
    Start{Client,Server}SpanWithScope and ActivateParentScope.
  - GetActiveSpanContext / GetActiveTraceparent for cross-boundary propagation.
  - InitDistTrace now takes a service name; CleanupDistTrace -> ShutdownDistTrace
    (mirrored in ybc_dist_trace and its pg_yb_utils.c caller).
  - Replace the RpcSpanAttrs pending-attr buffer with a plain string-pair vector
    drained internally by StartClientSpanWithScope; drop the now-unused public
    GetPendingRpcAttrPairs/ClearPendingRpcAttrs.

Callers updated:
  - outbound_call: client span via StartClientSpanWithScope, write trace_context
    into the RPC RequestHeader, restore the parent around the completion callback.
  - pg_client / pg_session: shared-memory client span and pending RPC attributes.
  - dist_trace-test: new InitDistTrace signature and ShutdownDistTrace rename.

The shared-memory trace_context propagation itself (PgClient::PrepareAndSend)
lands in a later PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant