Skip to content

Gate W3C trace support to request phases with ngx.var access#345

Open
mtrop-godaddy wants to merge 1 commit into
ledgetech:masterfrom
mtrop-godaddy:fix/traceparent-otel-gating
Open

Gate W3C trace support to request phases with ngx.var access#345
mtrop-godaddy wants to merge 1 commit into
ledgetech:masterfrom
mtrop-godaddy:fix/traceparent-otel-gating

Conversation

@mtrop-godaddy

Copy link
Copy Markdown

The http library reads ngx.var.http_traceparent in send_request to propagate W3C trace context. ngx.var is only readable in request-bearing phases, so this crashes code running in init/init_worker.

Gate the read on ngx.get_phase() being in a request-bearing phase via a whitelist, so request-less phases (init, init_worker, timer, etc.) are excluded by default. Behavior is unchanged for real requests.

The http library reads ngx.var.http_traceparent in send_request to
propagate W3C trace context. ngx.var is only readable in request-bearing
phases, so this crashes code running in init/init_worker.

Gate the read on ngx.get_phase() being in a request-bearing phase via a
whitelist, so request-less phases (init, init_worker, timer, etc.) are
excluded by default. Behavior is unchanged for real requests.
@mtrop-godaddy mtrop-godaddy force-pushed the fix/traceparent-otel-gating branch from 5217ac3 to 9eff4ce Compare June 11, 2026 11:29
@mtrop-godaddy mtrop-godaddy marked this pull request as ready for review June 11, 2026 11:33
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