Skip to content

Commit 78d070e

Browse files
nicohrubeccodex
andauthored
ref(server): Use SENTRY_ORIGIN convention constant (#25036)
Uses `SENTRY_ORIGIN` from `@sentry/conventions/attributes` in server instrumentation, runtimes, 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 f94c52e commit 78d070e

107 files changed

Lines changed: 468 additions & 548 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/cloudflare-integration-tests/suites/public-api/startSpan/test.ts‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
1+
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
22
import {
33
SENTRY_SEGMENT_NAME_SOURCE,
44
SENTRY_SDK_NAME,
@@ -10,6 +10,7 @@ import {
1010
SENTRY_RELEASE,
1111
SENTRY_SDK_INTEGRATIONS,
1212
SENTRY_OP,
13+
SENTRY_ORIGIN,
1314
} from '@sentry/conventions/attributes';
1415
import { expect, it } from 'vitest';
1516
import { createRunner } from '../../../runner';
@@ -85,7 +86,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
8586
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
8687
[SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName },
8788
[SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
88-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
89+
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
8990
[SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
9091
},
9192
name: 'test-child-span',
@@ -104,7 +105,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
104105
attributes: {
105106
'sentry.is_localhost': { value: true, type: 'boolean' },
106107
[SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' },
107-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
108+
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
108109
[SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK },
109110
[SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION },
110111
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
@@ -141,7 +142,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
141142
attributes: {
142143
'sentry.is_localhost': { value: true, type: 'boolean' },
143144
[SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' },
144-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
145+
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
145146
[SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK },
146147
[SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION },
147148
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
@@ -169,7 +170,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
169170
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
170171
[SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName },
171172
[SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
172-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
173+
[SENTRY_ORIGIN]: { type: 'string', value: 'manual' },
173174
[SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
174175
},
175176
name: 'test-span',
@@ -193,7 +194,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa
193194
value: expect.arrayContaining(['SpanStreaming']),
194195
},
195196
[SENTRY_RELEASE]: { type: 'string', value: '1.0.0' },
196-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.http.cloudflare' },
197+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.http.cloudflare' },
197198
[SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId },
198199
[SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName },
199200
[SENTRY_OP]: { type: 'string', value: 'http.server' },

‎dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect, it } from 'vitest';
22
import type { Envelope, SerializedStreamedSpan } from '@sentry/core';
3-
import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
3+
import { SDK_VERSION } from '@sentry/core';
44
import {
55
SENTRY_SDK_NAME,
66
SENTRY_SDK_VERSION,
@@ -9,6 +9,7 @@ import {
99
SENTRY_TRACE_LIFECYCLE,
1010
SENTRY_ENVIRONMENT,
1111
SENTRY_OP,
12+
SENTRY_ORIGIN,
1213
} from '@sentry/conventions/attributes';
1314
import { createRunner } from '../../../runner';
1415
import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils';
@@ -37,7 +38,7 @@ function commonAttributes(segmentSpan: SerializedStreamedSpan): SerializedStream
3738
[SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentSpan.name },
3839
[SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' },
3940
[SENTRY_OP]: { type: 'string', value: 'db.query' },
40-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.d1' },
41+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.d1' },
4142
'db.system.name': { type: 'string', value: 'cloudflare-d1' },
4243
};
4344
}

‎dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { SENTRY_OP } from '@sentry/conventions/attributes';
1+
import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
22
import type { Envelope } from '@sentry/core';
3-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
43
import { expect, it } from 'vitest';
54
import { createRunner } from '../../../runner';
65
import { getSpansFromEnvelope } from '../../../spanUtils';
@@ -24,7 +23,7 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal
2423
expect(segmentSpan?.attributes['url.path']).toEqual({ type: 'string', value: '/exec' });
2524

2625
const sqlSpans = spans.filter(
27-
span => span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value === 'auto.db.cloudflare.durable_object.sql',
26+
span => span.attributes[SENTRY_ORIGIN]?.value === 'auto.db.cloudflare.durable_object.sql',
2827
);
2928

3029
expect(sqlSpans).toHaveLength(3);
@@ -34,7 +33,7 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal
3433
name: 'CREATE TABLE users',
3534
attributes: expect.objectContaining({
3635
[SENTRY_OP]: { type: 'string', value: 'db.query' },
37-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object.sql' },
36+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object.sql' },
3837
'db.system.name': { type: 'string', value: 'cloudflare-durable-object-sql' },
3938
'db.operation.name': { type: 'string', value: 'exec' },
4039
'db.query.text': {

‎dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts‎

Lines changed: 2 additions & 3 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 { Envelope } from '@sentry/core';
33
import { expect, it } from 'vitest';
4-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
54
import { createRunner } from '../../../runner';
65
import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils';
76

@@ -31,7 +30,7 @@ it('instruments sync KV operations on Durable Object storage', async ({ signal }
3130
name: 'durable_object_storage_kv_put',
3231
attributes: expect.objectContaining({
3332
[SENTRY_OP]: { type: 'string', value: 'db' },
34-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object' },
33+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object' },
3534
'db.system.name': { type: 'string', value: 'cloudflare-durable-object-sql' },
3635
'db.operation.name': { type: 'string', value: 'put' },
3736
}),

‎dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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, it } from 'vitest';
33
import type { Event } from '@sentry/core';
4-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
4+
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core';
55
import { createRunner } from '../../../runner';
66
import { getSpansFromEnvelope } from '../../../spanUtils';
77

@@ -21,7 +21,7 @@ it('Scheduled handler creates a segment span with correct attributes', async ({
2121
status: 'ok',
2222
attributes: expect.objectContaining({
2323
[SENTRY_OP]: { type: 'string', value: 'function' },
24-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.scheduled' },
24+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.scheduled' },
2525
[SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'task' },
2626
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 },
2727
'code.function.name': { type: 'string', value: 'scheduled' },

‎dev-packages/cloudflare-integration-tests/suites/tracing/workflow/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, SENTRY_OP } from '@sentry/conventions/attributes';
1+
import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
22
import { expect, it } from 'vitest';
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 { createRunner } from '../../../runner';
55

66
it('Workflow steps create segment spans with correct attributes', async ({ signal }) => {
@@ -25,7 +25,7 @@ it('Workflow steps create segment spans with correct attributes', async ({ signa
2525
status: 'ok',
2626
attributes: expect.objectContaining({
2727
[SENTRY_OP]: { type: 'string', value: 'function' },
28-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.workflow' },
28+
[SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.workflow' },
2929
[SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'task' },
3030
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 },
3131
'code.function.name': { type: 'string', value: stepName },

0 commit comments

Comments
 (0)