Skip to content

Commit b953c6f

Browse files
authored
fix(browser): Ensure url.full and http.url attributes have the same values on http.client spans (#21660)
#21639 came from a bug where our browser fetch instrumentation didn't explicitly set `url.full` causing it to be set by the `httpContextIntegration` which writes this attribute onto segment spans (but the value in said case is from `window.location`). If streaming is enabled, `http.client` spans can become segment spans if they happen outside of an ongoing segment span, causing the previous mismatch. I'll deprecate `http.url` in a follow-up PR. We should remove this in v11 in favour of `url.full`. closes #21639
1 parent b54777a commit b953c6f

19 files changed

Lines changed: 102 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ sentryTest('should update spans for GraphQL fetch requests', async ({ getLocalTe
5050
type: 'fetch',
5151
'http.method': 'POST',
5252
'http.url': 'http://sentry-test.io/foo',
53+
'url.full': 'http://sentry-test.io/foo',
5354
url: 'http://sentry-test.io/foo',
5455
'server.address': 'sentry-test.io',
5556
'sentry.op': 'http.client',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ sentryTest('should update spans for GraphQL persisted query fetch requests', asy
4444
type: 'fetch',
4545
'http.method': 'POST',
4646
'http.url': 'http://sentry-test.io/graphql',
47+
'url.full': 'http://sentry-test.io/graphql',
4748
url: 'http://sentry-test.io/graphql',
4849
'server.address': 'sentry-test.io',
4950
'sentry.op': 'http.client',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ sentryTest('should update spans for GraphQL persisted query XHR requests', async
4444
type: 'xhr',
4545
'http.method': 'POST',
4646
'http.url': 'http://sentry-test.io/graphql',
47+
'url.full': 'http://sentry-test.io/graphql',
4748
url: 'http://sentry-test.io/graphql',
4849
'server.address': 'sentry-test.io',
4950
'sentry.op': 'http.client',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ sentryTest('should update spans for GraphQL XHR requests', async ({ getLocalTest
5050
type: 'xhr',
5151
'http.method': 'POST',
5252
'http.url': 'http://sentry-test.io/foo',
53+
'url.full': 'http://sentry-test.io/foo',
5354
url: 'http://sentry-test.io/foo',
5455
'server.address': 'sentry-test.io',
5556
'sentry.op': 'http.client',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ sentryTest('sanitizes data URLs in fetch span name and attributes', async ({ get
3232
});
3333

3434
expect(span?.data?.['http.url']).toBe(sanitizedUrl);
35+
expect(span?.data?.['url.full']).toBe(sanitizedUrl);
3536
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ sentryTest('should create spans for fetch requests called directly after init',
3232
data: {
3333
'http.method': 'GET',
3434
'http.url': 'http://sentry-test-site.example/0',
35+
'url.full': 'http://sentry-test-site.example/0',
3536
url: 'http://sentry-test-site.example/0',
3637
'server.address': 'sentry-test-site.example',
3738
type: 'fetch',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p
3030
data: {
3131
'http.method': 'GET',
3232
'http.url': `${TEST_HOST}/test-req/${index}`,
33+
'url.full': `${TEST_HOST}/test-req/${index}`,
3334
url: `/test-req/${index}`,
3435
'server.address': 'sentry-test.io',
3536
type: 'fetch',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ sentryTest('creates spans for fetch requests', async ({ getLocalTestUrl, page })
3838
attributes: expect.objectContaining({
3939
'http.method': { type: 'string', value: 'GET' },
4040
'http.url': { type: 'string', value: `http://sentry-test-site.example/${index}` },
41+
'url.full': { type: 'string', value: `http://sentry-test-site.example/${index}` },
4142
url: { type: 'string', value: `http://sentry-test-site.example/${index}` },
4243
'server.address': { type: 'string', value: 'sentry-test-site.example' },
4344
type: { type: 'string', value: 'fetch' },

dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ sentryTest('strips query params in fetch request spans', async ({ getLocalTestUr
3131
data: expect.objectContaining({
3232
'http.method': 'GET',
3333
'http.url': 'http://sentry-test-site.example/0?id=123;page=5',
34+
'url.full': 'http://sentry-test-site.example/0?id=123;page=5',
3435
'http.query': '?id=123;page=5',
3536
'http.response.status_code': 200,
3637
'http.response_content_length': 2,
@@ -74,6 +75,7 @@ sentryTest('strips hash fragment in fetch request spans', async ({ getLocalTestU
7475
data: expect.objectContaining({
7576
'http.method': 'GET',
7677
'http.url': 'http://sentry-test-site.example/1#fragment',
78+
'url.full': 'http://sentry-test-site.example/1#fragment',
7779
'http.fragment': '#fragment',
7880
'http.response.status_code': 200,
7981
'http.response_content_length': 2,
@@ -117,6 +119,7 @@ sentryTest('strips hash fragment and query params in fetch request spans', async
117119
data: expect.objectContaining({
118120
'http.method': 'GET',
119121
'http.url': 'http://sentry-test-site.example/2?id=1#fragment',
122+
'url.full': 'http://sentry-test-site.example/2?id=1#fragment',
120123
'http.query': '?id=1',
121124
'http.fragment': '#fragment',
122125
'http.response.status_code': 200,
@@ -161,6 +164,7 @@ sentryTest(
161164
data: expect.objectContaining({
162165
'http.method': 'GET',
163166
'http.url': 'http://sentry-test.io/api/users?id=1#fragment',
167+
'url.full': 'http://sentry-test.io/api/users?id=1#fragment',
164168
'http.query': '?id=1',
165169
'http.fragment': '#fragment',
166170
'http.response.status_code': 200,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p
3333
data: {
3434
'http.method': 'GET',
3535
'http.url': `http://sentry-test-site.example/${index}`,
36+
'url.full': `http://sentry-test-site.example/${index}`,
3637
url: `http://sentry-test-site.example/${index}`,
3738
'server.address': 'sentry-test-site.example',
3839
type: 'fetch',

0 commit comments

Comments
 (0)