Skip to content

Commit 3e703b8

Browse files
msonnbclaude
andcommitted
ref(core)!: Rename deprecated http.* span attributes
Part of the v11 migration away from attributes `@sentry/conventions` marks deprecated. This PR covers the renames on HTTP spans, all of them 1:1 with no behavior change. `http.target` and the Node body size behavior change follow in stacked PRs; the `net.*` attributes are migrated separately in #23301. `http.method` -> `http.request.method`, `http.status_code` -> `http.response.status_code`, `http.status_text` -> `http.response.status_text`, `http.scheme` -> `url.scheme`, `http.user_agent` -> `user_agent.original`, `http.request_content_length` -> `http.request.body.size`, `http.request_content_length_uncompressed` -> `http.request.body.decoded_size`, `http.response_content_length` -> `http.response.body.size`, `http.response_content_length_uncompressed` and `http.decoded_response_content_length` -> `http.response.body.decoded_size`, `http.response_transfer_size` -> `http.response.size`, and `url.same_origin` -> `http.request.same_origin`. The last two legacy response body size names meant the same thing — the decoded response body size. Node HTTP spans used `http.response_content_length_uncompressed`, browser resource spans used `http.decoded_response_content_length`. Which of the encoded and decoded attribute an HTTP span sets is unchanged here: the code still branches on whether a `content-encoding` header is present. That branching is what the stacked body size PR addresses. `http.host`, `http.flavor` and `http.client_ip` are dropped without a replacement being set here. Their replacements — `server.address`, `network.protocol.version` and `client.address` — are introduced by #23301, so setting them here too would mean two PRs writing the same keys with different values. `SanitizedRequestData`, the shape backing `http` breadcrumb data, now keys the method as `http.request.method`. Span attributes in the touched files are now imported from `@sentry/conventions/attributes` rather than written as string literals. That is what surfaced `url.same_origin` as deprecated; as a literal it was invisible. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 63119eb commit 3e703b8

108 files changed

Lines changed: 429 additions & 542 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ sentryTest('should update spans for GraphQL fetch requests', async ({ getLocalTe
4848
status: 'ok',
4949
data: expect.objectContaining({
5050
type: 'fetch',
51-
'http.method': 'POST',
51+
'http.request.method': 'POST',
5252
'url.full': 'http://sentry-test.io/foo',
5353
'server.address': 'sentry-test.io',
5454
'sentry.op': 'http.client',

‎dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-fetch/test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ sentryTest('should update spans for GraphQL persisted query fetch requests', asy
4242
status: 'ok',
4343
data: expect.objectContaining({
4444
type: 'fetch',
45-
'http.method': 'POST',
45+
'http.request.method': 'POST',
4646
'url.full': 'http://sentry-test.io/graphql',
4747
'server.address': 'sentry-test.io',
4848
'sentry.op': 'http.client',

‎dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-xhr/test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ sentryTest('should update spans for GraphQL persisted query XHR requests', async
4242
status: 'ok',
4343
data: {
4444
type: 'xhr',
45-
'http.method': 'POST',
45+
'http.request.method': 'POST',
4646
'url.full': 'http://sentry-test.io/graphql',
4747
'server.address': 'sentry-test.io',
4848
'sentry.op': 'http.client',

‎dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ sentryTest('should update spans for GraphQL XHR requests', async ({ getLocalTest
4848
status: 'ok',
4949
data: {
5050
type: 'xhr',
51-
'http.method': 'POST',
51+
'http.request.method': 'POST',
5252
'url.full': 'http://sentry-test.io/foo',
5353
'server.address': 'sentry-test.io',
5454
'sentry.op': 'http.client',

‎dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/attributes/init.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ window.Sentry = Sentry;
55
Sentry.init({
66
dsn: 'https://public@dsn.ingest.sentry.io/1337',
77
integrations: [Sentry.spanStreamingIntegration()],
8-
ignoreSpans: [{ attributes: { 'http.status_code': 200 } }],
8+
ignoreSpans: [{ attributes: { 'http.response.status_code': 200 } }],
99
tracesSampleRate: 1,
1010
debug: true,
1111
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// This segment span matches ignoreSpans via attributes — segment + child should be dropped
2-
Sentry.startSpan({ name: 'health-check', attributes: { 'http.status_code': 200 } }, () => {
2+
Sentry.startSpan({ name: 'health-check', attributes: { 'http.response.status_code': 200 } }, () => {
33
Sentry.startSpan({ name: 'child-of-ignored' }, () => {});
44
});
55

66
setTimeout(() => {
77
// This segment span does NOT match — segment + child should be sent
8-
Sentry.startSpan({ name: 'normal-segment', attributes: { 'http.status_code': 500 } }, () => {
8+
Sentry.startSpan({ name: 'normal-segment', attributes: { 'http.response.status_code': 500 } }, () => {
99
Sentry.startSpan({ name: 'child-span' }, () => {});
1010
});
1111
}, 1000);

‎dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
6868
// The init bundle script is served from the test origin: its description is origin-relative,
6969
// but `url.full` retains the full absolute URL (needed for span description inference).
7070
const sameOriginScriptSpan = scriptSpans?.find(({ description }) => description === '/init.bundle.js');
71-
expect(sameOriginScriptSpan?.data?.['url.same_origin']).toBe(true);
71+
expect(sameOriginScriptSpan?.data?.['http.request.same_origin']).toBe(true);
7272
expect(sameOriginScriptSpan?.data?.['url.full']).toMatch(/^https?:\/\/.+\/init\.bundle\.js$/);
7373

7474
const customScriptSpan = scriptSpans?.find(
@@ -77,9 +77,9 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
7777

7878
expect(imgSpan).toEqual({
7979
data: {
80-
'http.decoded_response_content_length': expect.any(Number),
81-
'http.response_content_length': expect.any(Number),
82-
'http.response_transfer_size': expect.any(Number),
80+
'http.response.body.decoded_size': expect.any(Number),
81+
'http.response.body.size': expect.any(Number),
82+
'http.response.size': expect.any(Number),
8383
'http.request.connect_start': expect.any(Number),
8484
'http.request.connection_end': expect.any(Number),
8585
'http.request.domain_lookup_end': expect.any(Number),
@@ -99,7 +99,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
9999
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics',
100100
'server.address': 'sentry-test-site.example',
101101
'url.domain': 'sentry-test-site.example',
102-
'url.same_origin': false,
102+
'http.request.same_origin': false,
103103
'url.scheme': 'https',
104104
'url.full': 'https://sentry-test-site.example/path/to/image.svg',
105105
...(!isWebkitRun && {
@@ -127,9 +127,9 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
127127

128128
expect(linkSpan).toEqual({
129129
data: {
130-
'http.decoded_response_content_length': expect.any(Number),
131-
'http.response_content_length': expect.any(Number),
132-
'http.response_transfer_size': expect.any(Number),
130+
'http.response.body.decoded_size': expect.any(Number),
131+
'http.response.body.size': expect.any(Number),
132+
'http.response.size': expect.any(Number),
133133
'http.request.connect_start': expect.any(Number),
134134
'http.request.connection_end': expect.any(Number),
135135
'http.request.domain_lookup_end': expect.any(Number),
@@ -149,7 +149,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
149149
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics',
150150
'server.address': 'sentry-test-site.example',
151151
'url.domain': 'sentry-test-site.example',
152-
'url.same_origin': false,
152+
'http.request.same_origin': false,
153153
'url.scheme': 'https',
154154
'url.full': 'https://sentry-test-site.example/path/to/style.css',
155155
...(!isWebkitRun && {
@@ -171,9 +171,9 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
171171

172172
expect(customScriptSpan).toEqual({
173173
data: {
174-
'http.decoded_response_content_length': expect.any(Number),
175-
'http.response_content_length': expect.any(Number),
176-
'http.response_transfer_size': expect.any(Number),
174+
'http.response.body.decoded_size': expect.any(Number),
175+
'http.response.body.size': expect.any(Number),
176+
'http.response.size': expect.any(Number),
177177
'http.request.connection_end': expect.any(Number),
178178
'http.request.connect_start': expect.any(Number),
179179
'http.request.domain_lookup_end': expect.any(Number),
@@ -193,7 +193,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU
193193
'sentry.origin': 'auto.resource.browser.metrics',
194194
'server.address': 'sentry-test-site.example',
195195
'url.domain': 'sentry-test-site.example',
196-
'url.same_origin': false,
196+
'http.request.same_origin': false,
197197
'url.scheme': 'https',
198198
'url.full': 'https://sentry-test-site.example/path/to/script.js',
199199
...(!isWebkitRun && {

‎dev-packages/browser-integration-tests/suites/tracing/request/fetch-data-url/test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ sentryTest('sanitizes data URLs in fetch span name and attributes', async ({ get
2626
expect(span?.description).toBe(`GET ${sanitizedUrl}`);
2727

2828
expect(span?.data).toMatchObject({
29-
'http.method': 'GET',
29+
'http.request.method': 'GET',
3030
type: 'fetch',
3131
});
3232

‎dev-packages/browser-integration-tests/suites/tracing/request/fetch-immediate/test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ sentryTest('should create spans for fetch requests called directly after init',
3030
timestamp: expect.any(Number),
3131
trace_id: tracingEvent.contexts?.trace?.trace_id,
3232
data: {
33-
'http.method': 'GET',
33+
'http.request.method': 'GET',
3434
'url.full': 'http://sentry-test-site.example/0',
3535
'server.address': 'sentry-test-site.example',
3636
type: 'fetch',

‎dev-packages/browser-integration-tests/suites/tracing/request/fetch-relative-url/test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p
2828
timestamp: expect.any(Number),
2929
trace_id: tracingEvent.contexts?.trace?.trace_id,
3030
data: {
31-
'http.method': 'GET',
31+
'http.request.method': 'GET',
3232
'url.full': `${TEST_HOST}/test-req/${index}`,
3333
'server.address': 'sentry-test.io',
3434
type: 'fetch',

0 commit comments

Comments
 (0)