Skip to content

Commit 6154b37

Browse files
ref(core)!: Migrate to SENTRY_SEGMENT_NAME_SOURCE (#23368)
Besides removing SEMANTIC_ATTRIBUTE_SENTRY_SOURCE and using SENTRY_SEGMENT_NAME_SOURCE instead, this PR also: * Sets name source only on segment spans (per the [Sentry segment name source convention](<https://develop.sentry.dev/sdk/telemetry/attributes/#sentrysegmentnamesource>)) — e.g. updateName, HTTP server spans, and tRPC when it is the segment root * Removes envelope-time backfill from sentry.source → sentry.segment.name.source in captureSpan CI note: This PR alone is expected to fail CI. It will stay blocked until [#23367](<#23367>) is merged into it — that split is intentional to keep the core changes easier to review. Fixes #22259 --------- Co-authored-by: Cursor Grok 4.6 <cursoragent@cursor.com>
1 parent 1dca402 commit 6154b37

360 files changed

Lines changed: 1421 additions & 1514 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/beforeSendTransaction/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Sentry.init({
1515
transactionEvent.transaction_info.source = 'route';
1616
transactionEvent.contexts.trace.data = {
1717
...transactionEvent.contexts.trace.data,
18-
[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
18+
['sentry.segment.name.source']: 'route',
1919
};
2020
}
2121
return transactionEvent;

dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes';
12
import { expect } from '@playwright/test';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/browser';
3+
34
import type { Event } from '@sentry/core';
45
import { sentryTest } from '../../../utils/fixtures';
56
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../utils/helpers';
@@ -26,6 +27,6 @@ sentryTest(
2627
expect(eventData.transaction_info?.source).toBe('custom');
2728

2829
// This stays the same but it has no effect on Relay.
29-
expect(eventData.contexts?.trace?.data?.[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('route');
30+
expect(eventData.contexts?.trace?.data?.[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route');
3031
},
3132
);

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1+
import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes';
12
import { expect } from '@playwright/test';
2-
import {
3-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
4-
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
5-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
6-
} from '@sentry/browser';
3+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser';
74
import { sentryTest } from '../../../../utils/fixtures';
85
import {
96
envelopeRequestParser,
@@ -26,7 +23,7 @@ sentryTest(
2623
expect(attributes).toEqual({
2724
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual',
2825
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
29-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom',
26+
[SENTRY_SEGMENT_NAME_SOURCE]: 'custom',
3027
});
3128

3229
expect(transaction.transaction_info?.source).toBe('custom');

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import {
66
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
77
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
88
SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS,
9-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
109
SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE,
1110
} from '@sentry/core';
1211
import { sentryTest } from '../../../../utils/fixtures';
1312
import { shouldSkipTracingTest } from '../../../../utils/helpers';
1413
import { waitForStreamedSpanEnvelope } from '../../../../utils/spanUtils';
1514
import {
15+
SENTRY_SEGMENT_NAME_SOURCE,
1616
SENTRY_SEGMENT_ID,
1717
SENTRY_SEGMENT_NAME,
1818
SENTRY_SDK_NAME,
@@ -255,11 +255,7 @@ sentryTest(
255255
type: 'string',
256256
value: 'test-span',
257257
},
258-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: {
259-
type: 'string',
260-
value: 'custom',
261-
},
262-
'sentry.segment.name.source': {
258+
[SENTRY_SEGMENT_NAME_SOURCE]: {
263259
type: 'string',
264260
value: 'custom',
265261
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes';
12
import { expect } from '@playwright/test';
23
import {
34
SEMANTIC_ATTRIBUTE_SENTRY_OP,
45
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
56
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
6-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
77
} from '@sentry/core';
88
import { sentryTest } from '../../../../utils/fixtures';
99
import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../utils/helpers';
@@ -46,14 +46,14 @@ sentryTest(
4646
expect(pageloadRequest.contexts?.trace?.data).toMatchObject({
4747
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser',
4848
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
49-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
49+
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
5050
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
5151
['sentry.idle_span_finish_reason']: 'cancelled',
5252
});
5353
expect(navigationRequest.contexts?.trace?.data).toMatchObject({
5454
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser',
5555
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
56-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
56+
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
5757
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
5858
['sentry.idle_span_finish_reason']: 'idleTimeout',
5959
});

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import {
33
SEMANTIC_ATTRIBUTE_SENTRY_OP,
44
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
55
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
6-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
76
} from '@sentry/core';
87
import { sentryTest } from '../../../../../utils/fixtures';
98
import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers';
10-
import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes';
9+
import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes';
1110

1211
sentryTest(
1312
'creates a pageload and navigation root spans each with multiple navigation.redirect childspans',
@@ -34,7 +33,7 @@ sentryTest(
3433
expect(pageloadRequest.contexts?.trace?.data).toMatchObject({
3534
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser',
3635
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
37-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
36+
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
3837
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
3938
['sentry.idle_span_finish_reason']: 'cancelled',
4039
});
@@ -57,7 +56,6 @@ sentryTest(
5756
data: {
5857
'sentry.op': 'navigation.redirect',
5958
'sentry.origin': 'auto.navigation.browser',
60-
'sentry.source': 'url',
6159
[URL_FULL]: expect.any(String),
6260
[URL_PATH]: expect.any(String),
6361
},

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import {
33
SEMANTIC_ATTRIBUTE_SENTRY_OP,
44
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
55
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
6-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
76
} from '@sentry/core';
87
import { sentryTest } from '../../../../../utils/fixtures';
98
import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers';
10-
import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes';
9+
import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes';
1110

1211
sentryTest('creates a pageload root span with navigation.redirect childspan', async ({ getLocalTestUrl, page }) => {
1312
if (shouldSkipTracingTest()) {
@@ -27,7 +26,7 @@ sentryTest('creates a pageload root span with navigation.redirect childspan', as
2726
expect(pageloadRequest.contexts?.trace?.data).toMatchObject({
2827
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser',
2928
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
30-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
29+
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
3130
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
3231
['sentry.idle_span_finish_reason']: 'idleTimeout',
3332
});
@@ -53,7 +52,6 @@ sentryTest('creates a pageload root span with navigation.redirect childspan', as
5352
data: {
5453
'sentry.op': 'navigation.redirect',
5554
'sentry.origin': 'auto.navigation.browser',
56-
'sentry.source': 'url',
5755
[URL_FULL]: 'http://sentry-test.io/sub-page',
5856
[URL_PATH]: '/sub-page',
5957
},

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import {
66
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
77
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
88
SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS,
9-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
109
} from '@sentry/core';
11-
import { SENTRY_TRACE_LIFECYCLE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes';
10+
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_TRACE_LIFECYCLE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes';
1211
import { sentryTest } from '../../../../utils/fixtures';
1312
import { shouldSkipTracingTest } from '../../../../utils/helpers';
1413
import {
@@ -154,10 +153,6 @@ sentryTest('starts a streamed navigation span on page navigation', async ({ brow
154153
type: 'string',
155154
value: '/index.html',
156155
},
157-
'sentry.source': {
158-
type: 'string',
159-
value: 'url',
160-
},
161156
'sentry.segment.name.source': {
162157
type: 'string',
163158
value: 'url',
@@ -223,7 +218,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page })
223218
type: 'integer',
224219
value: 1,
225220
},
226-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: {
221+
[SENTRY_SEGMENT_NAME_SOURCE]: {
227222
type: 'string',
228223
value: 'url',
229224
},
@@ -248,7 +243,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page })
248243
type: 'integer',
249244
value: 1,
250245
},
251-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: {
246+
[SENTRY_SEGMENT_NAME_SOURCE]: {
252247
type: 'string',
253248
value: 'url',
254249
},

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes';
12
import { expect } from '@playwright/test';
23
import type { Event } from '@sentry/core';
34
import {
45
SEMANTIC_ATTRIBUTE_SENTRY_OP,
56
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
67
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
7-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
88
} from '@sentry/core';
99
import { sentryTest } from '../../../../utils/fixtures';
1010
import {
@@ -43,14 +43,14 @@ sentryTest('should create a navigation transaction on page navigation', async ({
4343
expect(pageloadRequest.contexts?.trace?.data).toMatchObject({
4444
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser',
4545
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
46-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
46+
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
4747
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload',
4848
['sentry.idle_span_finish_reason']: 'idleTimeout',
4949
});
5050
expect(navigationRequest.contexts?.trace?.data).toMatchObject({
5151
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser',
5252
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
53-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
53+
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
5454
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
5555
['sentry.idle_span_finish_reason']: 'idleTimeout',
5656
});
@@ -121,7 +121,7 @@ sentryTest('should handle pushState with full URL', async ({ getLocalTestUrl, pa
121121
expect(navigationRequest.contexts?.trace?.data).toMatchObject({
122122
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser',
123123
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
124-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
124+
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
125125
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
126126
['sentry.idle_span_finish_reason']: 'idleTimeout',
127127
});
@@ -141,7 +141,7 @@ sentryTest('should handle pushState with full URL', async ({ getLocalTestUrl, pa
141141
expect(navigationRequest2.contexts?.trace?.data).toMatchObject({
142142
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser',
143143
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1,
144-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',
144+
[SENTRY_SEGMENT_NAME_SOURCE]: 'url',
145145
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',
146146
['sentry.idle_span_finish_reason']: 'idleTimeout',
147147
});

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
77
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
88
SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS,
9-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
109
} from '@sentry/core';
1110
import {
11+
SENTRY_SEGMENT_NAME_SOURCE,
1212
SENTRY_SEGMENT_ID,
1313
SENTRY_SEGMENT_NAME,
1414
SENTRY_SDK_NAME,
@@ -161,11 +161,7 @@ sentryTest(
161161
type: 'string',
162162
value: 'Pageload',
163163
},
164-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: {
165-
type: 'string',
166-
value: 'url',
167-
},
168-
'sentry.segment.name.source': {
164+
[SENTRY_SEGMENT_NAME_SOURCE]: {
169165
type: 'string',
170166
value: 'url',
171167
},

0 commit comments

Comments
 (0)