Skip to content

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

Open
Lms24 wants to merge 1 commit into
developfrom
lms/fix-core-http-header-normalization
Open

fix(core): Normalize http header attribute keys according to OTel spec#24222
Lms24 wants to merge 1 commit 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.81 kB - -
@sentry/browser - with treeshaking flags 27.12 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.01 kB - -
@sentry/browser (incl. Tracing) 49.22 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 49.22 kB - -
@sentry/browser (incl. Tracing, Profiling) 52.15 kB - -
@sentry/browser (incl. Tracing, Replay) 88.76 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.94 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.44 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106.38 kB - -
@sentry/browser (incl. Feedback) 46.3 kB - -
@sentry/browser (incl. sendFeedback) 33.87 kB - -
@sentry/browser (incl. FeedbackAsync) 38.99 kB - -
@sentry/browser (incl. Metrics) 29.84 kB - -
@sentry/browser (incl. Logs) 30.1 kB - -
@sentry/browser (incl. Metrics & Logs) 30.78 kB - -
@sentry/react 30.57 kB - -
@sentry/react (incl. Tracing) 51.57 kB - -
@sentry/vue 36.07 kB - -
@sentry/vue (incl. Tracing) 51.49 kB - -
@sentry/svelte 28.85 kB - -
CDN Bundle 30.56 kB - -
CDN Bundle (incl. Tracing) 49.76 kB - -
CDN Bundle (incl. Logs, Metrics) 32.83 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.7 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.48 kB - -
CDN Bundle (incl. Tracing, Replay) 87.28 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 93.21 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.22 kB - -
CDN Bundle - uncompressed 90.47 kB - -
CDN Bundle (incl. Tracing) - uncompressed 148.17 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.04 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 154.13 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.3 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.76 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.71 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.46 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 287.4 kB - -
@sentry/nextjs (client) 54.03 kB - -
@sentry/sveltekit (client) 49.68 kB - -
@sentry/core/server 36.97 kB -0.05% -18 B 🔽
@sentry/core/browser 13.55 kB - -
@sentry/node 127.84 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.61 kB - -
@sentry/node - without tracing 88.71 kB -0.01% -3 B 🔽
@sentry/node - without channel injection 107.07 kB -0.02% -16 B 🔽
@sentry/aws-serverless 97.11 kB +0.02% +10 B 🔺
@sentry/cloudflare (withSentry) - minified 201.89 kB -0.05% -88 B 🔽
@sentry/cloudflare (withSentry) 502.46 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

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