Skip to content

Commit e74d7cf

Browse files
nicohrubeccodex
andauthored
ref(browser): Use SENTRY_ORIGIN convention constant (#25037)
Uses `SENTRY_ORIGIN` from `@sentry/conventions/attributes` in the browser SDK, browser framework integrations, and their tests. It has the same `sentry.origin` value; transmitted data and public exports are unchanged. Part of #24961 / [JS-3868](https://linear.app/getsentry/issue/JS-3868). Co-authored-by: GPT-6 <codex@openai.com>
1 parent b139c53 commit e74d7cf

56 files changed

Lines changed: 294 additions & 281 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/public-api/startSpan/basic/test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes';
1+
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
22
import { expect } from '@playwright/test';
3-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser';
3+
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser';
44
import { sentryTest } from '../../../../utils/fixtures';
55
import {
66
envelopeRequestParser,
@@ -21,7 +21,7 @@ sentryTest(
2121

2222
const attributes = transaction.contexts?.trace?.data;
2323
expect(attributes).toEqual({
24-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual',
24+
[SENTRY_ORIGIN]: 'manual',
2525
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
2626
[SENTRY_SEGMENT_NAME_SOURCE]: 'custom',
2727
});

‎dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
2+
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
33
import { sentryTest } from '../../../../utils/fixtures';
44
import { shouldSkipTracingTest } from '../../../../utils/helpers';
55
import { waitForStreamedSpanEnvelope } from '../../../../utils/spanUtils';
@@ -15,6 +15,7 @@ import {
1515
SENTRY_ENVIRONMENT,
1616
SENTRY_SDK_INTEGRATIONS,
1717
SENTRY_OP,
18+
SENTRY_ORIGIN,
1819
} from '@sentry/conventions/attributes';
1920

2021
sentryTest(
@@ -77,7 +78,7 @@ sentryTest(
7778
type: 'string',
7879
value: 'test-child',
7980
},
80-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: {
81+
[SENTRY_ORIGIN]: {
8182
type: 'string',
8283
value: 'manual',
8384
},
@@ -122,7 +123,7 @@ sentryTest(
122123
{
123124
attributes: {
124125
'sentry.is_localhost': { value: false, type: 'boolean' },
125-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: {
126+
[SENTRY_ORIGIN]: {
126127
type: 'string',
127128
value: 'manual',
128129
},
@@ -167,7 +168,7 @@ sentryTest(
167168
{
168169
attributes: {
169170
'sentry.is_localhost': { value: false, type: 'boolean' },
170-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: {
171+
[SENTRY_ORIGIN]: {
171172
type: 'string',
172173
value: 'manual',
173174
},
@@ -240,7 +241,7 @@ sentryTest(
240241
type: 'string',
241242
value: 'test',
242243
},
243-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: {
244+
[SENTRY_ORIGIN]: {
244245
type: 'string',
245246
value: 'manual',
246247
},

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled-streamed/test.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { SENTRY_OP } from '@sentry/conventions/attributes';
1+
import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
22
import type { Route } from '@playwright/test';
33
import { expect } from '@playwright/test';
4-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser';
54
import { sentryTest } from '../../../../utils/fixtures';
65
import { shouldSkipTracingTest } from '../../../../utils/helpers';
76
import { getSpanOp, waitForStreamedSpans } from '../../../../utils/spanUtils';
@@ -46,7 +45,7 @@ sentryTest(
4645
},
4746
'browser.script.invoker_type': { type: 'string', value: 'classic-script' },
4847
[SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' },
49-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
48+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
5049
}),
5150
}),
5251
);
@@ -95,7 +94,7 @@ sentryTest('captures long animation frame span for event listener.', async ({ br
9594
'browser.script.invoker_type': { type: 'string', value: 'event-listener' },
9695
'code.file.path': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
9796
[SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' },
98-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
97+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
9998
}),
10099
}),
101100
);

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { SENTRY_OP } from '@sentry/conventions/attributes';
1+
import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
22
import type { Route } from '@playwright/test';
33
import { expect } from '@playwright/test';
4-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser';
54
import type { Event } from '@sentry/core';
65
import { sentryTest } from '../../../../utils/fixtures';
76
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -46,7 +45,7 @@ sentryTest(
4645
'browser.script.invoker': 'https://sentry-test-site.example/path/to/script.js',
4746
'browser.script.invoker_type': 'classic-script',
4847
[SENTRY_OP]: 'ui.long_animation_frame',
49-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
48+
[SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
5049
},
5150
}),
5251
);
@@ -100,7 +99,7 @@ sentryTest(
10099
'browser.script.invoker_type': 'event-listener',
101100
'code.file.path': 'https://sentry-test-site.example/path/to/script.js',
102101
[SENTRY_OP]: 'ui.long_animation_frame',
103-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
102+
[SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
104103
},
105104
}),
106105
);

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled-streamed/test.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { SENTRY_OP } from '@sentry/conventions/attributes';
1+
import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
22
import type { Route } from '@playwright/test';
33
import { expect } from '@playwright/test';
4-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser';
54
import { sentryTest } from '../../../../utils/fixtures';
65
import { shouldSkipTracingTest } from '../../../../utils/helpers';
76
import { getSpanOp, waitForStreamedSpans } from '../../../../utils/spanUtils';
@@ -48,7 +47,7 @@ sentryTest(
4847
},
4948
'browser.script.invoker_type': { type: 'string', value: 'classic-script' },
5049
[SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' },
51-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
50+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
5251
}),
5352
}),
5453
);
@@ -97,7 +96,7 @@ sentryTest('captures long animation frame span for event listener.', async ({ br
9796
'browser.script.invoker_type': { type: 'string', value: 'event-listener' },
9897
'code.file.path': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
9998
[SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' },
100-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
99+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
101100
}),
102101
}),
103102
);

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { SENTRY_OP } from '@sentry/conventions/attributes';
1+
import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
22
import type { Route } from '@playwright/test';
33
import { expect } from '@playwright/test';
4-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser';
54
import type { Event } from '@sentry/core';
65
import { sentryTest } from '../../../../utils/fixtures';
76
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -48,7 +47,7 @@ sentryTest(
4847
'browser.script.invoker': 'https://sentry-test-site.example/path/to/script.js',
4948
'browser.script.invoker_type': 'classic-script',
5049
[SENTRY_OP]: 'ui.long_animation_frame',
51-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
50+
[SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
5251
},
5352
}),
5453
);
@@ -102,7 +101,7 @@ sentryTest(
102101
'browser.script.invoker_type': 'event-listener',
103102
'code.file.path': 'https://sentry-test-site.example/path/to/script.js',
104103
[SENTRY_OP]: 'ui.long_animation_frame',
105-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
104+
[SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
106105
},
107106
}),
108107
);

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-aborting-pageload/test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes';
1+
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
22
import { expect } from '@playwright/test';
3-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
3+
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
44
import { sentryTest } from '../../../../utils/fixtures';
55
import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../utils/helpers';
66

@@ -40,14 +40,14 @@ sentryTest(
4040
expect(navigationRequest.transaction).toEqual('/sub-page');
4141

4242
expect(pageloadRequest.contexts?.trace?.data).toMatchObject({
43-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser',
43+
[SENTRY_ORIGIN]: 'auto.pageload.browser',
4444
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
4545
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
4646
[SENTRY_OP]: 'pageload',
4747
['sentry.idle_span_finish_reason']: 'cancelled',
4848
});
4949
expect(navigationRequest.contexts?.trace?.data).toMatchObject({
50-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser',
50+
[SENTRY_ORIGIN]: 'auto.navigation.browser',
5151
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
5252
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
5353
[SENTRY_OP]: 'navigation',

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/multiple-redirects/test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import { expect } from '@playwright/test';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
2+
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
33
import { sentryTest } from '../../../../../utils/fixtures';
44
import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers';
5-
import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes';
5+
import {
6+
SENTRY_SEGMENT_NAME_SOURCE,
7+
URL_FULL,
8+
URL_PATH,
9+
SENTRY_OP,
10+
SENTRY_ORIGIN,
11+
} from '@sentry/conventions/attributes';
612

713
sentryTest(
814
'creates a pageload and navigation root spans each with multiple navigation.redirect childspans',
@@ -27,7 +33,7 @@ sentryTest(
2733
expect(pageloadRequest.contexts?.trace?.op).toBe('pageload');
2834

2935
expect(pageloadRequest.contexts?.trace?.data).toMatchObject({
30-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser',
36+
[SENTRY_ORIGIN]: 'auto.pageload.browser',
3137
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
3238
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
3339
[SENTRY_OP]: 'pageload',

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/pageload-redirect/test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import { expect } from '@playwright/test';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
2+
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
33
import { sentryTest } from '../../../../../utils/fixtures';
44
import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers';
5-
import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes';
5+
import {
6+
SENTRY_SEGMENT_NAME_SOURCE,
7+
URL_FULL,
8+
URL_PATH,
9+
SENTRY_OP,
10+
SENTRY_ORIGIN,
11+
} from '@sentry/conventions/attributes';
612

713
sentryTest('creates a pageload root span with navigation.redirect childspan', async ({ getLocalTestUrl, page }) => {
814
if (shouldSkipTracingTest()) {
@@ -20,7 +26,7 @@ sentryTest('creates a pageload root span with navigation.redirect childspan', as
2026
expect(pageloadRequest.contexts?.trace?.op).toBe('pageload');
2127

2228
expect(pageloadRequest.contexts?.trace?.data).toMatchObject({
23-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser',
29+
[SENTRY_ORIGIN]: 'auto.pageload.browser',
2430
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
2531
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
2632
[SENTRY_OP]: 'pageload',

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
2+
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
33
import {
44
SENTRY_SEGMENT_NAME_SOURCE,
55
SENTRY_TRACE_LIFECYCLE,
@@ -9,6 +9,7 @@ import {
99
SENTRY_ENVIRONMENT,
1010
SENTRY_SDK_INTEGRATIONS,
1111
SENTRY_OP,
12+
SENTRY_ORIGIN,
1213
} from '@sentry/conventions/attributes';
1314
import { sentryTest } from '../../../../utils/fixtures';
1415
import { shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -124,7 +125,7 @@ sentryTest('starts a streamed navigation span on page navigation', async ({ brow
124125
type: 'string',
125126
value: 'navigation',
126127
},
127-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: {
128+
[SENTRY_ORIGIN]: {
128129
type: 'string',
129130
value: 'auto.navigation.browser',
130131
},
@@ -220,7 +221,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page })
220221
type: 'string',
221222
value: '/sub-page',
222223
},
223-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: {
224+
[SENTRY_ORIGIN]: {
224225
type: 'string',
225226
value: 'auto.navigation.browser',
226227
},
@@ -249,7 +250,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page })
249250
type: 'string',
250251
value: '/sub-page-2',
251252
},
252-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: {
253+
[SENTRY_ORIGIN]: {
253254
type: 'string',
254255
value: 'auto.navigation.browser',
255256
},

0 commit comments

Comments
 (0)