Skip to content

fix(core): Normalize http header attribute keys according to OTel spec - #24222

Merged
Lms24 merged 2 commits into
developfrom
lms/fix-core-http-header-normalization
Sep 10, 2026
Merged

fix(core): Normalize http header attribute keys according to OTel spec#24222
Lms24 merged 2 commits into
developfrom
lms/fix-core-http-header-normalization

Conversation

@Lms24

@Lms24 Lms24 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Previously, our httpHeadersToSpanAttributes helper, which we use to create http.(request|response).header.<key> attributes, normalized header names by 1. lower-casing them and 2. converting dashes in header names to underscores. The intention of this was to follow attribute key naming conventions. However, in this case, OTel diverges from the strict naming rules, in favour of leaving header names in a well-known form.

This PR removes the dash -> underscore conversion, while leaving the lower-casing as-is.

Example:
Previously: http.request.header.user_agent
Now: http.request.header.user-agent

Importantly, keys with an underscore in the original header are left as-is.

closes https://linear.app/getsentry/issue/ENG-8467/sdks-need-to-send-the-correct-header-httprequestheaderuser-agent

@Lms24 Lms24 self-assigned this Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.91 kB - -
@sentry/browser - with treeshaking flags 27.21 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.1 kB - -
@sentry/browser (incl. Tracing) 50.27 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 50.28 kB - -
@sentry/browser (incl. Tracing, Profiling) 53.26 kB - -
@sentry/browser (incl. Tracing, Replay) 89.76 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 78.86 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 94.45 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 107.46 kB - -
@sentry/browser (incl. Feedback) 46.4 kB - -
@sentry/browser (incl. sendFeedback) 33.96 kB - -
@sentry/browser (incl. FeedbackAsync) 39.07 kB - -
@sentry/browser (incl. Metrics) 29.93 kB - -
@sentry/browser (incl. Logs) 30.19 kB - -
@sentry/browser (incl. Metrics & Logs) 30.86 kB - -
@sentry/react 30.66 kB - -
@sentry/react (incl. Tracing) 52.59 kB - -
@sentry/vue 36.15 kB - -
@sentry/vue (incl. Tracing) 52.53 kB - -
@sentry/svelte 28.93 kB - -
CDN Bundle 30.64 kB - -
CDN Bundle (incl. Tracing) 50.78 kB - -
CDN Bundle (incl. Logs, Metrics) 32.92 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 52.73 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.61 kB - -
CDN Bundle (incl. Tracing, Replay) 88.32 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 90.29 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 94.36 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 96.38 kB - -
CDN Bundle - uncompressed 90.72 kB - -
CDN Bundle (incl. Tracing) - uncompressed 151.68 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.3 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 157.64 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.71 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 271.25 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 277.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 284.95 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 290.89 kB - -
@sentry/nextjs (client) 54.91 kB - -
@sentry/sveltekit (client) 50.69 kB - -
@sentry/core/server 37.08 kB -0.05% -18 B 🔽
@sentry/core/browser 13.66 kB - -
@sentry/node 128.42 kB -0.02% -15 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.82 kB - -
@sentry/node - without tracing 89.02 kB +0.02% +10 B 🔺
@sentry/node - without channel injection 107.53 kB +0.01% +10 B 🔺
@sentry/aws-serverless 97.41 kB -0.01% -4 B 🔽
@sentry/cloudflare (withSentry) - minified 203.01 kB -0.05% -88 B 🔽
@sentry/cloudflare (withSentry) 505.44 kB -0.05% -221 B 🔽

View base workflow run

@linear-code

linear-code Bot commented Sep 9, 2026

Copy link
Copy Markdown

ENG-8467

@Lms24
Lms24 marked this pull request as ready for review September 9, 2026 08:56
@Lms24
Lms24 requested review from a team as code owners September 9, 2026 08:56
@Lms24
Lms24 requested review from JPeer264, mydea, nicohrubec and s1gr1d and removed request for a team September 9, 2026 08:56
@Lms24
Lms24 force-pushed the lms/fix-core-http-header-normalization branch from b8ba890 to 165ea84 Compare September 9, 2026 09:37
@Lms24
Lms24 added this pull request to stack #24232 September 9, 2026 09:58

@s1gr1d s1gr1d left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also update the policy here just to mention that explicitly named keys are kept like they are: https://github.com/getsentry/sentry-conventions/blob/main/CONTRIBUTING.md#policies

@Lms24

Lms24 commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Conventions update: getsentry/sentry-conventions#632

@Lms24
Lms24 force-pushed the lms/fix-core-http-header-normalization branch from 165ea84 to 13df712 Compare September 10, 2026 10:37
Lms24 and others added 2 commits September 10, 2026 13:07
…tatic

The static-lifecycle copy of the TanStack Start React app was branched off
before #24089 started sanitizing inline literals out of `db.query.text`, so
its mysql expectation still asserted the raw `SELECT 1 + 1 AS solution`. The
job has been red on `develop` since the copy landed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/fix-core-http-header-normalization branch from 13df712 to d516d40 Compare September 10, 2026 11:07
@Lms24
Lms24 merged commit 3eeea0e into develop Sep 10, 2026
611 of 617 checks passed
@Lms24
Lms24 deleted the lms/fix-core-http-header-normalization branch September 10, 2026 13:15
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.

3 participants