Skip to content

[STO-928] Return X-Trace-ID on every response and pin the OTel module - #29

Merged
Spence1115 merged 1 commit into
masterfrom
Spence1115/sto-928-trace-id-always
Oct 12, 2026
Merged

Spence1115 merged 1 commit into
masterfrom
Spence1115/sto-928-trace-id-always

Conversation

@Spence1115

Copy link
Copy Markdown
Contributor

Responses from apps behind the proxy only carried X-Trace-ID on 2xx/3xx success codes, so a failed request, or an async one answered with 202, gave you no trace ID to look up. Those are the requests we most need to follow into Grafana and Sentry.

Summary

add_header without always only applies to 200, 201, 204, 206, 301, 302, 303, 304, 307 and 308. Seen on data-stories production: GET /web_api/stories/:id (200) returned x-trace-id, but POST /web_api/stories/customer_async (202) didn't, although nginx traced that request. Adding always puts the header on every response.

The Dockerfile change unblocks the release. Rebuilding master today produces an image that won't start: [emerg] module "ngx_http_headers_more_filter_module.so" version 1031003 instead of 1031006, the same failure #26 hit. nginx-module-otel was installed unpinned from nginx's mainline apt repo. Its newest build depends on nginx-r1.31.6, which upgrades nginx past the 1.31.3 source the headers-more module is compiled against. The published 1.31.3 image predates the 1.31.6 packages, so it's unaffected. CI only builds the image, so it doesn't catch this. Pinning the module to the base image's NGINX_VERSION keeps nginx, the OTel module and headers-more on one version, and future base-image upgrades move all three together.

Details

Checked locally with a test app.conf proxying to return 200/202/404/500 locations:

Image nginx 200 202 404 500
master, rebuilt today 1.31.6 (module mismatch) fails to start
master built against the 1.31.6 source 1.31.6 header missing missing missing
this branch 1.31.3 header header header header

The X-Proxy-* latency headers have the same success-only limitation. I've left them as they are, since nobody has needed them on errors.

To roll out: tag 1.31.3-1, then bump zappi/nginx-proxy:1.31.3 in shipyard (pkg/configpack/manifest_component.go), which pins the sidecar for every app.

https://linear.app/zappi/issue/STO-928

add_header without 'always' only applies to 200, 201, 204, 206 and 3xx
responses, so 202s and every error response went out without a trace ID.

nginx-module-otel was installed unpinned from the nginx mainline repo. Its
latest build depends on nginx 1.31.6, which upgraded nginx past the 1.31.3
source the headers-more module is compiled against, so a fresh build of
master fails to start.
@Spence1115
Spence1115 marked this pull request as ready for review October 9, 2026 18:09
@Spence1115
Spence1115 requested a review from a team as a code owner October 9, 2026 18:09
@Spence1115
Spence1115 merged commit 0a2b6c4 into master Oct 12, 2026
2 checks passed
@Spence1115
Spence1115 deleted the Spence1115/sto-928-trace-id-always branch October 12, 2026 09:31
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.

2 participants