Skip to content

[#16670] dist-trace: propagate trace context over the PG<->tserver shared memory exchange - #17

Open
ellabaron-code wants to merge 1 commit into
dist-trace-05-task-scope-carryfrom
dist-trace-06-shmem-propagation
Open

[#16670] dist-trace: propagate trace context over the PG<->tserver shared memory exchange#17
ellabaron-code wants to merge 1 commit into
dist-trace-05-task-scope-carryfrom
dist-trace-06-shmem-propagation

Conversation

@ellabaron-code

Copy link
Copy Markdown

Carry the distributed-trace parent across the shared-memory Perform /
AcquireObjectLock fast path, mirroring what the RPC header path already
does. The read-side codec (rpc::ToSpanContext) shipped earlier; this adds
the write side and wires both ends of the exchange.

  • ash/rpc_wait_state: TraceContextSerializer encodes the active span's
    SpanContext as a standalone length-prefixed TraceContextPB blob (always
    emits the length prefix, zero when unset, so the framing stays
    parseable). Big-endian layout matches what rpc::ToSpanContext reads back.
  • pggate/pg_client (PrepareAndSend): start the outbound shared-memory span,
    serialize the trace_context blob into the exchange buffer after the ASH
    metadata, size the obtain accordingly, and end the span on the early-exit
    path so it is not leaked.
  • tserver/pg_client_session: parse the trace_context blob out of the
    exchange, and when present start a server span (StartServerSpanWithScope)
    as a child of the propagated context, with rpc.system=inbound_shmem and
    matching service/method attributes; set Ok/Error status around the
    handler.

@ellabaron-code

Copy link
Copy Markdown
Author

Misfiled: reopening against yugabyte/yugabyte-db.

@ellabaron-code
ellabaron-code force-pushed the dist-trace-06-shmem-propagation branch from 7090413 to bc5dd86 Compare July 11, 2026 02:15
@ellabaron-code
ellabaron-code force-pushed the dist-trace-05-task-scope-carry branch from 7ae5483 to 43f7c29 Compare July 11, 2026 02:15
@ellabaron-code ellabaron-code changed the title dist-trace: propagate trace context over the PG<->tserver shared memory exchange [#16670] dist-trace: propagate trace context over the PG<->tserver shared memory exchange Jul 11, 2026
@ellabaron-code
ellabaron-code force-pushed the dist-trace-05-task-scope-carry branch from 43f7c29 to 05cb556 Compare July 13, 2026 15:13
@ellabaron-code
ellabaron-code force-pushed the dist-trace-06-shmem-propagation branch from bc5dd86 to d684020 Compare July 13, 2026 15:14
@ellabaron-code
ellabaron-code force-pushed the dist-trace-05-task-scope-carry branch from 05cb556 to 45dee2c Compare July 13, 2026 16:12
@ellabaron-code
ellabaron-code force-pushed the dist-trace-06-shmem-propagation branch from d684020 to 17de952 Compare July 13, 2026 16:12
…ry exchange

Carry the distributed-trace parent across the shared-memory Perform /
AcquireObjectLock fast path, mirroring what the RPC header path already
does. The read-side codec (rpc::ToSpanContext) shipped earlier; this adds
the write side and wires both ends of the exchange.

- ash/rpc_wait_state: TraceContextSerializer encodes the active span's
  SpanContext as a standalone length-prefixed TraceContextPB blob (always
  emits the length prefix, zero when unset, so the framing stays
  parseable). Big-endian layout matches what rpc::ToSpanContext reads back.
- pggate/pg_client (PrepareAndSend): start the outbound shared-memory span,
  serialize the trace_context blob into the exchange buffer after the ASH
  metadata, size the obtain accordingly, and end the span on the early-exit
  path so it is not leaked.
- tserver/pg_client_session: parse the trace_context blob out of the
  exchange, and when present start a server span (StartServerSpanWithScope)
  as a child of the propagated context, with rpc.system=inbound_shmem and
  matching service/method attributes; set Ok/Error status around the
  handler.
@ellabaron-code
ellabaron-code force-pushed the dist-trace-05-task-scope-carry branch from 45dee2c to 9830d01 Compare July 13, 2026 22:25
@ellabaron-code
ellabaron-code force-pushed the dist-trace-06-shmem-propagation branch from 17de952 to 54c48c6 Compare July 13, 2026 22:25
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