Skip to content

[#16670] dist-trace: propagate traceparent to the PG backend via the startup packet - #19

Open
ellabaron-code wants to merge 1 commit into
dist-trace-07-server-initfrom
dist-trace-08-startup-packet
Open

[#16670] dist-trace: propagate traceparent to the PG backend via the startup packet#19
ellabaron-code wants to merge 1 commit into
dist-trace-07-server-initfrom
dist-trace-08-startup-packet

Conversation

@ellabaron-code

Copy link
Copy Markdown

Carry a W3C traceparent from the tserver into the PG backend over the
connection startup packet, so the backend's init (and subsequent queries)
root under the originating trace. The tserver-side connection already has
an active trace context; this threads it to the backend.

libpq client (fe-connect.c, fe-protocol3.c, libpq-int.h):

  • new yb_dist_traceparent conninfo option on pg_conn, freed with the conn,
    emitted as a startup-packet option when set.

libpq_utils (.cc/.h):

  • PGConnSettings gains a traceparent field; BuildConnectionString appends
    yb_dist_traceparent; internal connections populate it from
    dist_trace::GetActiveTraceparent().

backend (postmaster.c, postinit.c, libpq-be.h):

  • postmaster parses the yb_dist_traceparent startup param into
    Port::yb_dist_traceparent;
  • InitPostgres turns it into the pre-existing yb_dist_tracecontext GUC
    (traceparent='...') so backend init activates that root span.

@ellabaron-code

Copy link
Copy Markdown
Author

Misfiled: reopening against yugabyte/yugabyte-db.

@ellabaron-code
ellabaron-code force-pushed the dist-trace-07-server-init branch from fbd44a0 to d24a28c Compare July 11, 2026 02:15
@ellabaron-code
ellabaron-code force-pushed the dist-trace-08-startup-packet branch from a2f5f67 to aad023c Compare July 11, 2026 02:15
@ellabaron-code ellabaron-code changed the title dist-trace: propagate traceparent to the PG backend via the startup packet [#16670] dist-trace: propagate traceparent to the PG backend via the startup packet Jul 11, 2026
@ellabaron-code
ellabaron-code force-pushed the dist-trace-07-server-init branch from d24a28c to ffc1420 Compare July 13, 2026 15:14
@ellabaron-code
ellabaron-code force-pushed the dist-trace-08-startup-packet branch from aad023c to 46519a8 Compare July 13, 2026 15:14
@ellabaron-code
ellabaron-code force-pushed the dist-trace-07-server-init branch from ffc1420 to 0a4d830 Compare July 13, 2026 16:12
@ellabaron-code
ellabaron-code force-pushed the dist-trace-08-startup-packet branch from 46519a8 to e2d1727 Compare July 13, 2026 16:12
…acket

Carry a W3C traceparent from the tserver into the PG backend over the
connection startup packet, so the backend's init (and subsequent queries)
root under the originating trace. The tserver-side connection already has
an active trace context; this threads it to the backend.

libpq client (fe-connect.c, fe-protocol3.c, libpq-int.h):
- new yb_dist_traceparent conninfo option on pg_conn, freed with the conn,
  emitted as a startup-packet option when set.

libpq_utils (.cc/.h):
- PGConnSettings gains a traceparent field; BuildConnectionString appends
  yb_dist_traceparent; internal connections populate it from
  dist_trace::GetActiveTraceparent().

backend (postmaster.c, postinit.c, libpq-be.h):
- postmaster parses the yb_dist_traceparent startup param into
  Port::yb_dist_traceparent;
- InitPostgres turns it into the pre-existing yb_dist_tracecontext GUC
  (traceparent='...') so backend init activates that root span.
@ellabaron-code
ellabaron-code force-pushed the dist-trace-08-startup-packet branch from e2d1727 to 7ebbd01 Compare July 13, 2026 22:25
@ellabaron-code
ellabaron-code force-pushed the dist-trace-07-server-init branch from 0a4d830 to 7d22120 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