diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts index 326c05a787f4..824220e5133f 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts @@ -1,6 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, @@ -21,7 +21,7 @@ sentryTest( const attributes = transaction.contexts?.trace?.data; expect(attributes).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts index 31cc5c7d3853..d5d29e256a46 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts @@ -2,8 +2,6 @@ import { expect } from '@playwright/test'; import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, } from '@sentry/core'; @@ -19,6 +17,8 @@ import { SENTRY_TRACE_LIFECYCLE, USER_AGENT_ORIGINAL, SENTRY_STATUS_MESSAGE, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; sentryTest( @@ -77,11 +77,11 @@ sentryTest( { attributes: { 'sentry.is_localhost': { value: false, type: 'boolean' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'test-child', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -126,7 +126,7 @@ sentryTest( { attributes: { 'sentry.is_localhost': { value: false, type: 'boolean' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -171,7 +171,7 @@ sentryTest( { attributes: { 'sentry.is_localhost': { value: false, type: 'boolean' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -240,11 +240,11 @@ sentryTest( type: 'string', value: expect.any(String), }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'test', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled-streamed/test.ts index 6f7116bd33a7..0ebd3c0f6022 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled-streamed/test.ts @@ -1,7 +1,6 @@ +import { SENTRY_ORIGIN, SENTRY_OP } from '@sentry/conventions/attributes'; import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { getSpanOp, waitForStreamedSpans } from '../../../../utils/spanUtils'; @@ -45,8 +44,8 @@ sentryTest( value: 'https://sentry-test-site.example/path/to/script.js', }, 'browser.script.invoker_type': { type: 'string', value: 'classic-script' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, }), }), ); @@ -94,8 +93,8 @@ sentryTest('captures long animation frame span for event listener.', async ({ br 'browser.script.invoker': { type: 'string', value: 'BUTTON#clickme.onclick' }, 'browser.script.invoker_type': { type: 'string', value: 'event-listener' }, 'code.file.path': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, }), }), ); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts index 17db0254533e..937662e117a4 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts @@ -1,6 +1,6 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -44,8 +44,8 @@ sentryTest( 'browser.script.source_char_position': 0, 'browser.script.invoker': 'https://sentry-test-site.example/path/to/script.js', 'browser.script.invoker_type': 'classic-script', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long_animation_frame', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_OP]: 'ui.long_animation_frame', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }), ); @@ -98,8 +98,8 @@ sentryTest( 'browser.script.invoker': 'BUTTON#clickme.onclick', 'browser.script.invoker_type': 'event-listener', 'code.file.path': 'https://sentry-test-site.example/path/to/script.js', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long_animation_frame', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_OP]: 'ui.long_animation_frame', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }), ); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled-streamed/test.ts index d97eba7c9a0c..ba22c25a89b5 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled-streamed/test.ts @@ -1,7 +1,6 @@ +import { SENTRY_ORIGIN, SENTRY_OP } from '@sentry/conventions/attributes'; import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { getSpanOp, waitForStreamedSpans } from '../../../../utils/spanUtils'; @@ -47,8 +46,8 @@ sentryTest( value: 'https://sentry-test-site.example/path/to/script.js', }, 'browser.script.invoker_type': { type: 'string', value: 'classic-script' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, }), }), ); @@ -96,8 +95,8 @@ sentryTest('captures long animation frame span for event listener.', async ({ br 'browser.script.invoker': { type: 'string', value: 'BUTTON#clickme.onclick' }, 'browser.script.invoker_type': { type: 'string', value: 'event-listener' }, 'code.file.path': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, }), }), ); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts index 4e14a8add77d..b571a7d6a306 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts @@ -1,6 +1,6 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -46,8 +46,8 @@ sentryTest( 'browser.script.source_char_position': 0, 'browser.script.invoker': 'https://sentry-test-site.example/path/to/script.js', 'browser.script.invoker_type': 'classic-script', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long_animation_frame', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_OP]: 'ui.long_animation_frame', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }), ); @@ -100,8 +100,8 @@ sentryTest( 'browser.script.invoker': 'BUTTON#clickme.onclick', 'browser.script.invoker_type': 'event-listener', 'code.file.path': 'https://sentry-test-site.example/path/to/script.js', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long_animation_frame', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_OP]: 'ui.long_animation_frame', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }), ); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-aborting-pageload/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-aborting-pageload/test.ts index 4791b010015b..829710ce5011 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-aborting-pageload/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-aborting-pageload/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../utils/helpers'; @@ -44,17 +40,17 @@ sentryTest( expect(navigationRequest.transaction).toEqual('/sub-page'); expect(pageloadRequest.contexts?.trace?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'cancelled', }); expect(navigationRequest.contexts?.trace?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', + [SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); expect(pageloadRequest.request).toEqual({ diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/multiple-redirects/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/multiple-redirects/test.ts index 8b512db6a4f9..caa2b6afb328 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/multiple-redirects/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/multiple-redirects/test.ts @@ -1,12 +1,14 @@ import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + URL_FULL, + URL_PATH, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; sentryTest( 'creates a pageload and navigation root spans each with multiple navigation.redirect childspans', @@ -31,10 +33,10 @@ sentryTest( expect(pageloadRequest.contexts?.trace?.op).toBe('pageload'); expect(pageloadRequest.contexts?.trace?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'cancelled', }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/pageload-redirect/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/pageload-redirect/test.ts index b0d8a061fec8..fc126da536f3 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/pageload-redirect/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-redirect/pageload-redirect/test.ts @@ -1,12 +1,14 @@ import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + URL_FULL, + URL_PATH, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; sentryTest('creates a pageload root span with navigation.redirect childspan', async ({ getLocalTestUrl, page }) => { if (shouldSkipTracingTest()) { @@ -24,10 +26,10 @@ sentryTest('creates a pageload root span with navigation.redirect childspan', as expect(pageloadRequest.contexts?.trace?.op).toBe('pageload'); expect(pageloadRequest.contexts?.trace?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts index b99e676afaae..e1864e7615df 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation-streamed/test.ts @@ -2,8 +2,6 @@ import { expect } from '@playwright/test'; import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, } from '@sentry/core'; @@ -13,6 +11,8 @@ import { URL_FULL, URL_PATH, USER_AGENT_ORIGINAL, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -124,11 +124,11 @@ sentryTest('starts a streamed navigation span on page navigation', async ({ brow type: 'string', value: 'idleTimeout', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'navigation', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.navigation.browser', }, @@ -224,7 +224,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page }) type: 'string', value: '/sub-page', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.navigation.browser', }, @@ -236,7 +236,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page }) type: 'string', value: 'url', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'navigation', }, @@ -253,7 +253,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page }) type: 'string', value: '/sub-page-2', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.navigation.browser', }, @@ -265,7 +265,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page }) type: 'string', value: 'url', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'navigation', }, diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts index 30a457268d45..ab8a3931e132 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts @@ -1,11 +1,7 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, @@ -41,17 +37,17 @@ sentryTest('should create a navigation transaction on page navigation', async ({ expect(navigationRequest.transaction).toEqual('/index.html'); expect(pageloadRequest.contexts?.trace?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); expect(navigationRequest.contexts?.trace?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', + [SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); expect(pageloadRequest.request).toEqual({ @@ -119,10 +115,10 @@ sentryTest('should handle pushState with full URL', async ({ getLocalTestUrl, pa expect(navigationRequest.transaction).toEqual('/sub-page'); expect(navigationRequest.contexts?.trace?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', + [SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); expect(navigationRequest.request).toEqual({ @@ -139,10 +135,10 @@ sentryTest('should handle pushState with full URL', async ({ getLocalTestUrl, pa expect(navigationRequest2.transaction).toEqual('/sub-page-2'); expect(navigationRequest2.contexts?.trace?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', + [SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); expect(navigationRequest2.request).toEqual({ diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-streamed/test.ts index 680b868b4659..d74879dee492 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-streamed/test.ts @@ -2,8 +2,6 @@ import { expect } from '@playwright/test'; import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, } from '@sentry/core'; @@ -18,6 +16,8 @@ import { URL_FULL, URL_PATH, USER_AGENT_ORIGINAL, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -136,11 +136,11 @@ sentryTest( type: 'string', value: 'idleTimeout', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'pageload', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser', }, diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-update-txn-name/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-update-txn-name/test.ts index 401b30e2a5fb..0776668fb9e8 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-update-txn-name/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-update-txn-name/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { type Event, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -27,10 +23,10 @@ sentryTest( expect(eventData.transaction).toBe('new name'); expect(traceContextData).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', }); expect(traceContextData![SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]).toBeUndefined(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-updateSpanName/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-updateSpanName/test.ts index f6c3282e30c8..ab1b1ed20c46 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-updateSpanName/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-updateSpanName/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { type Event, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -25,10 +21,10 @@ sentryTest( expect(traceContextData).toBeDefined(); expect(traceContextData).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', }); expect(traceContextData![SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]).toBeUndefined(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload/test.ts index bd02b4799199..8e7c3a4b2480 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -26,10 +22,10 @@ sentryTest('creates a pageload transaction with url as source', async ({ getLoca expect(startTimestamp).toBeCloseTo(timeOrigin, 1); expect(traceContextData).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/default/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/default/test.ts index 3d3d4e69069c..3c4a37bc9de3 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/default/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/default/test.ts @@ -1,10 +1,11 @@ -import { SENTRY_IDLE_SPAN_FINISH_REASON, SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; -import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; + SENTRY_IDLE_SPAN_FINISH_REASON, + SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; +import { expect } from '@playwright/test'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../../utils/helpers'; import { getSpanOp, waitForStreamedSpan } from '../../../../../utils/spanUtils'; @@ -25,10 +26,10 @@ sentryTest( const spanDurationSeconds = pageloadSpan.end_timestamp - pageloadSpan.start_timestamp; expect(pageloadSpan.attributes).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: expect.objectContaining({ value: 1 }), [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'pageload' }, + [SENTRY_OP]: { type: 'string', value: 'pageload' }, [SENTRY_IDLE_SPAN_FINISH_REASON]: { type: 'string', value: 'reportPageLoaded' }, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/finalTimeout/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/finalTimeout/test.ts index 9983809f9947..8ea2ea1ca842 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/finalTimeout/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/finalTimeout/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../../utils/helpers'; import { getSpanOp, waitForStreamedSpan } from '../../../../../utils/spanUtils'; @@ -25,10 +21,10 @@ sentryTest( const spanDurationSeconds = pageloadSpan.end_timestamp - pageloadSpan.start_timestamp; expect(pageloadSpan.attributes).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: expect.objectContaining({ value: 1 }), [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'pageload' }, + [SENTRY_OP]: { type: 'string', value: 'pageload' }, 'sentry.idle_span_finish_reason': { type: 'string', value: 'finalTimeout' }, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/navigation/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/navigation/test.ts index e71f12c00993..db6f6737ccd6 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/navigation/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded-streamed/navigation/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../../utils/helpers'; import { getSpanOp, waitForStreamedSpan } from '../../../../../utils/spanUtils'; @@ -25,10 +21,10 @@ sentryTest( const spanDurationSeconds = pageloadSpan.end_timestamp - pageloadSpan.start_timestamp; expect(pageloadSpan.attributes).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: expect.objectContaining({ value: 1 }), [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'pageload' }, + [SENTRY_OP]: { type: 'string', value: 'pageload' }, 'sentry.idle_span_finish_reason': { type: 'string', value: 'cancelled' }, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/default/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/default/test.ts index 9c8c0b48fb69..bca0d6052b95 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/default/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/default/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; @@ -27,10 +23,10 @@ sentryTest( const spanDurationSeconds = eventData.timestamp! - eventData.start_timestamp!; expect(traceContextData).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'reportPageLoaded', }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/finalTimeout/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/finalTimeout/test.ts index 90deb74d0f2b..ae6ffdec21b3 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/finalTimeout/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/finalTimeout/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; @@ -27,10 +23,10 @@ sentryTest( const spanDurationSeconds = eventData.timestamp! - eventData.start_timestamp!; expect(traceContextData).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'finalTimeout', }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/navigation/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/navigation/test.ts index 6b0bf8ceb8b8..9e947592a576 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/navigation/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/reportPageLoaded/navigation/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; @@ -27,10 +23,10 @@ sentryTest( const spanDurationSeconds = eventData.timestamp! - eventData.start_timestamp!; expect(traceContextData).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'cancelled', }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/interactions/spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/interactions/spans/test.ts index d0d3231f622d..58d2b6b332f1 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/interactions/spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/interactions/spans/test.ts @@ -2,8 +2,6 @@ import { expect } from '@playwright/test'; import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, } from '@sentry/core'; import { @@ -16,6 +14,8 @@ import { SENTRY_TRACE_LIFECYCLE, USER_AGENT_ORIGINAL, URL_PATH, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -80,11 +80,11 @@ sentryTest('captures streamed interaction span tree. @firefox', async ({ browser type: 'string', value: 'idleTimeout', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'ui.action.click', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.browser.interactions', }, @@ -137,7 +137,7 @@ sentryTest('captures streamed interaction span tree. @firefox', async ({ browser type: 'string', value: 'stream', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'ui.interaction.click', }, @@ -145,7 +145,7 @@ sentryTest('captures streamed interaction span tree. @firefox', async ({ browser type: 'string', value: expect.any(String), }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.browser.interactions', }, diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts index 12e3861db87f..276234385fae 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts @@ -1,6 +1,7 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; -import { type Event, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { type Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -95,8 +96,8 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU 'http.request.time_to_first_byte': expect.any(Number), 'network.protocol.name': '', 'network.protocol.version': 'unknown', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.img', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_OP]: 'resource.img', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'sentry-test-site.example', 'url.domain': 'sentry-test-site.example', 'http.request.same_origin': false, @@ -148,8 +149,8 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU 'http.request.time_to_first_byte': expect.any(Number), 'network.protocol.name': '', 'network.protocol.version': 'unknown', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.link', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_OP]: 'resource.link', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'sentry-test-site.example', 'url.domain': 'sentry-test-site.example', 'http.request.same_origin': false, diff --git a/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan/test.ts b/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan/test.ts index cb73392fce05..0f8954d02090 100644 --- a/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan/test.ts @@ -1,8 +1,6 @@ import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, @@ -14,6 +12,8 @@ import { SENTRY_SEGMENT_ID, SENTRY_SEGMENT_NAME, SENTRY_TRACE_LIFECYCLE, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { createRunner } from '../../../runner'; @@ -80,7 +80,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa attributes: { 'sentry.is_localhost': { value: true, type: 'boolean' }, [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'test-child', }, @@ -89,7 +89,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, }, name: 'test-child-span', @@ -108,7 +108,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa attributes: { 'sentry.is_localhost': { value: true, type: 'boolean' }, [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, @@ -145,7 +145,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa attributes: { 'sentry.is_localhost': { value: true, type: 'boolean' }, [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, @@ -167,13 +167,13 @@ it('sends a streamed span envelope with correct spans for a manually started spa attributes: { 'sentry.is_localhost': { value: true, type: 'boolean' }, [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test' }, + [SENTRY_OP]: { type: 'string', value: 'test' }, [SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, }, name: 'test-span', @@ -197,10 +197,10 @@ it('sends a streamed span envelope with correct spans for a manually started spa value: expect.arrayContaining(['SpanStreaming']), }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.http.cloudflare' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.http.cloudflare' }, [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'http.server' }, + [SENTRY_OP]: { type: 'string', value: 'http.server' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'route' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts index 5b301a9f29ae..c6a5940c1c5a 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts @@ -1,17 +1,14 @@ import { expect, it } from 'vitest'; import type { Envelope, SerializedStreamedSpan } from '@sentry/core'; -import { - SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '@sentry/core'; +import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT } from '@sentry/core'; import { SENTRY_SDK_NAME, SENTRY_SDK_VERSION, SENTRY_SEGMENT_ID, SENTRY_SEGMENT_NAME, SENTRY_TRACE_LIFECYCLE, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { createRunner } from '../../../runner'; import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils'; @@ -39,8 +36,8 @@ function commonAttributes(segmentSpan: SerializedStreamedSpan): SerializedStream [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpan.span_id }, [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentSpan.name }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'db.query' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.d1' }, + [SENTRY_OP]: { type: 'string', value: 'db.query' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.d1' }, 'db.system.name': { type: 'string', value: 'cloudflare-d1' }, }; } diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts index e9feaa6215f4..1f8e514601a8 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts @@ -1,5 +1,5 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Envelope } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { expect, it } from 'vitest'; import { createRunner } from '../../../runner'; import { getSpansFromEnvelope } from '../../../spanUtils'; @@ -23,7 +23,7 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal expect(segmentSpan?.attributes['url.path']).toEqual({ type: 'string', value: '/exec' }); const sqlSpans = spans.filter( - span => span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value === 'auto.db.cloudflare.durable_object.sql', + span => span.attributes[SENTRY_ORIGIN]?.value === 'auto.db.cloudflare.durable_object.sql', ); expect(sqlSpans).toHaveLength(3); @@ -32,8 +32,8 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal expect.objectContaining({ name: 'CREATE TABLE users', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'db.query' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object.sql' }, + [SENTRY_OP]: { type: 'string', value: 'db.query' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object.sql' }, 'db.system.name': { type: 'string', value: 'cloudflare-durable-object-sql' }, 'db.operation.name': { type: 'string', value: 'exec' }, 'db.query.text': { diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts index 1051890b8f94..ddbfc897054e 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts @@ -1,6 +1,6 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Envelope } from '@sentry/core'; import { expect, it } from 'vitest'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { createRunner } from '../../../runner'; import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils'; @@ -29,8 +29,8 @@ it('instruments sync KV operations on Durable Object storage', async ({ signal } expect.objectContaining({ name: 'durable_object_storage_kv_put', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'db' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object' }, + [SENTRY_OP]: { type: 'string', value: 'db' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object' }, 'db.system.name': { type: 'string', value: 'cloudflare-durable-object-sql' }, 'db.operation.name': { type: 'string', value: 'put' }, }), diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts index 6cb7888217b0..f894df8a361d 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts @@ -1,11 +1,7 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import type { Event } from '@sentry/core'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { createRunner } from '../../../runner'; import { getSpansFromEnvelope } from '../../../spanUtils'; @@ -24,8 +20,8 @@ it('Scheduled handler creates a segment span with correct attributes', async ({ is_segment: true, status: 'ok', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'function' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.scheduled' }, + [SENTRY_OP]: { type: 'string', value: 'function' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.scheduled' }, [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'task' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, 'code.function.name': { type: 'string', value: 'scheduled' }, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts index f54038aaa714..86bcab0fb7ce 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts @@ -1,10 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { createRunner } from '../../../runner'; it('Workflow steps create segment spans with correct attributes', async ({ signal }) => { @@ -28,8 +24,8 @@ it('Workflow steps create segment spans with correct attributes', async ({ signa is_segment: true, status: 'ok', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'function' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.workflow' }, + [SENTRY_OP]: { type: 'string', value: 'function' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.workflow' }, [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'task' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, 'code.function.name': { type: 'string', value: stepName }, diff --git a/dev-packages/e2e-tests/test-applications/angular-19/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-19/tests/performance.test.ts index 2abfce92b545..600d768f2339 100644 --- a/dev-packages/e2e-tests/test-applications/angular-19/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-19/tests/performance.test.ts @@ -1,7 +1,5 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -// Cannot use @sentry/angular here due to build stuff -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; // The `angular-19 (streamed)` variant builds the app with `traceLifecycle: 'stream'`, which emits // spans instead of transactions. See `streamed-performance.test.ts` for that variant. @@ -257,7 +255,7 @@ test.describe('TraceDirective', () => { const [_, navigationTxn] = await Promise.all([page.locator('#componentTracking').click(), navigationTxnPromise]); const traceDirectiveSpans = navigationTxn.spans?.filter( - span => span?.data && span?.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.ui.angular.trace_directive', + span => span?.data && span?.data['sentry.origin'] === 'auto.ui.angular.trace_directive', ); expect(traceDirectiveSpans).toHaveLength(2); @@ -265,8 +263,8 @@ test.describe('TraceDirective', () => { expect.arrayContaining([ expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.mount', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', + ['sentry.op']: 'ui.mount', + ['sentry.origin']: 'auto.ui.angular.trace_directive', 'ui.component_name': 'sample-component', }, description: '', // custom component name passed to trace directive @@ -277,8 +275,8 @@ test.describe('TraceDirective', () => { }), expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.mount', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', + ['sentry.op']: 'ui.mount', + ['sentry.origin']: 'auto.ui.angular.trace_directive', 'ui.component_name': 'app-sample-component', }, description: '', // fallback selector name @@ -304,15 +302,15 @@ test.describe('TraceClass Decorator', () => { const [_, navigationTxn] = await Promise.all([page.locator('#componentTracking').click(), navigationTxnPromise]); const classDecoratorSpan = navigationTxn.spans?.find( - span => span?.data && span?.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.ui.angular.trace_class_decorator', + span => span?.data && span?.data['sentry.origin'] === 'auto.ui.angular.trace_class_decorator', ); expect(classDecoratorSpan).toBeDefined(); expect(classDecoratorSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.mount', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', + ['sentry.op']: 'ui.mount', + ['sentry.origin']: 'auto.ui.angular.trace_class_decorator', 'ui.component_name': 'ComponentTrackingComponent', }, description: '', @@ -344,8 +342,8 @@ test.describe('TraceMethod Decorator', () => { expect(ngInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', + ['sentry.op']: 'function', + ['sentry.origin']: 'auto.ui.angular.trace_method_decorator', 'code.function.name': 'ngOnInit', }, description: '', @@ -375,8 +373,8 @@ test.describe('TraceMethod Decorator', () => { expect(ngAfterViewInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', + ['sentry.op']: 'function', + ['sentry.origin']: 'auto.ui.angular.trace_method_decorator', 'code.function.name': 'ngAfterViewInit', }, description: '', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/cache.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/cache.test.ts index d8ad57bca377..2d0c8ce86cf9 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/cache.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/cache.test.ts @@ -1,6 +1,5 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Cache Instrumentation', () => { const SEMANTIC_ATTRIBUTE_CACHE_KEY = 'cache.key'; @@ -24,9 +23,7 @@ test.describe('Cache Instrumentation', () => { }; // Test that we have cache operations from cachedFunction and cachedEventHandler - const allCacheSpans = transaction.spans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.cache.nuxt', - ); + const allCacheSpans = transaction.spans?.filter(span => span.data?.['sentry.origin'] === 'auto.cache.nuxt'); expect(allCacheSpans?.length).toBeGreaterThan(0); // Test getItem spans for cachedFunction - should have both cache miss and cache hit @@ -42,8 +39,8 @@ test.describe('Cache Instrumentation', () => { ); if (cacheMissSpan) { expect(cacheMissSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.get', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: false, 'db.operation.name': 'getItem', 'db.collection.name': expect.stringMatching(/^(cache)?$/), @@ -59,8 +56,8 @@ test.describe('Cache Instrumentation', () => { ); if (cacheHitSpan) { expect(cacheHitSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.get', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'getItem', 'db.collection.name': expect.stringMatching(/^(cache)?$/), @@ -78,8 +75,8 @@ test.describe('Cache Instrumentation', () => { ); if (cacheSetSpan) { expect(cacheSetSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.put', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.put', + ['sentry.origin']: 'auto.cache.nuxt', 'db.operation.name': 'setItem', 'db.collection.name': expect.stringMatching(/^(cache)?$/), }); @@ -125,18 +122,16 @@ test.describe('Cache Instrumentation', () => { const transaction1 = await transactionPromise; // Get all cache-related spans - const allCacheSpans = transaction1.spans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.cache.nuxt', - ); + const allCacheSpans = transaction1.spans?.filter(span => span.data?.['sentry.origin'] === 'auto.cache.nuxt'); // We should have cache operations expect(allCacheSpans?.length).toBeGreaterThan(0); // Get all getItem operations - const allGetItemSpans = allCacheSpans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.get'); + const allGetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.get'); // Get all setItem operations - const allSetItemSpans = allCacheSpans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.put'); + const allSetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.put'); // We should have both get and set operations expect(allGetItemSpans?.length).toBeGreaterThan(0); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/storage-aliases.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/storage-aliases.test.ts index ee1950050482..163c2c4fbe8f 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/storage-aliases.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/storage-aliases.test.ts @@ -1,6 +1,5 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Storage Instrumentation - Aliases', () => { const prefixKey = (key: string) => `test-storage:${key}`; @@ -28,8 +27,8 @@ test.describe('Storage Instrumentation - Aliases', () => { const setSpan = setSpans.find(span => span.data?.[SEMANTIC_ATTRIBUTE_CACHE_KEY] === prefixKey('alias:user')); expect(setSpan).toBeDefined(); expect(setSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.put', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.put', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), 'db.operation.name': 'setItem', 'db.collection.name': 'test-storage', @@ -43,8 +42,8 @@ test.describe('Storage Instrumentation - Aliases', () => { const getSpan = getSpans.find(span => span.data?.[SEMANTIC_ATTRIBUTE_CACHE_KEY] === prefixKey('alias:user')); expect(getSpan).toBeDefined(); expect(getSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.get', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'getItem', @@ -59,8 +58,8 @@ test.describe('Storage Instrumentation - Aliases', () => { const hasSpan = hasSpans.find(span => span.data?.[SEMANTIC_ATTRIBUTE_CACHE_KEY] === prefixKey('alias:user')); expect(hasSpan).toBeDefined(); expect(hasSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.get', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'hasItem', @@ -75,8 +74,8 @@ test.describe('Storage Instrumentation - Aliases', () => { const delSpan = removeSpans.find(span => span.data?.[SEMANTIC_ATTRIBUTE_CACHE_KEY] === prefixKey('alias:temp1')); expect(delSpan).toBeDefined(); expect(delSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.remove', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.remove', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp1'), 'db.operation.name': 'removeItem', 'db.collection.name': 'test-storage', @@ -87,8 +86,8 @@ test.describe('Storage Instrumentation - Aliases', () => { const removeSpan = removeSpans.find(span => span.data?.[SEMANTIC_ATTRIBUTE_CACHE_KEY] === prefixKey('alias:temp2')); expect(removeSpan).toBeDefined(); expect(removeSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.remove', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.remove', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp2'), 'db.operation.name': 'removeItem', 'db.collection.name': 'test-storage', @@ -97,9 +96,7 @@ test.describe('Storage Instrumentation - Aliases', () => { expect(removeSpan?.description).toBe(prefixKey('alias:temp2')); // Verify all spans have OK status - const allStorageSpans = transaction.spans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.cache.nuxt', - ); + const allStorageSpans = transaction.spans?.filter(span => span.data?.['sentry.origin'] === 'auto.cache.nuxt'); expect(allStorageSpans?.length).toBeGreaterThan(0); allStorageSpans?.forEach(span => { expect(span.status).toBe('ok'); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/storage.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/storage.test.ts index b4138a8eb6e8..0e4c7b635082 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/storage.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/storage.test.ts @@ -1,6 +1,5 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Storage Instrumentation', () => { const prefixKey = (key: string) => `test-storage:${key}`; @@ -28,8 +27,8 @@ test.describe('Storage Instrumentation', () => { const setItemSpan = setItemSpans.find(span => span.data?.[SEMANTIC_ATTRIBUTE_CACHE_KEY] === prefixKey('user:123')); expect(setItemSpan).toBeDefined(); expect(setItemSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.put', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.put', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), 'db.operation.name': 'setItem', 'db.collection.name': 'test-storage', @@ -45,8 +44,8 @@ test.describe('Storage Instrumentation', () => { ); expect(setItemRawSpan).toBeDefined(); expect(setItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.put', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.put', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), 'db.operation.name': 'setItemRaw', 'db.collection.name': 'test-storage', @@ -59,8 +58,8 @@ test.describe('Storage Instrumentation', () => { const hasItemSpan = hasItemSpans.find(span => span.data?.[SEMANTIC_ATTRIBUTE_CACHE_KEY] === prefixKey('user:123')); expect(hasItemSpan).toBeDefined(); expect(hasItemSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.get', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'hasItem', @@ -74,8 +73,8 @@ test.describe('Storage Instrumentation', () => { const getItemSpan = getItemSpans.find(span => span.data?.[SEMANTIC_ATTRIBUTE_CACHE_KEY] === prefixKey('user:123')); expect(getItemSpan).toBeDefined(); expect(getItemSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.get', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'getItem', @@ -92,8 +91,8 @@ test.describe('Storage Instrumentation', () => { ); expect(getItemRawSpan).toBeDefined(); expect(getItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.get', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'getItemRaw', @@ -105,8 +104,8 @@ test.describe('Storage Instrumentation', () => { const getKeysSpans = findSpansByMethod('getKeys'); expect(getKeysSpans.length).toBeGreaterThanOrEqual(1); expect(getKeysSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.get', + ['sentry.origin']: 'auto.cache.nuxt', 'db.operation.name': 'getKeys', 'db.collection.name': 'test-storage', 'db.system.name': 'memory', @@ -120,8 +119,8 @@ test.describe('Storage Instrumentation', () => { ); expect(removeItemSpan).toBeDefined(); expect(removeItemSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.remove', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.remove', + ['sentry.origin']: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('batch:1'), 'db.operation.name': 'removeItem', 'db.collection.name': 'test-storage', @@ -132,17 +131,15 @@ test.describe('Storage Instrumentation', () => { const clearSpans = findSpansByMethod('clear'); expect(clearSpans.length).toBeGreaterThanOrEqual(1); expect(clearSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.remove', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + ['sentry.op']: 'cache.remove', + ['sentry.origin']: 'auto.cache.nuxt', 'db.operation.name': 'clear', 'db.collection.name': 'test-storage', 'db.system.name': 'memory', }); // Verify all spans have OK status - const allStorageSpans = transaction.spans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.cache.nuxt', - ); + const allStorageSpans = transaction.spans?.filter(span => span.data?.['sentry.origin'] === 'auto.cache.nuxt'); expect(allStorageSpans?.length).toBeGreaterThan(0); allStorageSpans?.forEach(span => { expect(span.status).toBe('ok'); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/tracing.server.test.ts index 2bc3c805f172..ffa3e5d2c1e9 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4-static/tests/tracing.server.test.ts @@ -1,6 +1,5 @@ import { expect, test } from '@playwright/test'; import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('nuxt-4-static', transactionEvent => { @@ -14,8 +13,8 @@ test('sends a server action transaction on pageload', async ({ page }) => { expect(transaction.contexts.trace).toEqual( expect.objectContaining({ data: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.http_server', + ['sentry.op']: 'http.server', + ['sentry.origin']: 'auto.http.http_server', }), }), ); diff --git a/dev-packages/e2e-tests/test-applications/solidstart-static/tests/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-static/tests/performance.server.test.ts index 7d15bbe3eba8..ad87026671c9 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-static/tests/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-static/tests/performance.server.test.ts @@ -1,6 +1,5 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart-static', transactionEvent => { @@ -16,8 +15,8 @@ test('sends a server action transaction on pageload', async ({ page }) => { expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', + ['sentry.op']: 'function', + ['sentry.origin']: 'auto.function.solidstart', 'code.function.name': 'getPrefecture', }, }), @@ -41,8 +40,8 @@ test('sends a server action transaction on client navigation', async ({ page }) expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', + ['sentry.op']: 'function', + ['sentry.origin']: 'auto.function.solidstart', 'code.function.name': 'getPrefecture', }, }), diff --git a/dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts b/dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts index a49710d6e560..f9829bdf94f6 100644 --- a/dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts +++ b/dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/node'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createCjsTests } from '../../utils/runner'; @@ -26,8 +26,8 @@ describe('fs instrumentation', () => { data: { 'error.type': 'ENOENT', path_argument: expect.stringMatching('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/fixtures/some-file-that-doesnt-exist.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -52,8 +52,8 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('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/fixtures/some-file.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -62,8 +62,8 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('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/fixtures/some-file-promises.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -72,8 +72,8 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -99,8 +99,8 @@ describe('fs instrumentation', () => { data: { src_argument: expect.stringMatching('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/fixtures/some-file.txt'), dest_argument: expect.stringMatching('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/fixtures/some-file.txt.copy'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -110,8 +110,8 @@ describe('fs instrumentation', () => { data: { src_argument: expect.stringMatching('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/fixtures/some-file-promises.txt'), dest_argument: expect.stringMatching('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/fixtures/some-file-promises.txt.copy'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -121,8 +121,8 @@ describe('fs instrumentation', () => { data: { src_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt'), dest_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt.copy'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -148,8 +148,8 @@ describe('fs instrumentation', () => { data: { existing_path_argument: expect.stringMatching('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/fixtures/some-file.txt'), new_path_argument: expect.stringMatching('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/fixtures/some-file.txt.link'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -159,8 +159,8 @@ describe('fs instrumentation', () => { data: { existing_path_argument: expect.stringMatching('/some-file-promises.txt'), new_path_argument: expect.stringMatching('/some-file-promises.txt.link'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -170,8 +170,8 @@ describe('fs instrumentation', () => { data: { existing_path_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt'), new_path_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt.link'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -196,8 +196,8 @@ describe('fs instrumentation', () => { status: 'ok', data: { prefix_argument: expect.stringMatching('/foo-'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -206,8 +206,8 @@ describe('fs instrumentation', () => { status: 'ok', data: { prefix_argument: expect.stringMatching('/foo-'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -216,8 +216,8 @@ describe('fs instrumentation', () => { status: 'ok', data: { prefix_argument: expect.stringMatching('/foo-'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -243,8 +243,8 @@ describe('fs instrumentation', () => { data: { target_argument: expect.stringMatching('/some-file-promisify.txt'), path_argument: expect.stringMatching('/some-file-promisify.txt.symlink'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -254,8 +254,8 @@ describe('fs instrumentation', () => { data: { target_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt'), path_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt.symlink'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -265,8 +265,8 @@ describe('fs instrumentation', () => { data: { target_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt'), path_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt.symlink'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -291,8 +291,8 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('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/fixtures/some-file.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), expect.objectContaining({ @@ -301,8 +301,8 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('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/fixtures/some-file-promisify.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -338,8 +338,8 @@ describe('fs instrumentation', () => { // `path_argument` is recorded, but `error.type` is NOT, since `recordErrorMessagesAsSpanAttributes` is off data: { path_argument: expect.stringMatching('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/fixtures/some-file-that-doesnt-exist.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -375,8 +375,8 @@ describe('fs instrumentation', () => { // `error.type` is recorded, but `path_argument` is NOT, since `recordFilePaths` is off data: { 'error.type': 'ENOENT', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), @@ -401,8 +401,8 @@ describe('fs instrumentation', () => { status: 'ok', // Neither `path_argument` nor `error.type` are recorded data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', + [SENTRY_OP]: 'file', + [SENTRY_ORIGIN]: 'auto.file.fs', }, }), ]), diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts index 1d2bd3cd8bfc..618fdb87988b 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts @@ -1,8 +1,6 @@ import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, @@ -14,6 +12,8 @@ import { SENTRY_SDK_NAME, SENTRY_SDK_VERSION, SENTRY_TRACE_LIFECYCLE, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { expect, test } from 'vitest'; import { createRunner } from '../../../../utils/runner'; @@ -60,7 +60,7 @@ test('sends a streamed span envelope with correct spans for a manually started s attributes: { [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, 'sentry.is_localhost': { type: 'boolean', value: false }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'test-child', }, @@ -70,7 +70,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, }, name: 'test-child-span', is_segment: false, @@ -94,7 +94,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, }, links: [ { @@ -131,7 +131,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, }, name: 'test-manual-span', is_segment: false, @@ -146,7 +146,7 @@ test('sends a streamed span envelope with correct spans for a manually started s const expectedAttributes: Record = { [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, 'sentry.is_localhost': { type: 'boolean', value: false }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test' }, + [SENTRY_OP]: { type: 'string', value: 'test' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, [SENTRY_SDK_NAME]: { type: 'string', value: EXPECTED_SDK_NAME }, [SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, @@ -158,7 +158,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'custom' }, 'process.runtime.engine.name': { type: 'string', value: 'v8' }, 'process.runtime.engine.version': { type: 'string', value: expect.any(String) }, diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-route/scenario.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-route/scenario.ts index 4d67fee0a0d2..83f987a0cfdf 100644 --- a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-route/scenario.ts +++ b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-route/scenario.ts @@ -1,4 +1,4 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -17,7 +17,7 @@ Sentry.startSpan( attributes: { 'http.request.method': 'GET', 'http.route': '/route', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }, }, diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/scenario.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/scenario.ts index 69b76f248555..4c46fe4bcd9e 100644 --- a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/scenario.ts +++ b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/scenario.ts @@ -1,4 +1,4 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -17,7 +17,7 @@ Sentry.startSpan( attributes: { 'http.request.method': 'GET', 'http.route': '/route', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }, diff --git a/dev-packages/node-integration-tests/suites/tracing/groq/test.ts b/dev-packages/node-integration-tests/suites/tracing/groq/test.ts index 5797f38d2d1b..ab5271d177ba 100644 --- a/dev-packages/node-integration-tests/suites/tracing/groq/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/groq/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { GEN_AI_EMBEDDINGS_INPUT, GEN_AI_INPUT_MESSAGES, @@ -15,6 +14,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -37,8 +38,8 @@ describe('Groq integration', () => { expect(chatSpan!.name).toBe('chat llama-3.3-70b-versatile'); expect(chatSpan!.status).toBe('ok'); expect(chatSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value).toBe('gen_ai.chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(chatSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.chat'); + expect(chatSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(chatSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(chatSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('llama-3.3-70b-versatile'); expect(chatSpan!.attributes[GEN_AI_REQUEST_TEMPERATURE]?.value).toBe(0.7); @@ -70,7 +71,7 @@ describe('Groq integration', () => { expect(embeddingsSpan).toBeDefined(); expect(embeddingsSpan!.name).toBe('embeddings nomic-embed-text-v1_5'); expect(embeddingsSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('embeddings'); - expect(embeddingsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value).toBe('gen_ai.embeddings'); + expect(embeddingsSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.embeddings'); expect(embeddingsSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(embeddingsSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS]?.value).toBe(8); expect(embeddingsSpan!.attributes[GEN_AI_EMBEDDINGS_INPUT]).toBeUndefined(); @@ -88,7 +89,7 @@ describe('Groq integration', () => { 'embeddings nomic-embed-text-v1_5', ]); for (const span of rawSpans) { - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(span.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(span.attributes[GEN_AI_RESPONSE_MODEL]).toBeUndefined(); expect(span.attributes[GEN_AI_USAGE_TOTAL_TOKENS]).toBeUndefined(); expect(span.attributes[GEN_AI_RESPONSE_TEXT]).toBeUndefined(); diff --git a/dev-packages/node-integration-tests/suites/tracing/ignoreSpans-streamed/children/test.ts b/dev-packages/node-integration-tests/suites/tracing/ignoreSpans-streamed/children/test.ts index c1ac1f7fc4a6..fefa45353102 100644 --- a/dev-packages/node-integration-tests/suites/tracing/ignoreSpans-streamed/children/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/ignoreSpans-streamed/children/test.ts @@ -1,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; describe('filtering child spans with ignoreSpans (streaming)', () => { afterAll(() => { @@ -28,9 +28,7 @@ describe('filtering child spans with ignoreSpans (streaming)', () => { // Would be 7 if we didn't ignore the 'middleware - expressInit' and 'custom-to-drop' spans expect(container.items).toHaveLength(8); const getSpan = (name: string, op: string) => - container.items.find( - item => item.name === name && item.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value === op, - ); + container.items.find(item => item.name === name && item.attributes[SENTRY_OP]?.value === op); const queryMiddlewareSpan = getSpan('query', 'middleware'); const corsMiddlewareSpan = getSpan('corsMiddleware', 'middleware'); const requestHandlerSpan = getSpan('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/test/express', 'handler'); diff --git a/dev-packages/node-integration-tests/suites/tracing/langgraph/test.ts b/dev-packages/node-integration-tests/suites/tracing/langgraph/test.ts index 3f85267b154e..92b94bf07853 100644 --- a/dev-packages/node-integration-tests/suites/tracing/langgraph/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/langgraph/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_AGENT_NAME, @@ -15,6 +14,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { getStringAttributeValue } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -274,8 +275,8 @@ describe('LangGraph integration', () => { status: 'ok', attributes: expect.objectContaining({ [GEN_AI_OPERATION_NAME]: expect.objectContaining({ value: 'invoke_agent' }), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.invoke_agent' }), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: expect.objectContaining({ value: 'auto.ai.langgraph' }), + [SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.invoke_agent' }), + [SENTRY_ORIGIN]: expect.objectContaining({ value: 'auto.ai.langgraph' }), [GEN_AI_AGENT_NAME]: expect.objectContaining({ value: 'helpful_assistant' }), [GEN_AI_PIPELINE_NAME]: expect.objectContaining({ value: 'helpful_assistant' }), }), @@ -284,7 +285,7 @@ describe('LangGraph integration', () => { expect(spans).toContainEqual( expect.objectContaining({ attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.chat' }), + [SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.chat' }), [GEN_AI_AGENT_NAME]: expect.objectContaining({ value: 'helpful_assistant' }), }), }), @@ -314,7 +315,7 @@ describe('LangGraph integration', () => { expect.objectContaining({ status: 'ok', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.invoke_agent' }), + [SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.invoke_agent' }), [GEN_AI_OPERATION_NAME]: expect.objectContaining({ value: 'invoke_agent' }), [GEN_AI_AGENT_NAME]: expect.objectContaining({ value: 'math_assistant' }), }), @@ -325,7 +326,7 @@ describe('LangGraph integration', () => { name: 'execute_tool add', status: 'ok', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.execute_tool' }), + [SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.execute_tool' }), [GEN_AI_OPERATION_NAME]: expect.objectContaining({ value: 'execute_tool' }), [GEN_AI_TOOL_NAME]: expect.objectContaining({ value: 'add' }), }), @@ -336,15 +337,13 @@ describe('LangGraph integration', () => { name: 'execute_tool multiply', status: 'ok', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.execute_tool' }), + [SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.execute_tool' }), [GEN_AI_OPERATION_NAME]: expect.objectContaining({ value: 'execute_tool' }), [GEN_AI_TOOL_NAME]: expect.objectContaining({ value: 'multiply' }), }), }), ); - expect( - spans.filter(span => span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value === 'gen_ai.chat'), - ).toHaveLength(3); + expect(spans.filter(span => span.attributes[SENTRY_OP]?.value === 'gen_ai.chat')).toHaveLength(3); }, }) .start() @@ -362,9 +361,7 @@ describe('LangGraph integration', () => { }) .expect({ span: container => { - const chatSpans = container.items.filter( - s => s.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value === 'gen_ai.chat', - ); + const chatSpans = container.items.filter(s => s.attributes[SENTRY_OP]?.value === 'gen_ai.chat'); expect(chatSpans).toHaveLength(1); expect(chatSpans[0]?.attributes[GEN_AI_AGENT_NAME]?.value).toBe('plain_assistant'); }, diff --git a/dev-packages/node-integration-tests/suites/tracing/mistral/test.ts b/dev-packages/node-integration-tests/suites/tracing/mistral/test.ts index 49fe09771da1..1b1e91310beb 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mistral/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mistral/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { GEN_AI_AGENT_NAME, GEN_AI_EMBEDDINGS_INPUT, @@ -20,6 +19,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmTests } from '../../../utils/runner'; @@ -47,8 +48,8 @@ describe('Mistral integration', () => { expect(chatSpan!.name).toBe('chat mistral-small-latest'); expect(chatSpan!.status).toBe('ok'); expect(chatSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value).toBe('gen_ai.chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(chatSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.chat'); + expect(chatSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(chatSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(chatSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('mistral-small-latest'); expect(chatSpan!.attributes[GEN_AI_REQUEST_TEMPERATURE]?.value).toBe(0.7); @@ -140,8 +141,8 @@ describe('Mistral integration', () => { expect(embeddingsSpan!.name).toBe('embeddings mistral-embed'); expect(embeddingsSpan!.status).toBe('ok'); expect(embeddingsSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('embeddings'); - expect(embeddingsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value).toBe('gen_ai.embeddings'); - expect(embeddingsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(embeddingsSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.embeddings'); + expect(embeddingsSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(embeddingsSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(embeddingsSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('mistral-embed'); expect(embeddingsSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS]?.value).toBe(8); @@ -183,8 +184,8 @@ describe('Mistral integration', () => { expect(agentSpan!.name).toBe('invoke_agent'); expect(agentSpan!.status).toBe('ok'); expect(agentSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('invoke_agent'); - expect(agentSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); - expect(agentSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(agentSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); + expect(agentSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(agentSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(agentSpan!.attributes[GEN_AI_AGENT_NAME]?.value).toBe('ag-mock-123'); expect(agentSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS]?.value).toBe(10); @@ -262,7 +263,7 @@ describe('Mistral integration', () => { expect(chatSpan).toBeDefined(); expect(chatSpan!.name).toBe('chat mistral-small-latest'); expect(chatSpan!.status).toBe('ok'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(chatSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(chatSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(chatSpan!.attributes[GEN_AI_RESPONSE_TEXT]?.value).toBe('["Hello from the manual client!"]'); @@ -297,7 +298,7 @@ describe('Mistral integration', () => { expect(parseSpans[0]!.name).toBe('chat mistral-small-latest'); expect(parseSpans[0]!.status).toBe('ok'); expect(parseSpans[0]!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('chat'); - expect(parseSpans[0]!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(parseSpans[0]!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(parseSpans[0]!.attributes[GEN_AI_REQUEST_STREAM]?.value).toBe(false); expect(parseSpans[0]!.attributes[GEN_AI_USAGE_TOTAL_TOKENS]?.value).toBe(12); diff --git a/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts b/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts index 2188dd49f356..e0db6de0be75 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts @@ -3,8 +3,7 @@ import { afterAll, beforeAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createCjsTests, createEsmAndCjsTests } from '../../../utils/runner'; import { startMysqlTestServer } from './mysql-test-server'; import type { SerializedStreamedSpanContainer } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; -import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; +import { SENTRY_TRACE_LIFECYCLE, SENTRY_OP } from '@sentry/conventions/attributes'; describe('mysql auto instrumentation', () => { // A minimal in-process MySQL server (on a random free port) so the client's @@ -176,9 +175,7 @@ describe('mysql auto instrumentation', () => { const segmentSpan = container.items.find(item => item.is_segment); expect(segmentSpan?.name).toBe('Test Transaction'); - const dbSpans = container.items.filter( - spanItem => spanItem.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value === 'db', - ); + const dbSpans = container.items.filter(spanItem => spanItem.attributes[SENTRY_OP]?.value === 'db'); expect(dbSpans.length).toBe(2); diff --git a/dev-packages/node-integration-tests/suites/tracing/openai/openai-tool-calls/test.ts b/dev-packages/node-integration-tests/suites/tracing/openai/openai-tool-calls/test.ts index 89bf6c7b0544..5dfd13c21f7f 100644 --- a/dev-packages/node-integration-tests/suites/tracing/openai/openai-tool-calls/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/openai/openai-tool-calls/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES, @@ -15,6 +14,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; @@ -92,11 +93,11 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'chat', }); - expect(chatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatToolsSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -142,11 +143,11 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'chat', }); - expect(streamingChatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingChatToolsSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -202,11 +203,11 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'chat', }); - expect(responsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(responsesToolsSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(responsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -255,11 +256,11 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'chat', }); - expect(streamingResponsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingResponsesToolsSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -328,11 +329,11 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'chat', }); - expect(chatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatToolsSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -392,11 +393,11 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'chat', }); - expect(streamingChatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingChatToolsSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -463,11 +464,11 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'chat', }); - expect(responsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(responsesToolsSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(responsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -527,11 +528,11 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'chat', }); - expect(streamingResponsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingResponsesToolsSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); diff --git a/dev-packages/node-integration-tests/suites/tracing/openai/test.ts b/dev-packages/node-integration-tests/suites/tracing/openai/test.ts index a27e3308179a..2da282ebabb4 100644 --- a/dev-packages/node-integration-tests/suites/tracing/openai/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/openai/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type { SerializedStreamedSpanContainer } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { @@ -18,6 +17,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_DIMENSIONS_ATTRIBUTE, @@ -50,11 +51,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -107,11 +108,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -157,11 +158,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -184,11 +185,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -247,11 +248,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -319,11 +320,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'openai', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -340,11 +341,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -393,11 +394,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -466,11 +467,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -535,11 +536,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -593,11 +594,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -624,11 +625,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -699,11 +700,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -783,11 +784,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'openai', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -804,11 +805,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -866,11 +867,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1019,11 +1020,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1064,11 +1065,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1093,11 +1094,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1140,11 +1141,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'embeddings', }); - expect(rawEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(rawEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(rawEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(rawEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1187,11 +1188,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1238,11 +1239,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1271,11 +1272,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1312,11 +1313,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'embeddings', }); - expect(rawEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(rawEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(rawEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(rawEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1360,8 +1361,8 @@ describe('OpenAI integration', () => { trace_id: expect.any(String), data: { [GEN_AI_OPERATION_NAME]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_OP]: 'gen_ai.chat', + [SENTRY_ORIGIN]: 'auto.ai.openai', [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_REQUEST_MODEL]: 'gpt-3.5-turbo', [GEN_AI_REQUEST_TEMPERATURE]: 0.7, @@ -1402,8 +1403,8 @@ describe('OpenAI integration', () => { trace_id: expect.any(String), data: { [GEN_AI_OPERATION_NAME]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_OP]: 'gen_ai.chat', + [SENTRY_ORIGIN]: 'auto.ai.openai', [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_REQUEST_MODEL]: 'gpt-3.5-turbo', [GEN_AI_REQUEST_TEMPERATURE]: 0.7, @@ -1446,11 +1447,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(conversationCreateSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(conversationCreateSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(conversationCreateSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(conversationCreateSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1475,11 +1476,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(conversationResponseSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(conversationResponseSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(conversationResponseSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(conversationResponseSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1498,12 +1499,12 @@ describe('OpenAI integration', () => { const unlinkedResponseSpan = container.items.find( span => - span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value === 'gen_ai.chat' && + span.attributes[SENTRY_OP]?.value === 'gen_ai.chat' && span.attributes[GEN_AI_CONVERSATION_ID] === undefined, ); expect(unlinkedResponseSpan).toBeDefined(); expect(unlinkedResponseSpan!.status).toBe('ok'); - expect(unlinkedResponseSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(unlinkedResponseSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); @@ -1518,11 +1519,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(previousResponseSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(previousResponseSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(previousResponseSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(previousResponseSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1549,11 +1550,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(rawConversationSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(rawConversationSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(rawConversationSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(rawConversationSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1749,11 +1750,11 @@ describe('OpenAI integration', () => { expect(chatCompletionSpan!.name).toBe('chat gpt-3.5-turbo'); expect(chatCompletionSpan!.status).toBe('ok'); expect(chatCompletionSpan!.attributes[GEN_AI_OPERATION_NAME]).toEqual({ type: 'string', value: 'chat' }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1779,11 +1780,11 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1809,11 +1810,11 @@ describe('OpenAI integration', () => { expect(parsedResponsesSpan!.name).toBe('chat gpt-4o'); expect(parsedResponsesSpan!.status).toBe('ok'); expect(parsedResponsesSpan!.attributes[GEN_AI_OPERATION_NAME]).toEqual({ type: 'string', value: 'chat' }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); diff --git a/dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts b/dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts index 091867486e4e..49d5cb48bd9d 100644 --- a/dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_EMBEDDINGS_INPUT, @@ -16,6 +15,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_DIMENSIONS_ATTRIBUTE, @@ -50,11 +51,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -105,11 +106,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -155,11 +156,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -182,11 +183,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -245,11 +246,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -317,11 +318,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'openai', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -359,11 +360,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -426,11 +427,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -484,11 +485,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -515,11 +516,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -590,11 +591,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -674,11 +675,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'openai', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -784,11 +785,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -829,11 +830,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -858,11 +859,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -924,11 +925,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -975,11 +976,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1008,11 +1009,11 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1075,8 +1076,8 @@ describe('OpenAI integration (V6)', () => { trace_id: expect.any(String), data: { [GEN_AI_OPERATION_NAME]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_OP]: 'gen_ai.chat', + [SENTRY_ORIGIN]: 'auto.ai.openai', [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_REQUEST_MODEL]: 'gpt-3.5-turbo', [GEN_AI_REQUEST_TEMPERATURE]: 0.7, @@ -1128,8 +1129,8 @@ describe('OpenAI integration (V6)', () => { trace_id: expect.any(String), data: { [GEN_AI_OPERATION_NAME]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_OP]: 'gen_ai.chat', + [SENTRY_ORIGIN]: 'auto.ai.openai', [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_REQUEST_MODEL]: 'gpt-3.5-turbo', [GEN_AI_REQUEST_TEMPERATURE]: 0.7, diff --git a/dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts b/dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts index 6d7eb552c219..fbea79d4f34c 100644 --- a/dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, expect } from 'vitest'; import { GEN_AI_OPERATION_NAME, @@ -11,6 +10,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; import { conditionalTest } from '../../../../utils/index'; @@ -44,11 +45,11 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => { expect(chatCompletionSpan).toBeDefined(); expect(chatCompletionSpan!.name).toBe('chat gpt-3.5-turbo'); expect(chatCompletionSpan!.status).toBe('ok'); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -96,7 +97,7 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => { const errorSpan = container.items.find(span => span.name === 'chat error-model' && span.status !== 'ok'); expect(errorSpan).toBeDefined(); - expect(errorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -135,11 +136,11 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => { span => span.name === 'embeddings text-embedding-3-small' && span.status === 'ok', ); expect(singleEmbeddingSpan).toBeDefined(); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -184,11 +185,11 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => { expect(chatCompletionSpan).toBeDefined(); expect(chatCompletionSpan!.name).toBe('chat gpt-3.5-turbo'); expect(chatCompletionSpan!.status).toBe('ok'); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); diff --git a/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts b/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts index 3a2cea4a4c74..bec779c70b02 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/test.ts @@ -1,6 +1,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; import type { SerializedStreamedSpanContainer } from '@sentry/core'; -import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; +import { SENTRY_TRACE_LIFECYCLE, SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { conditionalTest, EXPECTED_SDK_NAME } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -157,7 +156,7 @@ const CREATE_NATIVE_USER_TABLE_STATEMENT = 'CREATE TABLE "NativeUser" ("id" SERIAL NOT NULL,"createdAt" TIMESTAMP(?) NOT NULL DEFAULT CURRENT_TIMESTAMP,"email" TEXT NOT NULL,"name" TEXT,CONSTRAINT "User_pkey" PRIMARY KEY ("id"))'; function getDbSpans(container: SerializedStreamedSpanContainer): SerializedStreamedSpanContainer['items'] { - return container.items.filter(item => item.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value === 'db'); + return container.items.filter(item => item.attributes[SENTRY_OP]?.value === 'db'); } describeWithDockerCompose('postgres auto instrumentation (streamed)', { workingDirectory: [__dirname] }, () => { diff --git a/dev-packages/node-integration-tests/suites/tracing/redis/test.ts b/dev-packages/node-integration-tests/suites/tracing/redis/test.ts index 50cd473957b8..d8b8b728a2af 100644 --- a/dev-packages/node-integration-tests/suites/tracing/redis/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/redis/test.ts @@ -1,5 +1,5 @@ -import { SENTRY_TRACE_LIFECYCLE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, type SerializedStreamedSpanContainer } from '@sentry/core'; +import { SENTRY_TRACE_LIFECYCLE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { type SerializedStreamedSpanContainer } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { EXPECTED_SDK_NAME } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -136,9 +136,7 @@ describeWithDockerCompose('redis auto instrumentation', { workingDirectory: [__d const segmentSpan = container.items.find(item => item.is_segment); expect(segmentSpan?.name).toBe('Test Span'); - const dbSpans = container.items.filter( - item => item.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value === redisSpanOp, - ); + const dbSpans = container.items.filter(item => item.attributes[SENTRY_OP]?.value === redisSpanOp); expect(dbSpans).toEqual([ expectedDbSpan({ operation: 'set', statement: 'set test-key [1 other arguments]' }), diff --git a/dev-packages/node-integration-tests/suites/tracing/together-ai/test.ts b/dev-packages/node-integration-tests/suites/tracing/together-ai/test.ts index 2e7c3b94dc7b..1e912a358fc0 100644 --- a/dev-packages/node-integration-tests/suites/tracing/together-ai/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/together-ai/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { GEN_AI_EMBEDDINGS_INPUT, GEN_AI_INPUT_MESSAGES, @@ -15,6 +14,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -37,8 +38,8 @@ describe('Together integration', () => { expect(chatSpan!.name).toBe('chat meta-llama/Llama-3.3-70B-Instruct-Turbo'); expect(chatSpan!.status).toBe('ok'); expect(chatSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value).toBe('gen_ai.chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(chatSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.chat'); + expect(chatSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(chatSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(chatSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('meta-llama/Llama-3.3-70B-Instruct-Turbo'); expect(chatSpan!.attributes[GEN_AI_REQUEST_TEMPERATURE]?.value).toBe(0.7); @@ -70,7 +71,7 @@ describe('Together integration', () => { expect(embeddingsSpan).toBeDefined(); expect(embeddingsSpan!.name).toBe('embeddings togethercomputer/m2-bert-80M-8k-retrieval'); expect(embeddingsSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('embeddings'); - expect(embeddingsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value).toBe('gen_ai.embeddings'); + expect(embeddingsSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.embeddings'); expect(embeddingsSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(embeddingsSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS]?.value).toBe(8); expect(embeddingsSpan!.attributes[GEN_AI_EMBEDDINGS_INPUT]).toBeUndefined(); @@ -88,7 +89,7 @@ describe('Together integration', () => { 'embeddings togethercomputer/m2-bert-80M-8k-retrieval', ]); for (const span of rawSpans) { - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(span.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(span.attributes[GEN_AI_RESPONSE_MODEL]).toBeUndefined(); expect(span.attributes[GEN_AI_USAGE_TOTAL_TOKENS]).toBeUndefined(); expect(span.attributes[GEN_AI_RESPONSE_TEXT]).toBeUndefined(); diff --git a/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts b/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts index e4276d73a0dd..50385f0e0c40 100644 --- a/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES, @@ -14,6 +13,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; @@ -50,8 +51,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Second span - generate_content for simple generateText @@ -65,8 +66,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Third span - invoke_agent for explicit telemetry generateText @@ -79,8 +80,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Fourth span - tool call invoke_agent @@ -93,8 +94,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Fifth span - tool call generate_content @@ -107,8 +108,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Sixth span - execute_tool @@ -120,8 +121,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'), [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), ]), @@ -144,8 +145,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Second span - generate_content with input/output messages @@ -163,8 +164,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Third span - explicit telemetry invoke_agent with messages @@ -181,8 +182,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Fourth span - tool call invoke_agent with messages @@ -199,8 +200,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Fifth span - tool call generate_content with tool definitions @@ -216,8 +217,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Sixth span - execute_tool with description and input/output @@ -231,8 +232,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_TOOL_CALL_RESULT]: expect.objectContaining({ value: expect.any(String) }), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), ]), @@ -245,8 +246,8 @@ describe('Vercel AI integration (streaming v4)', () => { status: 'error', attributes: expect.objectContaining({ [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), expect.objectContaining({ @@ -258,8 +259,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), expect.objectContaining({ @@ -269,8 +270,8 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'), [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), ]), diff --git a/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts b/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts index 939ba08e9746..db4707374c4e 100644 --- a/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES, @@ -14,6 +13,8 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; @@ -47,8 +48,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Second span - generate_content for simple generateText @@ -62,8 +63,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Third span - invoke_agent for explicit telemetry generateText @@ -76,8 +77,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Fourth span - tool call invoke_agent @@ -90,8 +91,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Fifth span - tool call generate_content @@ -104,8 +105,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Sixth span - execute_tool @@ -117,8 +118,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'), [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_ORIGIN]: attr(origin), }), }), ]), @@ -141,8 +142,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Second span - generate_content with input/output messages @@ -160,8 +161,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Third span - explicit telemetry invoke_agent with messages @@ -178,8 +179,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Fourth span - tool call invoke_agent with messages (V6: no text part, only tool_call) @@ -196,8 +197,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Fifth span - tool call generate_content with tool definitions @@ -213,8 +214,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(origin), }), }), // Sixth span - execute_tool with description and input/output @@ -228,8 +229,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_TOOL_CALL_RESULT]: expect.objectContaining({ value: expect.any(String) }), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_ORIGIN]: attr(origin), }), }), ]), @@ -241,8 +242,8 @@ describe('Vercel AI integration (streaming, v6)', () => { name: 'invoke_agent', attributes: expect.objectContaining({ [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_ORIGIN]: attr(origin), }), }), expect.objectContaining({ @@ -254,8 +255,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_ORIGIN]: attr(origin), }), }), expect.objectContaining({ @@ -265,8 +266,8 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'), [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_ORIGIN]: attr(origin), }), }), ]), diff --git a/packages/angular/src/tracing.ts b/packages/angular/src/tracing.ts index 553da897f9e2..3a50bf232339 100644 --- a/packages/angular/src/tracing.ts +++ b/packages/angular/src/tracing.ts @@ -15,7 +15,6 @@ import { getClient, getCurrentScope, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, startBrowserTracingNavigationSpan, startInactiveSpan, @@ -30,6 +29,7 @@ import { URL_TEMPLATE, SENTRY_DESCRIPTION, UI_COMPONENT_NAME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, ROUTER } from '@sentry/conventions/op'; import type { Integration, Span } from '@sentry/core'; @@ -90,7 +90,7 @@ export function _updateSpanAttributesForParametrizedUrl(route: string, url: stri const absoluteUrl = getAbsoluteUrl(url); span.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.${attributes[SENTRY_OP]}.angular`, + [SENTRY_ORIGIN]: `auto.${attributes[SENTRY_OP]}.angular`, [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_FULL]: filterCollectedUrl(absoluteUrl), [URL_PATH]: parseStringToURLObject(absoluteUrl)?.pathname, @@ -133,7 +133,7 @@ export class TraceService implements OnDestroy { // is only known on `ResolveEnd`, which updates the span name then. name: hasSpanStreamingEnabled(client) ? NAVIGATION_SPAN_NAME_FALLBACK : strippedUrl, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.angular', + [SENTRY_ORIGIN]: 'auto.navigation.angular', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }, @@ -157,7 +157,7 @@ export class TraceService implements OnDestroy { name: hasSpanStreamingEnabled(client) ? ROUTER_SPAN_NAME_FALLBACK : `${navigationEvent.url}`, attributes: { [SENTRY_OP]: ROUTER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular', + [SENTRY_ORIGIN]: 'auto.ui.angular', [URL_FULL]: strippedUrl, ...(navigationEvent.navigationTrigger && { navigationTrigger: navigationEvent.navigationTrigger, @@ -324,7 +324,7 @@ export class TraceDirective implements OnInit, AfterViewInit { name: hasSpanStreaming ? componentName : description, attributes: { [SENTRY_OP]: UI_MOUNT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', + [SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', [UI_COMPONENT_NAME]: componentName, ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -382,7 +382,7 @@ export function TraceClass(options?: TraceClassOptions): ClassDecorator { name: hasSpanStreaming ? componentName || UI_MOUNT_SPAN_NAME_FALLBACK : description, attributes: { [SENTRY_OP]: UI_MOUNT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', + [SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', ...(componentName && { [UI_COMPONENT_NAME]: componentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -440,7 +440,7 @@ export function TraceMethod(options?: TraceMethodOptions): MethodDecorator { startTime: now, attributes: { [SENTRY_OP]: FUNCTION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', + [SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', // override description inference by Relay to preserve the original (transaction-based) description. // sentry-conventions can't map the special case with the angle brackets. ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), diff --git a/packages/angular/test/tracing.test.ts b/packages/angular/test/tracing.test.ts index 13acbc9d8622..3139125c36db 100644 --- a/packages/angular/test/tracing.test.ts +++ b/packages/angular/test/tracing.test.ts @@ -1,10 +1,16 @@ import { ElementRef } from '@angular/core'; import type { ActivatedRouteSnapshot } from '@angular/router'; -import { getMainCarrier, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentrySpan, spanToJSON, startSpan } from '@sentry/core'; +import { getMainCarrier, SentrySpan, spanToJSON, startSpan } from '@sentry/core'; import { describe, it } from 'vitest'; import { browserTracingIntegration, init, TraceClass, TraceDirective } from '../src/index'; import { _updateSpanAttributesForParametrizedUrl, getParameterizedRouteFromSnapshot } from '../src/tracing'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + URL_FULL, + URL_PATH, + URL_TEMPLATE, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { expect } from 'vitest'; describe('browserTracingIntegration', () => { @@ -81,7 +87,7 @@ describe('Angular Tracing', () => { expect(spanToJSON(span)).toEqual( expect.objectContaining({ attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.undefined.angular', + [SENTRY_ORIGIN]: 'auto.undefined.angular', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: route, // URL_FULL is resolved against jsdom's http://localhost origin @@ -106,7 +112,7 @@ describe('Angular Tracing', () => { expect(spanToJSON(span)).toEqual( expect.objectContaining({ attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SENTRY_SEGMENT_NAME_SOURCE]: 'sample-source', }, name: 'initial-span-name', diff --git a/packages/astro/src/client/browserTracingIntegration.ts b/packages/astro/src/client/browserTracingIntegration.ts index 86e8a009e0cd..80545c379b2e 100644 --- a/packages/astro/src/client/browserTracingIntegration.ts +++ b/packages/astro/src/client/browserTracingIntegration.ts @@ -4,14 +4,9 @@ import { WINDOW, } from '@sentry/browser'; import type { Client, Integration, TransactionSource } from '@sentry/core'; -import { - debug, - hasSpanStreamingEnabled, - PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '@sentry/core'; +import { debug, hasSpanStreamingEnabled, PAGELOAD_SPAN_NAME_FALLBACK } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; /** * Returns the value of a meta-tag @@ -44,7 +39,7 @@ export function browserTracingIntegration( name, attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: source, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.astro', + [SENTRY_ORIGIN]: 'auto.pageload.astro', ...(source === 'route' && { [URL_TEMPLATE]: name }), }, }); diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index b67a20a788f8..ed0b1b540bb4 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -120,7 +120,9 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setContext, diff --git a/packages/astro/src/server/middleware.ts b/packages/astro/src/server/middleware.ts index 4116085ffb41..2e88b7fc160a 100644 --- a/packages/astro/src/server/middleware.ts +++ b/packages/astro/src/server/middleware.ts @@ -8,6 +8,7 @@ import { URL_FULL, URL_PATH, URL_QUERY, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; @@ -34,7 +35,6 @@ import { getCurrentScope, getTraceMetaTags, httpHeadersToSpanAttributes, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, startSpan, winterCGHeadersToDict, @@ -148,7 +148,7 @@ async function enhanceHttpServerSpan(ctx: APIContext, next: MiddlewareNext, root rootSpan.setAttributes({ // This is here for backwards compatibility, we used to set this here before method, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.astro', + [SENTRY_ORIGIN]: 'auto.http.astro', }); if (parametrizedRoute) { @@ -220,7 +220,7 @@ async function instrumentRequestStartHttpServerSpan( const attributes: SpanAttributes = { [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.astro', + [SENTRY_ORIGIN]: 'auto.http.astro', [SENTRY_SEGMENT_NAME_SOURCE]: source, [HTTP_REQUEST_METHOD]: method, // This is here for backwards compatibility, we used to set this here before diff --git a/packages/aws-serverless/src/index.ts b/packages/aws-serverless/src/index.ts index 5d0c37614a3e..6f17bcc02c0c 100644 --- a/packages/aws-serverless/src/index.ts +++ b/packages/aws-serverless/src/index.ts @@ -95,7 +95,9 @@ export { getAutoPerformanceIntegrations, cron, parameterize, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, diff --git a/packages/browser-utils/src/performance/entries.ts b/packages/browser-utils/src/performance/entries.ts index f28e60f1cb3e..ce03b8405d7c 100644 --- a/packages/browser-utils/src/performance/entries.ts +++ b/packages/browser-utils/src/performance/entries.ts @@ -6,7 +6,6 @@ import { getActiveSpan, parseUrl, RESOURCE_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setMeasurement, spanToJSON, filterCollectedUrl, @@ -28,6 +27,7 @@ import { URL_DOMAIN, URL_FULL, URL_SCHEME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { BROWSER_CACHE, @@ -123,7 +123,7 @@ export function startTrackingLongTasks(): void { name: UI_LONG_TASK_SPAN_NAME_FALLBACK, op: UI_LONG_TASK, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }); } @@ -164,7 +164,7 @@ export function startTrackingLongAnimationFrames(): void { const duration = msToSec(entry.duration); const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }; const initialScript = entry.scripts[0]; @@ -291,7 +291,7 @@ export function _addPaintSpan( name: entry.name, attributes: { [SENTRY_OP]: BROWSER_PAINT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', [BROWSER_PAINT_TYPE]: entry.name, }, }); @@ -370,7 +370,7 @@ function _addPerformanceNavigationTiming( name: spanStreamingEnabled ? BROWSER_NAVIGATION_TIMING_SPAN_NAMES[op] : entry.name, attributes: { [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', [URL_FULL]: filterCollectedUrl(entry.name), ...(event === 'redirect' && entry.redirectCount != null ? { 'http.redirect_count': entry.redirectCount } : {}), }, @@ -411,7 +411,7 @@ function _addRequest( name: spanStreamingEnabled ? BROWSER_NAVIGATION_TIMING_SPAN_NAMES[BROWSER_REQUEST] : entry.name, attributes: { [SENTRY_OP]: BROWSER_REQUEST, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', [URL_FULL]: url, }, }); @@ -420,7 +420,7 @@ function _addRequest( name: spanStreamingEnabled ? BROWSER_NAVIGATION_TIMING_SPAN_NAMES[BROWSER_RESPONSE] : entry.name, attributes: { [SENTRY_OP]: BROWSER_RESPONSE, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', [URL_FULL]: url, }, }); @@ -453,7 +453,7 @@ export function _addResourceSpans( } const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', }; const parsedUrl = parseUrl(resourceUrl); diff --git a/packages/browser-utils/src/web-vitals/emitSpan.ts b/packages/browser-utils/src/web-vitals/emitSpan.ts index ba56bf783f57..5e25931f4bf8 100644 --- a/packages/browser-utils/src/web-vitals/emitSpan.ts +++ b/packages/browser-utils/src/web-vitals/emitSpan.ts @@ -1,12 +1,5 @@ import type { Integration, Span, SpanAttributes } from '@sentry/core'; -import { - getClient, - getCurrentScope, - getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - spanToJSON, -} from '@sentry/core'; +import { getClient, getCurrentScope, getRootSpan, spanToJSON } from '@sentry/core'; import { startInactiveSpan } from '@sentry/core/browser'; import { SENTRY_EXCLUSIVE_TIME, @@ -16,6 +9,8 @@ import { SENTRY_SEGMENT_NAME, SENTRY_TRANSACTION, USER_AGENT_ORIGINAL, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { WINDOW } from '../types'; import type { MetricNavigationType } from '../instrumentation/performanceObserver'; @@ -91,8 +86,8 @@ export function _emitWebVitalSpan(options: WebVitalSpanOptions): void { const segmentName = segmentSpan ? spanToJSON(segmentSpan).name : getCurrentScope().getScopeData().transactionName; const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_ORIGIN]: origin, + [SENTRY_OP]: op, [SENTRY_EXCLUSIVE_TIME]: 0, [`browser.web_vital.${metricName}.value`]: value, // oxlint-disable-next-line typescript-eslint/no-deprecated @@ -103,7 +98,7 @@ export function _emitWebVitalSpan(options: WebVitalSpanOptions): void { ...passedAttributes, }; - if (parentSpan && spanToJSON(parentSpan).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'pageload') { + if (parentSpan && spanToJSON(parentSpan).attributes[SENTRY_OP] === 'pageload') { // for LCP and CLS, we collect the pageload span id as an attribute attributes['sentry.pageload.span_id'] = parentSpan.spanContext().spanId; } diff --git a/packages/browser-utils/src/web-vitals/softNavs.ts b/packages/browser-utils/src/web-vitals/softNavs.ts index addab70c50b0..9c7c03560df5 100644 --- a/packages/browser-utils/src/web-vitals/softNavs.ts +++ b/packages/browser-utils/src/web-vitals/softNavs.ts @@ -1,6 +1,6 @@ import type { Client, Span } from '@sentry/core'; -import { debug, LRUMap, SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON } from '@sentry/core'; -import { BROWSER_NAVIGATION_ID } from '@sentry/conventions/attributes'; +import { debug, LRUMap, spanToJSON } from '@sentry/core'; +import { BROWSER_NAVIGATION_ID, SENTRY_OP } from '@sentry/conventions/attributes'; import { DEBUG_BUILD } from '../debug-build'; import type { PerformanceSoftNavigation } from '../instrumentation/performanceObserver'; import { addPerformanceInstrumentationHandler, isPerformanceEventTiming } from '../instrumentation/performanceObserver'; @@ -113,7 +113,7 @@ export function startSoftNavigationCorrelation(client: Client): void { WINDOW.addEventListener('keydown', onInteraction, { capture: true, passive: true }); client.on('spanStart', span => { - if (spanToJSON(span).attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'navigation') { + if (spanToJSON(span).attributes?.[SENTRY_OP] !== 'navigation') { return; } diff --git a/packages/browser-utils/src/web-vitals/spans.ts b/packages/browser-utils/src/web-vitals/spans.ts index 69bee44f19a3..0e60188b456f 100644 --- a/packages/browser-utils/src/web-vitals/spans.ts +++ b/packages/browser-utils/src/web-vitals/spans.ts @@ -7,7 +7,6 @@ import { getClient, getRootSpan, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON, timestampInSeconds, UI_INTERACTION_CLICK_SPAN_NAME_FALLBACK, @@ -35,6 +34,7 @@ import { BROWSER_WEB_VITAL_INP_INTERACTION_TYPE, BROWSER_WEB_VITAL_INP_TARGET, UI_COMPONENT_NAME, + SENTRY_OP, } from '@sentry/conventions/attributes'; import { _emitWebVitalSpan } from './emitSpan'; import { isValidLcpMetric } from './lcp'; @@ -96,10 +96,7 @@ function trackWebVitalPerNavigation( // `back-forward-cache` navigation type, so matching on that alone lets the first of them replace the // navigation span, and every later vital then hangs off a sibling vital instead. const attributes = spanToJSON(span).attributes; - if ( - attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === NAVIGATION && - attributes[BROWSER_NAVIGATION_TYPE] === 'back-forward-cache' - ) { + if (attributes?.[SENTRY_OP] === NAVIGATION && attributes[BROWSER_NAVIGATION_TYPE] === 'back-forward-cache') { bfcacheNavigationSpan = span; } }); diff --git a/packages/browser-utils/test/performance/browserMetrics.test.ts b/packages/browser-utils/test/performance/browserMetrics.test.ts index d01d7b3c779a..f9dcccabb0b4 100644 --- a/packages/browser-utils/test/performance/browserMetrics.test.ts +++ b/packages/browser-utils/test/performance/browserMetrics.test.ts @@ -1,13 +1,6 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '@sentry/core'; -import { - getClient, - getMainCarrier, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SentrySpan, - setCurrentClient, - spanToJSON, -} from '@sentry/core'; +import { getClient, getMainCarrier, SentrySpan, setCurrentClient, spanToJSON } from '@sentry/core'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { _addNavigationSpans, @@ -246,8 +239,8 @@ describe('_addResourceSpans', () => { start_timestamp: timeOrigin + startTime, end_timestamp: timeOrigin + startTime + duration, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.css', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_OP]: 'resource.css', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', ['http.response.body.decoded_size']: entry.decodedBodySize, ['http.response.body.size']: entry.encodedBodySize, ['http.response.size']: entry.transferSize, @@ -356,7 +349,7 @@ describe('_addResourceSpans', () => { _addResourceSpans(span, entry, 'https://example.com/assets/to/me', 123, 234, 465); expect(spans).toHaveLength(i + 1); - expect(spanToJSON(spans[i]!).attributes).toEqual(expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op })); + expect(spanToJSON(spans[i]!).attributes).toEqual(expect.objectContaining({ [SENTRY_OP]: op })); } }); @@ -429,8 +422,8 @@ describe('_addResourceSpans', () => { expect(spanToJSON(spans[0]!)).toEqual( expect.objectContaining({ attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.css', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_OP]: 'resource.css', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', ['http.response.body.decoded_size']: entry.decodedBodySize, ['http.response.body.size']: entry.encodedBodySize, ['http.response.size']: entry.transferSize, @@ -468,8 +461,8 @@ describe('_addResourceSpans', () => { expect(spanToJSON(spans[0]!)).toEqual( expect.objectContaining({ attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.css', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_OP]: 'resource.css', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'example.com', 'url.domain': 'example.com', 'http.request.same_origin': true, @@ -520,8 +513,8 @@ describe('_addResourceSpans', () => { expect(spanToJSON(spans[0]!)).toEqual( expect.objectContaining({ attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.css', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_OP]: 'resource.css', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'example.com', 'url.domain': 'example.com', 'http.request.same_origin': true, @@ -820,7 +813,7 @@ describe('_addNavigationSpans', () => { // `unloadEventStart`/`End` are 0 in the shared entry, so that span is never created. _addNavigationSpans(pageloadSpan, { ...entry, unloadEventStart: 1, unloadEventEnd: 2 }, 999, true); - const spanJson = spans.map(spanToJSON).find(span => span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op); + const spanJson = spans.map(spanToJSON).find(span => span.attributes[SENTRY_OP] === op); expect(spanJson?.name).toBe(expectedName); expect(spanJson?.attributes['url.full']).toBe('https://santry.com/test?q=secret#frag'); diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index 6708e12549ba..48b09d3c1acc 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -78,7 +78,9 @@ export { } from '@sentry/core'; export { + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, } from '@sentry/core'; diff --git a/packages/browser/src/integrations/fetchStreamPerformance.ts b/packages/browser/src/integrations/fetchStreamPerformance.ts index 2a5c0dc9c103..c021c959e883 100644 --- a/packages/browser/src/integrations/fetchStreamPerformance.ts +++ b/packages/browser/src/integrations/fetchStreamPerformance.ts @@ -1,4 +1,4 @@ -import { HTTP_REQUEST_METHOD, SENTRY_OP, URL_DOMAIN, URL_FULL } from '@sentry/conventions/attributes'; +import { HTTP_REQUEST_METHOD, SENTRY_OP, URL_DOMAIN, URL_FULL, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HTTP_CLIENT_STREAM } from '@sentry/conventions/op'; import type { IntegrationFn, Span } from '@sentry/core'; import { @@ -9,7 +9,6 @@ import { getUrlDomain, hasSpanStreamingEnabled, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, stripDataUrlContent, filterCollectedUrl, } from '@sentry/core'; @@ -93,7 +92,7 @@ export const fetchStreamPerformanceIntegration = defineIntegration(() => { [HTTP_REQUEST_METHOD]: method, type: 'fetch', [SENTRY_OP]: HTTP_CLIENT_STREAM, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser.stream', + [SENTRY_ORIGIN]: 'auto.http.browser.stream', }, }); diff --git a/packages/browser/src/tracing/request.ts b/packages/browser/src/tracing/request.ts index 2320f12cba6f..dd5cdb351a3c 100644 --- a/packages/browser/src/tracing/request.ts +++ b/packages/browser/src/tracing/request.ts @@ -13,7 +13,6 @@ import { instrumentFetchRequest, matchesTracePropagationTargets, parseUrl, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, setHttpStatus, spanIsIgnored, @@ -44,6 +43,7 @@ import { URL_FRAGMENT, URL_FULL, URL_QUERY, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; @@ -393,7 +393,7 @@ function xhrCallback( [URL_FULL]: filterCollectedUrl(sanitizedFullUrl), [SERVER_ADDRESS]: host, [URL_DOMAIN]: domain, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser', + [SENTRY_ORIGIN]: 'auto.http.browser', [SENTRY_OP]: HTTP_CLIENT, [URL_QUERY]: filterCollectedUrlQuery(getUrlQuery(parsedUrl?.search)), [URL_FRAGMENT]: getUrlFragment(parsedUrl?.hash), diff --git a/packages/browser/test/integrations/httpcontext.test.ts b/packages/browser/test/integrations/httpcontext.test.ts index 524c8742bf3a..555b68dd1c05 100644 --- a/packages/browser/test/integrations/httpcontext.test.ts +++ b/packages/browser/test/integrations/httpcontext.test.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { describe, expect, it, vi } from 'vitest'; -import { httpContextIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../../src/exports'; +import { httpContextIntegration } from '../../src/exports'; import type { Event, StreamedSpanJSON } from '@sentry/core'; import { getDefaultBrowserClientOptions } from '../helper/browser-client-options'; import { BrowserClient } from '../../src/client'; @@ -29,7 +30,7 @@ describe('httpContextIntegration', () => { const span: Partial = { is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client', + [SENTRY_OP]: 'http.client', }, }; @@ -39,7 +40,7 @@ describe('httpContextIntegration', () => { expect(span.attributes).not.toHaveProperty('url.full'); expect(span.attributes).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client', + [SENTRY_OP]: 'http.client', 'http.request.header.referer': ['https://example.com'], 'user_agent.original': USER_AGENT, 'sentry.is_localhost': false, @@ -52,7 +53,7 @@ describe('httpContextIntegration', () => { const span: Partial = { is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', }, }; @@ -61,7 +62,7 @@ describe('httpContextIntegration', () => { integration.processSpan!(span as StreamedSpanJSON, browserClient); expect(span.attributes).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', 'http.request.header.referer': ['https://example.com'], 'user_agent.original': USER_AGENT, 'sentry.is_localhost': false, @@ -74,14 +75,14 @@ describe('httpContextIntegration', () => { const span: Partial = { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.click', + [SENTRY_OP]: 'ui.click', }, }; integration.processSpan!(span as StreamedSpanJSON, new BrowserClient(getDefaultBrowserClientOptions())); expect(span.attributes).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.click', + [SENTRY_OP]: 'ui.click', 'user_agent.original': USER_AGENT, 'sentry.is_localhost': false, }); @@ -161,13 +162,13 @@ describe('httpContextIntegration', () => { ); const span: Partial = { is_segment: true, - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload' }, + attributes: { [SENTRY_OP]: 'pageload' }, }; httpContextIntegration().processSpan!(span as StreamedSpanJSON, client); expect(span.attributes).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', 'sentry.is_localhost': false, 'url.full': 'https://example.com', }); @@ -179,13 +180,13 @@ describe('httpContextIntegration', () => { ); const span: Partial = { is_segment: true, - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload' }, + attributes: { [SENTRY_OP]: 'pageload' }, }; httpContextIntegration().processSpan!(span as StreamedSpanJSON, client); expect(span.attributes).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', 'url.full': 'https://example.com', 'http.request.header.referer': ['[Filtered]'], 'user_agent.original': USER_AGENT, diff --git a/packages/browser/test/tracing/bfcacheRestoreNavigation.test.ts b/packages/browser/test/tracing/bfcacheRestoreNavigation.test.ts index 27cc3089b309..d2b542a5392f 100644 --- a/packages/browser/test/tracing/bfcacheRestoreNavigation.test.ts +++ b/packages/browser/test/tracing/bfcacheRestoreNavigation.test.ts @@ -2,11 +2,11 @@ * @vitest-environment jsdom */ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { browserPerformanceTimeOrigin, getActiveSpan, getMainCarrier, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setCurrentClient, spanToJSON, } from '@sentry/core'; @@ -66,7 +66,7 @@ describe('bfcache restore, then the first history navigation of the document', ( WINDOW.dispatchEvent(event); expect(spanToJSON(getActiveSpan()!).attributes).toEqual( - expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser.bfcache' }), + expect.objectContaining({ [SENTRY_ORIGIN]: 'auto.navigation.browser.bfcache' }), ); // Past the redirect threshold, so the navigation is judged on the pageload guard alone rather @@ -75,7 +75,7 @@ describe('bfcache restore, then the first history navigation of the document', ( WINDOW.history.pushState({}, '', '/after-restore'); expect(spanToJSON(getActiveSpan()!).attributes).toEqual( - expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser' }), + expect.objectContaining({ [SENTRY_ORIGIN]: 'auto.navigation.browser' }), ); }); }); diff --git a/packages/browser/test/tracing/browserTracingIntegration.test.ts b/packages/browser/test/tracing/browserTracingIntegration.test.ts index b61518c581f5..0061ec0dde23 100644 --- a/packages/browser/test/tracing/browserTracingIntegration.test.ts +++ b/packages/browser/test/tracing/browserTracingIntegration.test.ts @@ -9,8 +9,6 @@ import { getDynamicSamplingContextFromSpan, getMainCarrier, metrics, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, spanIsSampled, @@ -35,7 +33,13 @@ import { PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE } from '../../src/tracing/linkedTrace import { bfcacheMetricsIntegration } from '../../src/integrations/bfcacheMetrics'; import * as webVitalsModule from '../../src/integrations/webVitals'; import { getDefaultBrowserClientOptions } from '../helper/browser-client-options'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + URL_FULL, + URL_PATH, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; const oldTextEncoder = global.window.TextEncoder; const oldTextDecoder = global.window.TextDecoder; @@ -176,8 +180,8 @@ describe('browserTracingIntegration', () => { name: 'Pageload', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/', @@ -320,8 +324,8 @@ describe('browserTracingIntegration', () => { name: 'Pageload', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/', @@ -355,8 +359,8 @@ describe('browserTracingIntegration', () => { name: 'Navigation', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/test', @@ -398,8 +402,8 @@ describe('browserTracingIntegration', () => { name: 'Navigation', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/test2', @@ -443,8 +447,8 @@ describe('browserTracingIntegration', () => { name: 'Pageload', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/', @@ -478,8 +482,8 @@ describe('browserTracingIntegration', () => { expect(getSpanDescendants(span).map(span => spanToJSON(span))).toContainEqual( expect.objectContaining({ attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation.redirect', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', + [SENTRY_OP]: 'navigation.redirect', + [SENTRY_ORIGIN]: 'auto.navigation.browser', [URL_FULL]: 'https://example.com/test', [URL_PATH]: '/test', }, @@ -539,8 +543,8 @@ describe('browserTracingIntegration', () => { name: 'test span', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [URL_FULL]: 'https://example.com/', @@ -606,7 +610,7 @@ describe('browserTracingIntegration', () => { name: 'test span', attributes: { testy: 'yes', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }); @@ -615,8 +619,8 @@ describe('browserTracingIntegration', () => { name: 'test span', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.test', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [URL_FULL]: 'https://example.com/', @@ -917,8 +921,8 @@ describe('browserTracingIntegration', () => { expect(span).toBeDefined(); expect(spanToJSON(span).attributes).toEqual( expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser.bfcache', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.browser.bfcache', 'browser.navigation.type': 'back-forward-cache', }), ); @@ -955,7 +959,7 @@ describe('browserTracingIntegration', () => { firePageShow(true); expect(spanToJSON(getActiveSpan()!).attributes).toEqual( - expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser.bfcache' }), + expect.objectContaining({ [SENTRY_ORIGIN]: 'auto.navigation.browser.bfcache' }), ); }); @@ -1045,8 +1049,8 @@ describe('browserTracingIntegration', () => { name: 'test span', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE]: expect.stringMatching(/[a-f0-9]{32}-[a-f0-9]{16}-1/), @@ -1093,7 +1097,7 @@ describe('browserTracingIntegration', () => { name: 'test span', attributes: { testy: 'yes', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }); @@ -1102,8 +1106,8 @@ describe('browserTracingIntegration', () => { name: 'test span', status: 'ok', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.test', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [URL_FULL]: 'https://example.com/', diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index d5b1d11ee4e5..e96e052656cb 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -116,7 +116,9 @@ export { getAutoPerformanceIntegrations, cron, parameterize, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, diff --git a/packages/bun/src/integrations/bunserver.ts b/packages/bun/src/integrations/bunserver.ts index 080251c7dba3..bf73c591d467 100644 --- a/packages/bun/src/integrations/bunserver.ts +++ b/packages/bun/src/integrations/bunserver.ts @@ -12,7 +12,6 @@ import { HTTP_SPAN_NAME_FALLBACK, isURLObjectRelative, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, startSpan, winterCGRequestToRequestData, @@ -36,6 +35,7 @@ import { URL_PORT, URL_QUERY, URL_SCHEME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; @@ -355,7 +355,7 @@ function getSpanAttributesFromParsedUrl( request: Request, ): SpanAttributes { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.bun.serve', + [SENTRY_ORIGIN]: 'auto.http.bun.serve', [HTTP_REQUEST_METHOD]: request.method || 'GET', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }; diff --git a/packages/bun/test/integrations/bunHttpServer.test.ts b/packages/bun/test/integrations/bunHttpServer.test.ts index 48d5f255d821..62b008bafe4a 100644 --- a/packages/bun/test/integrations/bunHttpServer.test.ts +++ b/packages/bun/test/integrations/bunHttpServer.test.ts @@ -1,6 +1,6 @@ import http from 'node:http'; -import { HTTP_REQUEST_METHOD } from '@sentry/conventions/attributes'; -import { getActiveSpan, getCurrentScope, getTraceData, SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON } from '@sentry/core'; +import { HTTP_REQUEST_METHOD, SENTRY_OP } from '@sentry/conventions/attributes'; +import { getActiveSpan, getCurrentScope, getTraceData, spanToJSON } from '@sentry/core'; import { afterAll, beforeAll, describe, expect, test } from 'bun:test'; import { init } from '../../src'; @@ -51,7 +51,7 @@ describe('Bun HTTP Server Integration', () => { await close(); expect(span).toBeDefined(); - expect(span?.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); + expect(span?.attributes[SENTRY_OP]).toBe('http.server'); // No router resolves a route here, so with span streaming the name is the request method. expect(span?.name).toBe('GET'); expect(span?.attributes['url.path']).toBe('/users'); @@ -82,7 +82,7 @@ describe('Bun HTTP Server Integration', () => { await close(); expect(span).toBeDefined(); - expect(span?.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); + expect(span?.attributes[SENTRY_OP]).toBe('http.server'); expect(span?.name).toBe('QUERY'); expect(span?.attributes['url.path']).toBe('/search'); expect(span?.attributes[HTTP_REQUEST_METHOD]).toBe('QUERY'); diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index 59f8713b181e..1d3aef44a03c 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -86,7 +86,9 @@ export { instrumentSupabaseClient, zodErrorsIntegration, consoleIntegration, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, spanToStaticSpanJSON, diff --git a/packages/cloudflare/src/instrumentations/agents/instrumentAgentCallableRpc.ts b/packages/cloudflare/src/instrumentations/agents/instrumentAgentCallableRpc.ts index bf64488ad90c..88ea17db8eb5 100644 --- a/packages/cloudflare/src/instrumentations/agents/instrumentAgentCallableRpc.ts +++ b/packages/cloudflare/src/instrumentations/agents/instrumentAgentCallableRpc.ts @@ -1,6 +1,6 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { RPC } from '@sentry/conventions/op'; -import { debug, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { debug, startSpan } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import { AGENT_SPAN_ORIGIN, type AgentInternals, getAgentAttributes, setAgentConversationId } from './types'; @@ -35,7 +35,7 @@ export function instrumentAgentCallableRpc(obj: AgentInternals): void { name: method, attributes: { [SENTRY_OP]: RPC, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: AGENT_SPAN_ORIGIN, + [SENTRY_ORIGIN]: AGENT_SPAN_ORIGIN, ...getAgentAttributes(thisArg), }, }, diff --git a/packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts b/packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts index 976412bae83d..e1d1a3fc1025 100644 --- a/packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts +++ b/packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts @@ -1,7 +1,7 @@ import type { DurableObjectStorage, SyncKvStorage, SqlStorage } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { getClient, isThenable, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { getClient, isThenable, startSpan } from '@sentry/core'; import type { CloudflareClientOptions } from '../client'; import { getStorageKeys, targetsCloudflareInternalKey } from '../utils/internalStorageKey'; import { storeSpanContext } from '../utils/traceLinks'; @@ -75,7 +75,7 @@ export function instrumentDurableObjectStorage( name: `durable_object_storage_${methodName}`, attributes: { [SENTRY_OP]: DB, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': methodName, }, diff --git a/packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts b/packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts index c8b94d14fef4..eb21b57a2fbf 100644 --- a/packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts +++ b/packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts @@ -1,7 +1,7 @@ import type { SyncKvStorage } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { startSpan } from '@sentry/core'; const SYNC_KV_METHODS_TO_INSTRUMENT = ['get', 'put', 'delete', 'list'] as const; @@ -28,7 +28,7 @@ export function instrumentDurableObjectSyncKvStorage(syncKv: SyncKvStorage): Syn name: `durable_object_storage_kv_${methodName}`, attributes: { [SENTRY_OP]: DB, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', // keeping the value as close as possible to the Cloudflare Worker KV instrumentation // https://github.com/cloudflare/workerd/blob/6b8b11787e2b2a800ab0edd0690bfab3857b0529/src/workerd/api/sync-kv.c%2B%2B#L19 'db.system.name': 'cloudflare-durable-object-sql', diff --git a/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts b/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts index 706960562f88..276cd0be5f8d 100644 --- a/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts +++ b/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts @@ -1,21 +1,14 @@ import type { SqlStorage } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; -import { - getActiveSpan, - getClient, - hasSpansEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - spanIsSampled, - startSpan, -} from '@sentry/core'; +import { getActiveSpan, getClient, hasSpansEnabled, spanIsSampled, startSpan } from '@sentry/core'; import { getSqlQuerySummary, sanitizeSqlQuery } from '@sentry/server-utils'; import type { CloudflareClientOptions } from '../client'; import { mayTargetCloudflareInternalTable, targetsCloudflareInternalTable } from '../utils/internalSqlQuery'; const SPAN_ATTRIBUTES = { [SENTRY_OP]: DB_QUERY, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', }; diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts b/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts index d8410ce32a45..42b01428816c 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts @@ -1,16 +1,9 @@ /* eslint-disable @typescript-eslint/unbound-method */ import type { D1Database, D1DatabaseSession, D1PreparedStatement, D1Response } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; import type { Span, SpanAttributes, StartSpanOptions } from '@sentry/core'; -import { - addBreadcrumb, - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startSpan, -} from '@sentry/core'; +import { addBreadcrumb, getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startSpan } from '@sentry/core'; import { getSqlQuerySummary, sanitizeSqlQuery } from '@sentry/server-utils'; import { ensureInstrumented } from '../../instrument'; @@ -148,7 +141,7 @@ function createStartSpanOptions(queryText: string | undefined, type: D1QueryType 'db.operation.name': type, 'db.query.text': queryText, 'db.query.summary': querySummary, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', }, }; } @@ -187,7 +180,7 @@ function instrumentBatch( 'db.operation.name': 'batch', 'db.query.text': queryText || undefined, 'db.operation.batch.size': statements.length, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', }, }, async () => { diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts index 285be9fc1313..b12f01474d6a 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts @@ -1,9 +1,9 @@ import type { MessageBatch } from '@cloudflare/workers-types'; import type { AnyExportedHandler } from '../../types'; import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { QUEUE_PROCESS } from '@sentry/conventions/op'; -import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, withIsolationScope } from '@sentry/core'; +import { captureException, startSpan, withIsolationScope } from '@sentry/core'; import type { CloudflareOptions } from '../../client'; import { flushAndDispose } from '../../flush'; import { ensureInstrumented } from '../../instrument'; @@ -45,7 +45,7 @@ function wrapQueueHandler( 'messaging.operation.name': 'process', 'messaging.batch.message_count': batch.messages.length, 'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts - 1, 0), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue', + [SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts b/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts index d1b3de4ba107..3460ea32c633 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts @@ -1,7 +1,7 @@ import type { MessageSendRequest, Queue, QueueSendBatchOptions, QueueSendOptions } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { QUEUE_PUBLISH } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { startSpan } from '@sentry/core'; const ORIGIN = 'auto.faas.cloudflare.queue'; @@ -26,7 +26,7 @@ function startPublishSpan( ...(messageCount !== undefined && { 'messaging.batch.message_count': messageCount }), 'messaging.message.body.size': bodySize, [SENTRY_OP]: QUEUE_PUBLISH, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }, }, callback, diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts b/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts index 7d6ad24ae3e2..a2ffdf72e50a 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts @@ -7,6 +7,7 @@ import { CLOUDFLARE_R2_REQUEST_PART_NUMBER, CLOUDFLARE_R2_REQUEST_PREFIX, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { OBJECT_DELETE, @@ -19,7 +20,7 @@ import { OBJECT_PUT, OBJECT_UPLOAD_PART, } from '@sentry/conventions/op'; -import { isObjectLike, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { isObjectLike, startSpan } from '@sentry/core'; const ORIGIN = 'auto.faas.cloudflare.r2'; @@ -67,7 +68,7 @@ function createSpanOptions(bindingName: string, r2Op: R2OperationKey, key?: stri ...(isR2ListOptions(key) && key.prefix !== undefined && { [CLOUDFLARE_R2_REQUEST_PREFIX]: key.prefix }), ...(isR2ListOptions(key) && key.delimiter !== undefined && { [CLOUDFLARE_R2_REQUEST_DELIMITER]: key.delimiter }), [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }, }; } diff --git a/packages/cloudflare/src/workflows.ts b/packages/cloudflare/src/workflows.ts index 62442cadf32d..6043354e6427 100644 --- a/packages/cloudflare/src/workflows.ts +++ b/packages/cloudflare/src/workflows.ts @@ -1,15 +1,12 @@ -import { SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + CODE_FUNCTION_NAME, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; import type { PropagationContext, Scope } from '@sentry/core'; -import { - captureException, - flush, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startSpan, - withIsolationScope, - withScope, -} from '@sentry/core'; +import { captureException, flush, getCurrentScope, startSpan, withIsolationScope, withScope } from '@sentry/core'; import type { WorkflowDelayDuration, WorkflowEntrypoint, @@ -146,7 +143,7 @@ class WrappedWorkflowStep implements WorkflowStep { typeof config?.retries?.delay === 'function' ? undefined : config?.retries?.delay, 'cloudflare.workflow.retries.limit': config?.retries?.limit, 'cloudflare.workflow.attempt': attempt, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', + [SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, diff --git a/packages/cloudflare/test/instrumentDurableObjectStorage.test.ts b/packages/cloudflare/test/instrumentDurableObjectStorage.test.ts index af5161e5bcde..8a17c0031aac 100644 --- a/packages/cloudflare/test/instrumentDurableObjectStorage.test.ts +++ b/packages/cloudflare/test/instrumentDurableObjectStorage.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as sentryCore from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { instrumentDurableObjectStorage } from '../src/instrumentations/instrumentDurableObjectStorage'; @@ -32,7 +32,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_get', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'get', }, @@ -53,7 +53,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_get', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'get', }, @@ -76,7 +76,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_put', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'put', }, @@ -97,7 +97,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_put', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'put', }, @@ -120,7 +120,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_delete', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'delete', }, @@ -141,7 +141,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_delete', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'delete', }, @@ -164,7 +164,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_list', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'list', }, @@ -187,7 +187,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_setAlarm', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'setAlarm', }, @@ -271,7 +271,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_getAlarm', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'getAlarm', }, @@ -292,7 +292,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_deleteAlarm', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'deleteAlarm', }, @@ -315,7 +315,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'SELECT', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 'db.query.text': 'SELECT ?', @@ -439,7 +439,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_kv_get', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'get', }, diff --git a/packages/cloudflare/test/instrumentDurableObjectSyncKvStorage.test.ts b/packages/cloudflare/test/instrumentDurableObjectSyncKvStorage.test.ts index f6135c2f919c..b75cc0e0e245 100644 --- a/packages/cloudflare/test/instrumentDurableObjectSyncKvStorage.test.ts +++ b/packages/cloudflare/test/instrumentDurableObjectSyncKvStorage.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as sentryCore from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { instrumentDurableObjectSyncKvStorage } from '../src/instrumentations/instrumentDurableObjectSyncKvStorage'; @@ -21,7 +21,7 @@ describe('instrumentDurableObjectSyncKvStorage', () => { name: 'durable_object_storage_kv_get', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'get', }, @@ -64,7 +64,7 @@ describe('instrumentDurableObjectSyncKvStorage', () => { name: 'durable_object_storage_kv_put', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'put', }, @@ -96,7 +96,7 @@ describe('instrumentDurableObjectSyncKvStorage', () => { name: 'durable_object_storage_kv_delete', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'delete', }, @@ -129,7 +129,7 @@ describe('instrumentDurableObjectSyncKvStorage', () => { name: 'durable_object_storage_kv_list', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'list', }, diff --git a/packages/cloudflare/test/instrumentSqlStorage.test.ts b/packages/cloudflare/test/instrumentSqlStorage.test.ts index 8d76316460f3..edf590f84a0f 100644 --- a/packages/cloudflare/test/instrumentSqlStorage.test.ts +++ b/packages/cloudflare/test/instrumentSqlStorage.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as sentryCore from '@sentry/core'; import * as serverUtils from '@sentry/server-utils'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -27,7 +27,7 @@ describe('instrumentSqlStorage', () => { name: 'SELECT users', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 'db.query.text': 'SELECT * FROM users WHERE id = ?', @@ -51,7 +51,7 @@ describe('instrumentSqlStorage', () => { name: 'SELECT users', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 'db.query.text': 'SELECT * FROM users WHERE name = ? AND age > ?', @@ -84,7 +84,7 @@ describe('instrumentSqlStorage', () => { name: 'INSERT users', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 'db.query.text': 'INSERT INTO users (name, email) VALUES (?, ?)', @@ -281,7 +281,7 @@ describe('instrumentSqlStorage', () => { name: 'exec', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', }, diff --git a/packages/core/src/fetch.ts b/packages/core/src/fetch.ts index aaf83ef25d82..76ef3892bea1 100644 --- a/packages/core/src/fetch.ts +++ b/packages/core/src/fetch.ts @@ -9,11 +9,11 @@ import { URL_FRAGMENT, URL_FULL, URL_QUERY, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; import type { Client } from './client'; import { getClient } from './currentScopes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; import { setHttpStatus, SPAN_STATUS_ERROR, spanIsIgnored } from './tracing'; import { startInactiveSpan } from './tracing/trace'; import { SentryNonRecordingSpan } from './tracing/sentryNonRecordingSpan'; @@ -385,7 +385,7 @@ function getFetchSpanAttributes( type: 'fetch', // oxlint-disable-next-line typescript/no-deprecated [HTTP_REQUEST_METHOD]: method, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, + [SENTRY_ORIGIN]: spanOrigin, [SENTRY_OP]: HTTP_CLIENT, [URL_DOMAIN]: domain, }; diff --git a/packages/core/src/integrations/http/server-subscription.ts b/packages/core/src/integrations/http/server-subscription.ts index 3ef8edbf0a49..8427c699e031 100644 --- a/packages/core/src/integrations/http/server-subscription.ts +++ b/packages/core/src/integrations/http/server-subscription.ts @@ -39,7 +39,6 @@ import { continueTrace, startSpanManual } from '../../tracing/trace'; import { getSpanStatusFromHttpCode, SPAN_STATUS_ERROR } from '../../tracing'; import { hasSpanStreamingEnabled } from '../../tracing/spans/hasSpanStreamingEnabled'; import { HTTP_SPAN_NAME_FALLBACK } from '../../tracing/spans/spanNames'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { safeMathRandom } from '../../utils/randomSafeContext'; import type { SpanStatus } from '../../types/spanStatus'; import { @@ -66,6 +65,7 @@ import { URL_QUERY, URL_SCHEME, USER_AGENT_ORIGINAL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; import { filterCollectedUrl, filterCollectedUrlQuery } from '../../utils/data-collection/filterCollectedUrl'; @@ -326,7 +326,7 @@ function buildServerSpanWrap( attributes: { // Sentry-specific attributes [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.server', + [SENTRY_ORIGIN]: 'auto.http.server', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SENTRY_KIND]: 'server', // Network attributes diff --git a/packages/core/src/integrations/mcp-server/spans.ts b/packages/core/src/integrations/mcp-server/spans.ts index 9159ce497122..b380da55e5a8 100644 --- a/packages/core/src/integrations/mcp-server/spans.ts +++ b/packages/core/src/integrations/mcp-server/spans.ts @@ -6,13 +6,12 @@ */ import { getClient } from '../../currentScopes'; -import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { MCP_NOTIFICATION_CLIENT_TO_SERVER, MCP_NOTIFICATION_SERVER_TO_CLIENT, MCP_SERVER, } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { hasSpanStreamingEnabled } from '../../tracing/spans/hasSpanStreamingEnabled'; import { MCP_NOTIFICATION_SPAN_NAME_FALLBACK, MCP_SERVER_SPAN_NAME_FALLBACK } from '../../tracing/spans/spanNames'; import { startSpan } from '../../tracing/trace'; @@ -72,7 +71,7 @@ function buildSentryAttributes(type: McpSpanConfig['type']): Record = {}) => { diff --git a/packages/core/src/semanticAttributes.ts b/packages/core/src/semanticAttributes.ts index 5a3274023e39..d1b5d05f8b67 100644 --- a/packages/core/src/semanticAttributes.ts +++ b/packages/core/src/semanticAttributes.ts @@ -16,11 +16,13 @@ export const SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE = 'sentry.prev /** * Use this attribute to represent the operation of a span. + * @deprecated Use `SENTRY_OP` from `@sentry/conventions/attributes` instead. */ export const SEMANTIC_ATTRIBUTE_SENTRY_OP = 'sentry.op'; /** * Use this attribute to represent the origin of a span. + * @deprecated Use `SENTRY_ORIGIN` from `@sentry/conventions/attributes` instead. */ export const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = 'sentry.origin'; diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index e0eb0fbec9b5..51927f628c3c 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -1,13 +1,13 @@ /* eslint-disable max-lines */ import { getClient, getCurrentScope } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; -import { SENTRY_EXCLUSIVE_TIME, SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { - SEMANTIC_ATTRIBUTE_PROFILE_ID, - SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '../semanticAttributes'; + SENTRY_EXCLUSIVE_TIME, + SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_PROFILE_ID, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '../semanticAttributes'; import type { Client } from '../client'; import type { TransactionEvent } from '../types/event'; import type { SpanLink } from '../types/link'; @@ -103,8 +103,8 @@ export class SentrySpan implements Span { this._attributes = {}; this.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op, + [SENTRY_ORIGIN]: 'manual', + [SENTRY_OP]: spanContext.op, ...spanContext.attributes, }); @@ -271,14 +271,14 @@ export class SentrySpan implements Span { return { data: this._attributes, description: this._name, - op: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], + op: this._attributes[SENTRY_OP], parent_span_id: this._parentSpanId, span_id: this._spanId, start_timestamp: this._startTime, status: getStatusMessage(this._status), timestamp: this._endTime, trace_id: this._traceId, - origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined, + origin: this._attributes[SENTRY_ORIGIN] as SpanOrigin | undefined, profile_id: this._attributes[SEMANTIC_ATTRIBUTE_PROFILE_ID] as string | undefined, exclusive_time: this._attributes[SENTRY_EXCLUSIVE_TIME] as number | undefined, measurements: timedEventsToMeasurements(this._events), diff --git a/packages/core/src/tracing/trace.ts b/packages/core/src/tracing/trace.ts index 1aa3818a9f1c..ff312712ee46 100644 --- a/packages/core/src/tracing/trace.ts +++ b/packages/core/src/tracing/trace.ts @@ -6,8 +6,8 @@ import { getMainCarrier } from '../carrier'; import { getClient, getCurrentScope, getIsolationScope, withScope } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; import type { Scope } from '../scope'; -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '../semanticAttributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '../semanticAttributes'; import type { ClientOptions } from '../types/options'; import type { SentrySpanArguments, Span, SpanTimeInput } from '../types/span'; import type { StartSpanOptions } from '../types/startSpanOptions'; @@ -448,7 +448,7 @@ function parseSentrySpanArguments(options: StartSpanOptions): SentrySpanArgument // constructor only adds it after the sampling decision. An explicit `sentry.op` attribute wins. if (options.op) { initialCtx.attributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: options.op, + [SENTRY_OP]: options.op, ...options.attributes, }; } @@ -633,7 +633,7 @@ function _shouldIgnoreStreamedSpan(client: Client | undefined, spanArguments: Se return shouldIgnoreSpan( { description: spanArguments.name || '', - op: spanArguments.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] || spanArguments.op, + op: spanArguments.attributes?.[SENTRY_OP] || spanArguments.op, attributes: spanArguments.attributes, }, ignoreSpans, diff --git a/packages/core/src/trpc.ts b/packages/core/src/trpc.ts index 55e428f60458..d84f6f16f17b 100644 --- a/packages/core/src/trpc.ts +++ b/packages/core/src/trpc.ts @@ -5,11 +5,11 @@ import { SENTRY_SEGMENT_NAME_SOURCE, TRPC_PROCEDURE_PATH, TRPC_PROCEDURE_TYPE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { RPC } from '@sentry/conventions/op'; import { getClient, withIsolationScope } from './currentScopes'; import { captureException } from './exports'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; import { startSpanManual } from './tracing/trace'; import { normalize } from './utils/normalize'; import { setNormalizationDepthOverrideHint } from './utils/normalizationHints'; @@ -97,7 +97,7 @@ export function trpcMiddleware(options: SentryTrpcMiddlewareOptions = {}) { attributes: { [SENTRY_OP]: RPC, [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.rpc.trpc', + [SENTRY_ORIGIN]: 'auto.rpc.trpc', [RPC_SYSTEM_NAME]: 'trpc', [RPC_METHOD]: String(path), [TRPC_PROCEDURE_PATH]: String(path), diff --git a/packages/core/src/utils/spanUtils.ts b/packages/core/src/utils/spanUtils.ts index 2bf38cdb5864..e1615b9bf5c4 100644 --- a/packages/core/src/utils/spanUtils.ts +++ b/packages/core/src/utils/spanUtils.ts @@ -5,12 +5,13 @@ import { serializeAttributes } from '../attributes'; import { getMainCarrier } from '../carrier'; import { getCurrentScope } from '../currentScopes'; import type { Scope } from '../scope'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_STATUS_MESSAGE } from '@sentry/conventions/attributes'; import { - SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '../semanticAttributes'; + SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_STATUS_MESSAGE, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '../semanticAttributes'; import type { SentrySpan } from '../tracing/sentrySpan'; import { isStatusErrorMessageValid, SPAN_STATUS_OK, SPAN_STATUS_UNSET } from '../tracing/spanstatus'; import { getCapturedScopesOnSpan } from '../tracing/utils'; @@ -190,8 +191,8 @@ export function spanToStaticSpanJSON(span: Span): SpanJSON { // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time timestamp: spanTimeInputToSeconds(endTime) || undefined, status: getStatusMessage(status), - op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], - origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined, + op: attributes[SENTRY_OP], + origin: attributes[SENTRY_ORIGIN] as SpanOrigin | undefined, links: convertSpanLinksForEnvelope(links), }; } diff --git a/packages/core/src/utils/url.ts b/packages/core/src/utils/url.ts index d7f45141a342..3a0a5fca186c 100644 --- a/packages/core/src/utils/url.ts +++ b/packages/core/src/utils/url.ts @@ -11,8 +11,8 @@ import { SENTRY_SEGMENT_NAME_SOURCE, URL_SCHEME, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; import type { Client } from '../client'; import type { SpanAttributes } from '../types/span'; import type { TransactionSource } from '../types/transaction'; @@ -210,7 +210,7 @@ export function getHttpSpanDetailsFromUrlObject( client?: Client, ): [name: string, attributes: SpanAttributes] { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, + [SENTRY_ORIGIN]: spanOrigin, }; let nameSource: TransactionSource = 'url'; diff --git a/packages/core/test/lib/tracing/spans/captureSpan.test.ts b/packages/core/test/lib/tracing/spans/captureSpan.test.ts index 23b0847ed0de..d3d5c1c4ecb1 100644 --- a/packages/core/test/lib/tracing/spans/captureSpan.test.ts +++ b/packages/core/test/lib/tracing/spans/captureSpan.test.ts @@ -4,8 +4,6 @@ import { captureSpan, debug, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, @@ -33,6 +31,8 @@ import { USER_ID, USER_IP_ADDRESS, USER_NAME, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; describe('captureSpan', () => { @@ -77,11 +77,11 @@ describe('captureSpan', () => { type: 'string', value: 'stream', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'http.client', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -173,11 +173,11 @@ describe('captureSpan', () => { status: 'ok', is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'http.client', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -269,11 +269,11 @@ describe('captureSpan', () => { status: 'ok', is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'http.client', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -350,8 +350,8 @@ describe('captureSpan', () => { is_segment: true, attributes: { [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'http.client' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_OP]: { type: 'string', value: 'http.client' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, [SENTRY_SEGMENT_NAME]: { value: 'my-span', type: 'string' }, [SENTRY_SEGMENT_ID]: { value: span.spanContext().spanId, type: 'string' }, diff --git a/packages/core/test/lib/tracing/trace.test.ts b/packages/core/test/lib/tracing/trace.test.ts index e36effb86317..5d7ab473b1b8 100644 --- a/packages/core/test/lib/tracing/trace.test.ts +++ b/packages/core/test/lib/tracing/trace.test.ts @@ -6,8 +6,6 @@ import { getMainCarrier, getTraceData, Scope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setAsyncContextStrategy, setCurrentClient, spanToJSON, @@ -33,7 +31,7 @@ import { getActiveSpan, getRootSpan, getSpanDescendants, spanIsSampled } from '. import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; import { SUPPRESS_TRACING_KEY } from '../../../src/tracing/constants'; import { resetGlobals } from '../../testutils'; -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; const enum Type { Sync = 'sync', @@ -110,14 +108,14 @@ describe('startSpan', () => { }); try { await startSpan({ name: 'GET users/[id]' }, span => { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'http.server'); + span.setAttribute(SENTRY_OP, 'http.server'); return callback(); }); } catch { // } - expect(spanToJSON(_span!).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual('http.server'); + expect(spanToJSON(_span!).attributes[SENTRY_OP]).toEqual('http.server'); }); it('creates a span with correct description', async () => { @@ -156,7 +154,7 @@ describe('startSpan', () => { try { await startSpan({ name: 'GET users/[id]' }, () => { return startSpan({ name: 'SELECT * from users' }, childSpan => { - childSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'db.query'); + childSpan.setAttribute(SENTRY_OP, 'db.query'); return callback(); }); }); @@ -168,7 +166,7 @@ describe('startSpan', () => { const spans = getSpanDescendants(_span!); expect(spans).toHaveLength(2); - expect(spanToJSON(spans[1]!).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual('db.query'); + expect(spanToJSON(spans[1]!).attributes[SENTRY_OP]).toEqual('db.query'); }); it('correctly sets the span origin', async () => { @@ -180,7 +178,7 @@ describe('startSpan', () => { await startSpan( { name: 'GET users/[id]', - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser' }, + attributes: { [SENTRY_ORIGIN]: 'auto.http.browser' }, }, () => { return callback(); diff --git a/packages/core/test/lib/utils/spanUtils.test.ts b/packages/core/test/lib/utils/spanUtils.test.ts index e8ae4379b86f..032a09ce1667 100644 --- a/packages/core/test/lib/utils/spanUtils.test.ts +++ b/packages/core/test/lib/utils/spanUtils.test.ts @@ -1,11 +1,9 @@ -import { SENTRY_LINK_TYPE, SENTRY_STATUS_MESSAGE } from '@sentry/conventions/attributes'; +import { SENTRY_LINK_TYPE, SENTRY_STATUS_MESSAGE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, test } from 'vitest'; import { convertSpanLinksForEnvelope, getCurrentScope, Scope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, SentrySpan, setCurrentClient, @@ -344,7 +342,7 @@ describe('spanToStaticSpanJSON', () => { traceId: 'abcd', startTimestamp: 123, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', }, }); span.setStatus({ code: SPAN_STATUS_OK }); @@ -400,8 +398,8 @@ describe('spanToStaticSpanJSON', () => { attributes: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_OP]: 'test op', + [SENTRY_ORIGIN]: 'auto', }, status: { code: SPAN_STATUS_ERROR, message: 'unknown_error' }, }); @@ -417,8 +415,8 @@ describe('spanToStaticSpanJSON', () => { data: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_OP]: 'test op', + [SENTRY_ORIGIN]: 'auto', }, status: 'unknown_error', }); @@ -438,7 +436,7 @@ describe('spanToStaticSpanJSON', () => { status: 'ok', is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', }, }); }); @@ -452,7 +450,7 @@ describe('spanToStaticSpanJSON', () => { traceId: 'abcd', startTimestamp: 123, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', attr1: 'value1', attr2: 2, attr3: true, @@ -488,8 +486,8 @@ describe('spanToStaticSpanJSON', () => { attr2: 2, attr3: true, attr4: [1, 2, 3], - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_OP]: 'test op', + [SENTRY_ORIGIN]: 'auto', }, links: [ { @@ -586,8 +584,8 @@ describe('spanToStaticSpanJSON', () => { attributes: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_OP]: 'test op', + [SENTRY_ORIGIN]: 'auto', }, links: [ { @@ -616,8 +614,8 @@ describe('spanToStaticSpanJSON', () => { attributes: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_OP]: 'test op', + [SENTRY_ORIGIN]: 'auto', [SENTRY_STATUS_MESSAGE]: 'unknown_error', }, links: [ @@ -683,8 +681,8 @@ describe('spanToStaticSpanJSON', () => { attr2: 2, attr3: true, attr4: [1, 2, 3], - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_OP]: 'test op', + [SENTRY_ORIGIN]: 'auto', }, links: [ { @@ -712,8 +710,8 @@ describe('spanToStaticSpanJSON', () => { attr2: { type: 'integer', value: 2 }, attr3: { type: 'boolean', value: true }, attr4: { type: 'array', value: [1, 2, 3] }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'test op' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto' }, + [SENTRY_OP]: { type: 'string', value: 'test op' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto' }, }, links: [ { diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index 8db992d91e6a..090eca082909 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -81,7 +81,9 @@ export { supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, startSession, diff --git a/packages/deno/src/opentelemetry/tracer.ts b/packages/deno/src/opentelemetry/tracer.ts index 795f24eb9be4..e9846b994e45 100644 --- a/packages/deno/src/opentelemetry/tracer.ts +++ b/packages/deno/src/opentelemetry/tracer.ts @@ -1,6 +1,7 @@ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Context, Span, SpanOptions, Tracer, TracerProvider } from '@opentelemetry/api'; import { trace } from '@opentelemetry/api'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, startSpanManual } from '@sentry/core'; +import { startInactiveSpan, startSpanManual } from '@sentry/core'; /** * Set up a mock OTEL tracer to allow inter-op with OpenTelemetry emitted spans. @@ -34,7 +35,7 @@ class SentryDenoTracer implements Tracer { name, attributes: { ...options?.attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', 'sentry.deno_tracer': true, }, }); @@ -64,7 +65,7 @@ class SentryDenoTracer implements Tracer { name, attributes: { ...opts.attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', 'sentry.deno_tracer': true, }, }; diff --git a/packages/effect/src/logger.ts b/packages/effect/src/logger.ts index f0a55b3bf20e..a5fc7fe6923d 100644 --- a/packages/effect/src/logger.ts +++ b/packages/effect/src/logger.ts @@ -1,9 +1,10 @@ -import { isObjectLike, logger as sentryLogger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { isObjectLike, logger as sentryLogger } from '@sentry/core'; import * as Logger from 'effect/Logger'; import type * as LogLevel from 'effect/LogLevel'; const LOG_ATTRIBUTES = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.log.effect', + [SENTRY_ORIGIN]: 'auto.log.effect', }; function getLogLevelTag(logLevel: LogLevel.LogLevel): LogLevel.LogLevel | 'Warning' { diff --git a/packages/effect/src/tracer.ts b/packages/effect/src/tracer.ts index 2e72e3c61fc0..f25ce111b180 100644 --- a/packages/effect/src/tracer.ts +++ b/packages/effect/src/tracer.ts @@ -1,5 +1,5 @@ /* oxlint-disable max-lines */ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HTTP_CLIENT, HTTP_SERVER } from '@sentry/conventions/op'; import type { Span, StartSpanOptions } from '@sentry/core'; import { @@ -9,7 +9,6 @@ import { getCurrentScope, getDefaultCurrentScope, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startNewTrace, withActiveSpan, withScope, @@ -390,7 +389,7 @@ function createSentrySpan( // Setting these to `undefined` would strip the core defaults instead of leaving them in place. attributes: { ...(op && { [SENTRY_OP]: op }), - ...(origin && { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin }), + ...(origin && { [SENTRY_ORIGIN]: origin }), }, }, parent, diff --git a/packages/effect/test/tracer.test.ts b/packages/effect/test/tracer.test.ts index a7aace022282..c1f4a767da93 100644 --- a/packages/effect/test/tracer.test.ts +++ b/packages/effect/test/tracer.test.ts @@ -1,7 +1,7 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { describe, expect, it } from '@effect/vitest'; import * as sentryCore from '@sentry/core'; import * as sentryCoreBrowser from '@sentry/core/browser'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { ServerRuntimeClient } from '@sentry/core/server'; import { Effect } from 'effect'; import * as Tracer from 'effect/Tracer'; @@ -201,10 +201,10 @@ describe.each(VARIANTS)('SentryEffectTracer ($variant)', ({ variant, tracer, spa Effect.gen(function* () { const attributes = yield* attributesFor('my-operation'); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBeUndefined(); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBeUndefined(); - expect(attributes).not.toHaveProperty(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN); - expect(attributes).not.toHaveProperty(SEMANTIC_ATTRIBUTE_SENTRY_OP); + expect(attributes?.[SENTRY_ORIGIN]).toBeUndefined(); + expect(attributes?.[SENTRY_OP]).toBeUndefined(); + expect(attributes).not.toHaveProperty(SENTRY_ORIGIN); + expect(attributes).not.toHaveProperty(SENTRY_OP); }), ); @@ -212,8 +212,8 @@ describe.each(VARIANTS)('SentryEffectTracer ($variant)', ({ variant, tracer, spa Effect.gen(function* () { const attributes = yield* attributesFor('http.server GET /api/users'); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.effect'); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); + expect(attributes?.[SENTRY_ORIGIN]).toBe('auto.http.effect'); + expect(attributes?.[SENTRY_OP]).toBe('http.server'); }), ); @@ -221,8 +221,8 @@ describe.each(VARIANTS)('SentryEffectTracer ($variant)', ({ variant, tracer, spa Effect.gen(function* () { const attributes = yield* attributesFor('http.client GET https://api.example.com'); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.effect'); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.client'); + expect(attributes?.[SENTRY_ORIGIN]).toBe('auto.http.effect'); + expect(attributes?.[SENTRY_OP]).toBe('http.client'); }), ); diff --git a/packages/elysia/src/index.ts b/packages/elysia/src/index.ts index cf35f6de4eb8..17baec308ba1 100644 --- a/packages/elysia/src/index.ts +++ b/packages/elysia/src/index.ts @@ -95,7 +95,9 @@ export { getAutoPerformanceIntegrations, cron, parameterize, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, diff --git a/packages/elysia/src/withElysia.ts b/packages/elysia/src/withElysia.ts index c68c192e3fa4..ee8ac91f8cb5 100644 --- a/packages/elysia/src/withElysia.ts +++ b/packages/elysia/src/withElysia.ts @@ -5,6 +5,7 @@ import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HANDLER, HTTP_SERVER, MIDDLEWARE } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; @@ -18,8 +19,6 @@ import { getTraceData, hasSpanStreamingEnabled, REQUEST_HANDLER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, startInactiveSpan, startSpanManual, @@ -154,8 +153,8 @@ function instrumentLifecyclePhase( name: isStreamedRequestHandlerSpan ? context.route || REQUEST_HANDLER_SPAN_NAME_FALLBACK : phaseName, parentSpan: rootSpan, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, + [SENTRY_OP]: op, + [SENTRY_ORIGIN]: ELYSIA_ORIGIN, ...routeAttribute, }, }); @@ -169,8 +168,8 @@ function instrumentLifecyclePhase( name: isStreamedRequestHandlerSpan ? context.route || REQUEST_HANDLER_SPAN_NAME_FALLBACK : handlerName, parentSpan: phaseSpan, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, + [SENTRY_OP]: op, + [SENTRY_ORIGIN]: ELYSIA_ORIGIN, ...routeAttribute, // Streamed request handler spans are named after the route, so the // handler name has no other place to go. Anonymous handlers have no @@ -252,7 +251,7 @@ export function withElysia(app: T, options: ElysiaHandlerOp : `${request.method} ${new URL(request.url).pathname}`, attributes: { [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, + [SENTRY_ORIGIN]: ELYSIA_ORIGIN, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: filterCollectedUrl(request.url), [URL_PATH]: new URL(request.url).pathname, diff --git a/packages/ember/src/utils/instrumentEmberAppInstanceForPerformance.ts b/packages/ember/src/utils/instrumentEmberAppInstanceForPerformance.ts index d598c41fa834..6f3df88fab75 100644 --- a/packages/ember/src/utils/instrumentEmberAppInstanceForPerformance.ts +++ b/packages/ember/src/utils/instrumentEmberAppInstanceForPerformance.ts @@ -5,7 +5,7 @@ import type { startBrowserTracingNavigationSpan as startBrowserTracingNavigationSpanType, startBrowserTracingPageLoadSpan as startBrowserTracingPageLoadSpanType, } from '@sentry/browser'; -import { getAbsoluteUrl, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, WINDOW } from '@sentry/browser'; +import { getAbsoluteUrl, startInactiveSpan, WINDOW } from '@sentry/browser'; import { ROUTER_NAVIGATION_ROUTE_ID, SENTRY_SEGMENT_NAME_SOURCE, @@ -13,6 +13,7 @@ import { URL_FULL, URL_PATH, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { ROUTER } from '@sentry/conventions/op'; import { @@ -77,7 +78,7 @@ export function instrumentEmberAppInstanceForPerformance( : url || WINDOW.location.pathname, attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: routeInfo ? 'route' : 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.ember', + [SENTRY_ORIGIN]: 'auto.pageload.ember', ...(routeInfo?.name && { [ROUTER_NAVIGATION_ROUTE_ID]: routeInfo.name }), ...(url ? _getRouteUrlAttributes(client, url, routeInfo?.params) : {}), toRoute: routeInfo?.name, @@ -121,7 +122,7 @@ export function instrumentEmberAppInstanceForPerformance( name: transactionName, attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.ember', + [SENTRY_ORIGIN]: 'auto.navigation.ember', ...(toRoute && { [ROUTER_NAVIGATION_ROUTE_ID]: toRoute }), ...urlAttributes, fromRoute, @@ -154,7 +155,7 @@ export function instrumentEmberAppInstanceForPerformance( transitionSpan = startInactiveSpan({ attributes: { [SENTRY_OP]: ROUTER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', + [SENTRY_ORIGIN]: 'auto.ui.ember', }, // With span streaming, span names have to be low cardinality, and Ember gives us no route // template for the transition itself, so it's the fallback. diff --git a/packages/ember/src/utils/instrumentEmberGlobals.ts b/packages/ember/src/utils/instrumentEmberGlobals.ts index 498953a062f1..31c76d10af51 100644 --- a/packages/ember/src/utils/instrumentEmberGlobals.ts +++ b/packages/ember/src/utils/instrumentEmberGlobals.ts @@ -1,8 +1,8 @@ import { subscribe } from '@ember/instrumentation'; import { scheduleOnce } from '@ember/runloop'; -import { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME } from '@sentry/conventions/attributes'; +import { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { UI_MOUNT, UI_RENDER, UI_RESOLVE, UI_TASK } from '@sentry/conventions/op'; -import { getActiveSpan, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/browser'; +import { getActiveSpan, getClient, startInactiveSpan } from '@sentry/browser'; import type { Span } from '@sentry/core'; import { browserPerformanceTimeOrigin, @@ -101,7 +101,7 @@ function _instrumentEmberRunloop(config: { minimumRunloopQueueDuration?: number startInactiveSpan({ attributes: { [SENTRY_OP]: UI_TASK, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', + [SENTRY_ORIGIN]: 'auto.ui.ember', 'ember.runloop.queue': queue, ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -168,7 +168,7 @@ export function _processComponentRenderAfter( startTime: begin.now, attributes: { [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', + [SENTRY_ORIGIN]: 'auto.ui.ember', [UI_COMPONENT_NAME]: name, }, onlyIfParent: true, @@ -253,7 +253,7 @@ function _instrumentInitialLoad(): void { name: hasSpanStreaming ? UI_MOUNT_SPAN_NAME_FALLBACK : description, attributes: { [SENTRY_OP]: UI_MOUNT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', + [SENTRY_ORIGIN]: 'auto.ui.ember', ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, startTime, diff --git a/packages/ember/src/utils/instrumentRoutePerformance.ts b/packages/ember/src/utils/instrumentRoutePerformance.ts index 1515c7ed3f90..f7c2bdd77eac 100644 --- a/packages/ember/src/utils/instrumentRoutePerformance.ts +++ b/packages/ember/src/utils/instrumentRoutePerformance.ts @@ -1,7 +1,7 @@ import { startSpan } from '@sentry/browser'; -import { CODE_FUNCTION_NAME, SENTRY_DESCRIPTION, SENTRY_OP } from '@sentry/conventions/attributes'; +import { CODE_FUNCTION_NAME, SENTRY_DESCRIPTION, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; -import { getClient, hasSpanStreamingEnabled, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled } from '@sentry/core'; import type Route from '@ember/routing/route'; @@ -43,7 +43,7 @@ export function instrumentRoutePerformance(BaseRoute return startSpan( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', + [SENTRY_ORIGIN]: 'auto.ui.ember', [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: hookName, ...(isStreaming && { [SENTRY_DESCRIPTION]: fullRouteName }), diff --git a/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts b/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts index e7b1f6c7e21b..5fae82f33b51 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts @@ -8,6 +8,7 @@ import { GCP_FUNCTION_CONTEXT_SOURCE, GCP_FUNCTION_CONTEXT_SPECVERSION, GCP_FUNCTION_CONTEXT_TIME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import { @@ -15,7 +16,6 @@ import { getClient, handleCallbackErrors, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, } from '@sentry/core'; import { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node'; @@ -64,7 +64,7 @@ function _wrapCloudEventFunction( [FAAS_NAME]: functionName, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: context.type, [GCP_FUNCTION_CONTEXT_ID]: context.id, [GCP_FUNCTION_CONTEXT_SOURCE]: context.source, diff --git a/packages/google-cloud-serverless/src/gcpfunction/http.ts b/packages/google-cloud-serverless/src/gcpfunction/http.ts index a90cb8ad00fd..3775752497ef 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/http.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/http.ts @@ -5,6 +5,7 @@ import { HTTP_REQUEST_METHOD, SENTRY_OP, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import { @@ -14,7 +15,6 @@ import { hasSpanStreamingEnabled, httpRequestToRequestData, isString, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, setHttpStatus, stripUrlQueryAndFragment, @@ -73,7 +73,7 @@ function _wrapHttpFunction(fn: HttpFunction, options: Partial): [FAAS_NAME]: functionName, [FAAS_TRIGGER]: 'http', [SENTRY_SEGMENT_NAME_SOURCE]: hasSpanStreaming ? 'component' : 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', // The method and path used to be the span name; they stay on the span so that // information survives the low-cardinality rename. [HTTP_REQUEST_METHOD]: reqMethod || undefined, diff --git a/packages/google-cloud-serverless/src/index.ts b/packages/google-cloud-serverless/src/index.ts index d789d83c91a8..eb4fa0495540 100644 --- a/packages/google-cloud-serverless/src/index.ts +++ b/packages/google-cloud-serverless/src/index.ts @@ -96,7 +96,9 @@ export { getAutoPerformanceIntegrations, cron, parameterize, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts index d41e1cb38ad7..e0cb9816f13f 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts @@ -1,7 +1,7 @@ -import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { GRPC } from '@sentry/conventions/op'; import type { Client, IntegrationFn } from '@sentry/core'; -import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { defineIntegration, fill, getClient } from '@sentry/core'; import { startInactiveSpan } from '@sentry/node'; import type { EventEmitter } from 'events'; @@ -106,7 +106,7 @@ export function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodNa onlyIfParent: true, attributes: { [SENTRY_OP]: GRPC, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', + [SENTRY_ORIGIN]: 'auto.grpc.serverless', [RPC_SYSTEM_NAME]: 'grpc', [RPC_SERVICE]: serviceIdentifier, [RPC_METHOD]: methodName, diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts index 91e99e031840..6359ed876333 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts @@ -1,5 +1,12 @@ import type * as common from '@google-cloud/common'; -import { HTTP_REQUEST_METHOD, SENTRY_OP, SERVER_ADDRESS, URL_DOMAIN, URL_FULL } from '@sentry/conventions/attributes'; +import { + HTTP_REQUEST_METHOD, + SENTRY_OP, + SERVER_ADDRESS, + URL_DOMAIN, + URL_FULL, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; import type { Client, IntegrationFn } from '@sentry/core'; import { @@ -9,7 +16,6 @@ import { hasSpanStreamingEnabled, isURLObjectRelative, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, filterCollectedUrl, stripUrlQueryAndFragment, @@ -72,7 +78,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction { onlyIfParent: true, attributes: { [SENTRY_OP]: HTTP_CLIENT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless', + [SENTRY_ORIGIN]: 'auto.http.serverless', [HTTP_REQUEST_METHOD]: httpMethod, [SERVER_ADDRESS]: serverAddress, [URL_DOMAIN]: serverAddress, diff --git a/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts b/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts index 514a288f9531..a6bb52702d6a 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts @@ -8,11 +8,12 @@ import { GCP_FUNCTION_CONTEXT_SOURCE, GCP_FUNCTION_CONTEXT_SPECVERSION, GCP_FUNCTION_CONTEXT_TIME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { Client } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; +import { SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; import { wrapCloudEventFunction } from '../../src/gcpfunction/cloud_events'; import type { CloudEventFunction, CloudEventFunctionWithCallback } from '../../src/gcpfunction/general'; @@ -94,7 +95,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -126,7 +127,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -159,7 +160,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -203,7 +204,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -247,7 +248,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -276,7 +277,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -319,7 +320,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', diff --git a/packages/google-cloud-serverless/test/gcpfunction/events.test.ts b/packages/google-cloud-serverless/test/gcpfunction/events.test.ts index 95d1b6972924..c69251441b54 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/events.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/events.test.ts @@ -7,11 +7,12 @@ import { GCP_FUNCTION_CONTEXT_EVENT_ID, GCP_FUNCTION_CONTEXT_RESOURCE, GCP_FUNCTION_CONTEXT_TIMESTAMP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { Client, Event } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; +import { SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; import { wrapEventFunction } from '../../src/gcpfunction/events'; import type { EventFunction, EventFunctionWithCallback } from '../../src/gcpfunction/general'; @@ -88,7 +89,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -116,7 +117,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -149,7 +150,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -181,7 +182,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -211,7 +212,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -239,7 +240,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -268,7 +269,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', diff --git a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts index 881fc6867bd6..a0704860c8bf 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts @@ -5,11 +5,12 @@ import { HTTP_REQUEST_METHOD, SENTRY_OP, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { Client, Integration } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; +import { SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, type MockInstance, test, vi } from 'vitest'; import type { HttpFunction, Request, Response } from '../../src/gcpfunction/general'; import { wrapHttpFunction } from '../../src/gcpfunction/http'; @@ -107,7 +108,7 @@ describe('GCPFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'http', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', [HTTP_REQUEST_METHOD]: 'POST', [URL_PATH]: '/path', }, @@ -134,7 +135,7 @@ describe('GCPFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'http', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', [HTTP_REQUEST_METHOD]: 'POST', [URL_PATH]: '/path', }, diff --git a/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts b/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts index 954f186a34d4..9d9aa0dcedf7 100644 --- a/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts +++ b/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts @@ -1,5 +1,5 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; -import { createTransport, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setCurrentClient } from '@sentry/core'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { createTransport, setCurrentClient } from '@sentry/core'; import { NodeClient } from '@sentry/node'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import type { GrpcFunction, GrpcFunctionObject, Stub } from '../../src/integrations/google-cloud-grpc'; @@ -145,7 +145,7 @@ describe('GoogleCloudGrpc tracing', () => { onlyIfParent: true, attributes: { [SENTRY_OP]: 'grpc', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', + [SENTRY_ORIGIN]: 'auto.grpc.serverless', 'rpc.system.name': 'grpc', 'rpc.service': 'test-service', 'rpc.method': 'unaryMethod', diff --git a/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts b/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts index 3a0859914daf..a7d550eea515 100644 --- a/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts +++ b/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts @@ -1,7 +1,13 @@ import { BigQuery } from '@google-cloud/bigquery'; -import { HTTP_REQUEST_METHOD, SENTRY_OP, SERVER_ADDRESS, URL_DOMAIN, URL_FULL } from '@sentry/conventions/attributes'; +import { + HTTP_REQUEST_METHOD, + SENTRY_OP, + SERVER_ADDRESS, + URL_DOMAIN, + URL_FULL, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { createTransport, NodeClient, setCurrentClient } from '@sentry/node'; import * as fs from 'fs'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -93,7 +99,7 @@ describe('GoogleCloudHttp tracing', () => { onlyIfParent: true, attributes: { [SENTRY_OP]: HTTP_CLIENT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless', + [SENTRY_ORIGIN]: 'auto.http.serverless', [HTTP_REQUEST_METHOD]: 'POST', [SERVER_ADDRESS]: 'bigquery.googleapis.com', [URL_DOMAIN]: 'bigquery.googleapis.com', @@ -105,7 +111,7 @@ describe('GoogleCloudHttp tracing', () => { onlyIfParent: true, attributes: { [SENTRY_OP]: HTTP_CLIENT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless', + [SENTRY_ORIGIN]: 'auto.http.serverless', [HTTP_REQUEST_METHOD]: 'GET', [SERVER_ADDRESS]: 'bigquery.googleapis.com', [URL_DOMAIN]: 'bigquery.googleapis.com', diff --git a/packages/nestjs/src/decorators.ts b/packages/nestjs/src/decorators.ts index e4690c988d7a..4d5762481d2f 100644 --- a/packages/nestjs/src/decorators.ts +++ b/packages/nestjs/src/decorators.ts @@ -1,6 +1,6 @@ import type { MonitorConfig } from '@sentry/core'; -import { CODE_FUNCTION_NAME } from '@sentry/conventions/attributes'; -import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { CODE_FUNCTION_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { captureException } from '@sentry/core'; import * as Sentry from '@sentry/node'; import { startSpan } from '@sentry/node'; import { isExpectedError } from './helpers'; @@ -42,8 +42,8 @@ export function SentryTraced(op: string = 'function') { op: op, name: propertyKey, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', + [SENTRY_OP]: op, [CODE_FUNCTION_NAME]: propertyKey, }, }, diff --git a/packages/nestjs/src/integrations/helpers.ts b/packages/nestjs/src/integrations/helpers.ts index 8759a78b31ee..5056413e911a 100644 --- a/packages/nestjs/src/integrations/helpers.ts +++ b/packages/nestjs/src/integrations/helpers.ts @@ -5,16 +5,11 @@ import { MESSAGING_SYSTEM, SENTRY_DESCRIPTION, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, MIDDLEWARE, QUEUE_PROCESS } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; -import { - addNonEnumerableProperty, - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - withActiveSpan, -} from '@sentry/core'; +import { addNonEnumerableProperty, getClient, hasSpanStreamingEnabled, withActiveSpan } from '@sentry/core'; import type { CatchTarget, InjectableTarget, NextFunction, Observable, Subscription } from './types'; /** A function of unknown signature, matching the methods/handlers we wrap. */ @@ -100,7 +95,7 @@ export function getMiddlewareSpanOptions( name: name ?? target.name ?? 'unknown', attributes: { [SENTRY_OP]: MIDDLEWARE, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: middlewareOrigin(componentType), + [SENTRY_ORIGIN]: middlewareOrigin(componentType), }, }; } @@ -124,7 +119,7 @@ export function getEventSpanOptions(event: string): { attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: event, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.event.nestjs', + [SENTRY_ORIGIN]: 'auto.event.nestjs', // Relay infers a `function` span's description from `code.function.name` alone, which drops the prefix. ...(isStreamed && { [SENTRY_DESCRIPTION]: description }), }, @@ -157,7 +152,7 @@ export function getBullMQProcessSpanOptions(queueName: string | undefined): { name, attributes: { [SENTRY_OP]: QUEUE_PROCESS, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.queue.nestjs.bullmq', + [SENTRY_ORIGIN]: 'auto.queue.nestjs.bullmq', [MESSAGING_SYSTEM]: 'bullmq', [MESSAGING_OPERATION_TYPE]: PROCESS_OPERATION, [MESSAGING_DESTINATION_NAME]: queueName, diff --git a/packages/nestjs/src/integrations/wrap-route.ts b/packages/nestjs/src/integrations/wrap-route.ts index c65b6e2b69ce..406591804d49 100644 --- a/packages/nestjs/src/integrations/wrap-route.ts +++ b/packages/nestjs/src/integrations/wrap-route.ts @@ -4,6 +4,7 @@ import { HTTP_ROUTE, SENTRY_OP, URL_FULL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, HANDLER } from '@sentry/conventions/op'; import type { SpanAttributes } from '@sentry/core'; @@ -11,7 +12,6 @@ import { getClient, hasSpanStreamingEnabled, REQUEST_HANDLER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, filterCollectedUrl, } from '@sentry/core'; @@ -47,7 +47,7 @@ export function getAppCreationSpanOptions( attributes: { component: NESTJS_COMPONENT, [SENTRY_OP]: FUNCTION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: HTTP_ORIGIN, + [SENTRY_ORIGIN]: HTTP_ORIGIN, [AttributeNames.TYPE]: NestType.APP_CREATION, [AttributeNames.VERSION]: moduleVersion || undefined, [AttributeNames.MODULE]: moduleName || undefined, @@ -68,7 +68,7 @@ export function wrapRouteHandler(callback: AnyFn, moduleVersion?: string): AnyFn const attributes: SpanAttributes = { component: NESTJS_COMPONENT, [SENTRY_OP]: HANDLER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: HTTP_ORIGIN, + [SENTRY_ORIGIN]: HTTP_ORIGIN, [AttributeNames.TYPE]: NestType.REQUEST_HANDLER, [AttributeNames.CALLBACK]: callback.name, [AttributeNames.VERSION]: moduleVersion || undefined, @@ -111,7 +111,7 @@ export function wrapRequestContextHandler( const httpRoute = req.route?.path || req.routeOptions?.url || req.routerPath; const attributes: SpanAttributes = { component: NESTJS_COMPONENT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: HTTP_ORIGIN, + [SENTRY_ORIGIN]: HTTP_ORIGIN, [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: spanName, [AttributeNames.TYPE]: NestType.REQUEST_CONTEXT, diff --git a/packages/nestjs/test/decorators.test.ts b/packages/nestjs/test/decorators.test.ts index 9640244de437..661f00b89182 100644 --- a/packages/nestjs/test/decorators.test.ts +++ b/packages/nestjs/test/decorators.test.ts @@ -1,7 +1,6 @@ import 'reflect-metadata'; -import { CODE_FUNCTION_NAME } from '@sentry/conventions/attributes'; +import { CODE_FUNCTION_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as core from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { SentryCron, SentryExceptionCaptured, SentryTraced } from '../src/decorators'; import * as helpers from '../src/helpers'; @@ -41,8 +40,8 @@ describe('SentryTraced decorator', () => { op: 'test-operation', name: 'testMethod', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test-operation', + [SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', + [SENTRY_OP]: 'test-operation', [CODE_FUNCTION_NAME]: 'testMethod', }, }, @@ -75,8 +74,8 @@ describe('SentryTraced decorator', () => { op: 'function', // default value name: 'testDefaultOp', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', + [SENTRY_OP]: 'function', [CODE_FUNCTION_NAME]: 'testDefaultOp', }, }, @@ -109,8 +108,8 @@ describe('SentryTraced decorator', () => { op: 'sync-operation', name: 'syncMethod', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'sync-operation', + [SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', + [SENTRY_OP]: 'sync-operation', [CODE_FUNCTION_NAME]: 'syncMethod', }, }, diff --git a/packages/nestjs/test/integrations/span-origin.test.ts b/packages/nestjs/test/integrations/span-origin.test.ts index 8eba4fb68e18..b1d0f3bc551f 100644 --- a/packages/nestjs/test/integrations/span-origin.test.ts +++ b/packages/nestjs/test/integrations/span-origin.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { describe, expect, it } from 'vitest'; import { getBullMQProcessSpanOptions, @@ -8,15 +8,15 @@ import { } from '../../src/integrations/helpers'; function middlewareOrigin(componentType?: string): unknown { - return getMiddlewareSpanOptions({ name: 'X' }, undefined, componentType).attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]; + return getMiddlewareSpanOptions({ name: 'X' }, undefined, componentType).attributes[SENTRY_ORIGIN]; } function eventOrigin(): unknown { - return getEventSpanOptions('x').attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]; + return getEventSpanOptions('x').attributes[SENTRY_ORIGIN]; } function bullmqOrigin(): unknown { - return getBullMQProcessSpanOptions('q').attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]; + return getBullMQProcessSpanOptions('q').attributes[SENTRY_ORIGIN]; } describe('NestJS span origin', () => { diff --git a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts index 1a7bb8a113de..26133c1d9747 100644 --- a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts @@ -4,7 +4,6 @@ import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, filterCollectedUrl, timestampInSeconds, } from '@sentry/core'; @@ -23,6 +22,7 @@ import { URL_FULL, URL_PATH, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD } from '@sentry/conventions/op'; @@ -104,7 +104,7 @@ export function appRouterInstrumentPageLoad(client: Client): void { // pageload should always start at timeOrigin (and needs to be in s, not ms) attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.nextjs.app_router_instrumentation', + [SENTRY_ORIGIN]: 'auto.pageload.nextjs.app_router_instrumentation', [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), }, @@ -179,7 +179,7 @@ export function appRouterInstrumentNavigation(client: Client): void { name: spanName, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', + [SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', 'navigation.type': `router.${navigationType}`, ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), @@ -216,7 +216,7 @@ export function appRouterInstrumentNavigation(client: Client): void { name: spanName, startTime: traversal?.startTime, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', + [SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', 'navigation.type': traversal?.navigationType ?? 'browser.popstate', ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), @@ -313,7 +313,7 @@ function patchRouter(client: Client, router: NextRouter, currentNavigationSpanRe (hasSpanStreamingEnabled(client) ? NAVIGATION_SPAN_NAME_FALLBACK : transactionName), attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', + [SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', 'navigation.type': `router.${routerFunctionName}`, ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), diff --git a/packages/nextjs/src/client/routing/pagesRouterNavigationInstrumentation.ts b/packages/nextjs/src/client/routing/pagesRouterNavigationInstrumentation.ts index 44d842b6193a..ddd14281bfea 100644 --- a/packages/nextjs/src/client/routing/pagesRouterNavigationInstrumentation.ts +++ b/packages/nextjs/src/client/routing/pagesRouterNavigationInstrumentation.ts @@ -1,13 +1,8 @@ import type { Client, TransactionSource } from '@sentry/core'; -import { - hasSpanStreamingEnabled, - NAVIGATION_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - stripUrlQueryAndFragment, -} from '@sentry/core'; +import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, stripUrlQueryAndFragment } from '@sentry/core'; import { getAbsoluteUrl, startBrowserTracingNavigationSpan } from '@sentry/react'; import RouterImport from 'next/router'; -import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { NAVIGATION } from '@sentry/conventions/op'; import { getNextRouteFromPathname } from './pagesRouterRoutingInstrumentation'; @@ -49,7 +44,7 @@ export function pagesRouterInstrumentNavigation(client: Client): void { name: spanSource === 'route' || !hasSpanStreamingEnabled(client) ? newLocation : NAVIGATION_SPAN_NAME_FALLBACK, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.pages_router_instrumentation', + [SENTRY_ORIGIN]: 'auto.navigation.nextjs.pages_router_instrumentation', [SENTRY_SEGMENT_NAME_SOURCE]: spanSource, ...(spanSource === 'route' && { [URL_TEMPLATE]: newLocation }), }, diff --git a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts index 7a4ebaad3877..7335d0465bda 100644 --- a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts @@ -1,16 +1,10 @@ import type { Client } from '@sentry/core'; -import { - debug, - hasSpanStreamingEnabled, - PAGELOAD_SPAN_NAME_FALLBACK, - parseBaggageHeader, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '@sentry/core'; +import { debug, hasSpanStreamingEnabled, PAGELOAD_SPAN_NAME_FALLBACK, parseBaggageHeader } from '@sentry/core'; import { startBrowserTracingPageLoadSpan, WINDOW } from '@sentry/react'; import type { NEXT_DATA } from 'next/dist/shared/lib/utils'; import type { ParsedUrlQuery } from 'querystring'; import { DEBUG_BUILD } from '../../common/debug-build'; -import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { PAGELOAD } from '@sentry/conventions/op'; const globalObject = WINDOW; @@ -113,7 +107,7 @@ export function pagesRouterInstrumentPageLoad(client: Client): void { name, attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.nextjs.pages_router_instrumentation', + [SENTRY_ORIGIN]: 'auto.pageload.nextjs.pages_router_instrumentation', [SENTRY_SEGMENT_NAME_SOURCE]: route ? 'route' : 'url', ...(route && { [URL_TEMPLATE]: route }), ...(params && { ...params }), diff --git a/packages/nextjs/src/common/utils/dropMiddlewareTunnelRequests.ts b/packages/nextjs/src/common/utils/dropMiddlewareTunnelRequests.ts index a2d2ab9ac0d2..6cb11040038f 100644 --- a/packages/nextjs/src/common/utils/dropMiddlewareTunnelRequests.ts +++ b/packages/nextjs/src/common/utils/dropMiddlewareTunnelRequests.ts @@ -1,6 +1,6 @@ -import { HTTP_TARGET, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { HTTP_TARGET, URL_FULL, URL_PATH, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { RawAttributes } from '@sentry/core'; -import { getClient, GLOBAL_OBJ, isSentryRequestUrl, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, type Span } from '@sentry/core'; +import { getClient, GLOBAL_OBJ, isSentryRequestUrl, type Span } from '@sentry/core'; import { ATTR_NEXT_SPAN_TYPE } from '../nextSpanAttributes'; import { isPathnameUnderSentryTunnelRoute } from './tunnelPathnameMatch'; import { TRANSACTION_ATTR_SHOULD_DROP_TRANSACTION } from '../span-attributes-with-logic-attached'; @@ -32,7 +32,7 @@ export function dropMiddlewareTunnelRequests( const isMiddleware = attrs?.[ATTR_NEXT_SPAN_TYPE] === 'Middleware.execute'; // The fetch span could be originating from rewrites re-writing a tunnel request // So we want to filter it out - const isFetchSpan = attrs?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.http.node_fetch'; + const isFetchSpan = attrs?.[SENTRY_ORIGIN] === 'auto.http.node_fetch'; const isBaseServerHandleRequest = attrs?.[ATTR_NEXT_SPAN_TYPE] === 'BaseServer.handleRequest'; // If the span is not a middleware span, fetch span, or BaseServer.handleRequest span, return diff --git a/packages/nextjs/src/common/utils/liveRootSpanAdapter.ts b/packages/nextjs/src/common/utils/liveRootSpanAdapter.ts index e80079fe68bd..be2c8b998316 100644 --- a/packages/nextjs/src/common/utils/liveRootSpanAdapter.ts +++ b/packages/nextjs/src/common/utils/liveRootSpanAdapter.ts @@ -1,6 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToStaticSpanJSON } from '@sentry/core'; +import { spanToStaticSpanJSON } from '@sentry/core'; import type { MutableRootSpan } from '../../server/enhanceHandleRequestRootSpan'; /** @@ -24,7 +24,7 @@ export function createLiveRootSpanAdapter(span: Span): MutableRootSpan { span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); }, setOp: (op: string) => { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, op); + span.setAttribute(SENTRY_OP, op); }, }; } diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index 29b2ac5c757a..e660682282d6 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -8,7 +8,6 @@ import { getIsolationScope, handleCallbackErrors, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, startSpan, @@ -27,6 +26,7 @@ import { SENTRY_KIND, SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; @@ -138,7 +138,7 @@ async function withServerActionInstrumentationImplementation { diff --git a/packages/nextjs/src/edge/index.ts b/packages/nextjs/src/edge/index.ts index c971bbafec91..b9b53f9c7667 100644 --- a/packages/nextjs/src/edge/index.ts +++ b/packages/nextjs/src/edge/index.ts @@ -10,8 +10,6 @@ import { hasSpanStreamingEnabled, HTTP_SPAN_NAME_FALLBACK, registerSpanErrorInstrumentation, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; import type { VercelEdgeOptions } from '@sentry/vercel-edge'; @@ -41,6 +39,7 @@ import { SENTRY_KIND, SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_SERVER, MIDDLEWARE } from '@sentry/conventions/op'; @@ -159,13 +158,13 @@ export function init(options: VercelEdgeOptions = {}): void { // Mark all spans generated by Next.js as 'auto' & server if (spanAttributes?.[ATTR_NEXT_SPAN_TYPE] !== undefined) { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto'); + span.setAttribute(SENTRY_ORIGIN, 'auto'); span.setAttribute(SENTRY_KIND, 'server'); } // Make sure middleware spans get the right op if (spanAttributes?.[ATTR_NEXT_SPAN_TYPE] === 'Middleware.execute') { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, MIDDLEWARE); + span.setAttribute(SENTRY_OP, MIDDLEWARE); span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'url'); } diff --git a/packages/nextjs/src/server/handleOnSpanStart.ts b/packages/nextjs/src/server/handleOnSpanStart.ts index 5a7f3ea59772..e2e3bb933d6f 100644 --- a/packages/nextjs/src/server/handleOnSpanStart.ts +++ b/packages/nextjs/src/server/handleOnSpanStart.ts @@ -3,6 +3,7 @@ import { HTTP_METHOD, HTTP_REQUEST_METHOD, HTTP_ROUTE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { Client, Span } from '@sentry/core'; import { @@ -10,7 +11,6 @@ import { getRootSpan, hasSpanStreamingEnabled, HTTP_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; import { ATTR_NEXT_ROUTE, ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../common/nextSpanAttributes'; @@ -96,13 +96,13 @@ export function handleOnSpanStart(span: Span, client: Client): void { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }); } - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto'); + span.setAttribute(SENTRY_ORIGIN, 'auto'); } // We want to skip span data inference for any spans generated by Next.js. Reason being that Next.js emits spans // with patterns (e.g. http.server spans) that will produce confusing data. if (spanAttributes?.[ATTR_NEXT_SPAN_TYPE] !== undefined) { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto'); + span.setAttribute(SENTRY_ORIGIN, 'auto'); } if (isRootSpan) { diff --git a/packages/nextjs/test/common/liveRootSpanAdapter.test.ts b/packages/nextjs/test/common/liveRootSpanAdapter.test.ts index cd2f7a9fcac3..3e935f4fe8f9 100644 --- a/packages/nextjs/test/common/liveRootSpanAdapter.test.ts +++ b/packages/nextjs/test/common/liveRootSpanAdapter.test.ts @@ -1,5 +1,5 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SentrySpan, spanToStaticSpanJSON } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SentrySpan, spanToStaticSpanJSON } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { createLiveRootSpanAdapter } from '../../src/common/utils/liveRootSpanAdapter'; @@ -12,7 +12,7 @@ describe('createLiveRootSpanAdapter', () => { expect(adapter.attributes.foo).toBe('bar'); adapter.setOp('http.server'); - expect(spanToStaticSpanJSON(span).data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); + expect(spanToStaticSpanJSON(span).data[SENTRY_OP]).toBe('http.server'); }); it('renames the span without stamping source=custom (preserves an existing source)', () => { diff --git a/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts b/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts index c25f9d79e650..743bb32b8d02 100644 --- a/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts +++ b/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts @@ -3,8 +3,8 @@ import { HTTP_RESPONSE_STATUS_CODE, HTTP_ROUTE, HTTP_STATUS_CODE, + SENTRY_OP, } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { ATTR_NEXT_ROUTE, ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../../src/common/nextSpanAttributes'; import { TRANSACTION_ATTR_SENTRY_ROUTE_BACKFILL } from '../../src/common/span-attributes-with-logic-attached'; @@ -35,7 +35,7 @@ describe('enhanceHandleRequestRootSpan', () => { enhanceHandleRequestRootSpan(span); expect(getName()).toBe('GET /api/foo'); expect(getOp()).toBeUndefined(); - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBeUndefined(); + expect(span.attributes[SENTRY_OP]).toBeUndefined(); }); it('sets http.server op and source=route for parameterized routes', () => { @@ -50,7 +50,7 @@ describe('enhanceHandleRequestRootSpan', () => { enhanceHandleRequestRootSpan(span); expect(getOp()).toBe('http.server'); - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); + expect(span.attributes[SENTRY_OP]).toBe('http.server'); expect(getName()).toBe('GET /api/users/[id]'); expect(span.attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route'); expect(span.attributes[ATTR_NEXT_ROUTE]).toBe('/api/users/[id]'); @@ -192,14 +192,14 @@ describe('enhanceHandleRequestRootSpan', () => { name = n; }, setOp: (op: string) => { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = op; + attributes[SENTRY_OP] = op; }, }; enhanceHandleRequestRootSpan(span); expect(name).toBe('middleware GET'); - expect(attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('middleware'); + expect(attributes[SENTRY_OP]).toBe('middleware'); }); it('rewrites GET /_error using the http.target attribute', () => { diff --git a/packages/nitro/src/runtime/hooks/captureStorageEvents.ts b/packages/nitro/src/runtime/hooks/captureStorageEvents.ts index de1b9399efdf..2b768d93226d 100644 --- a/packages/nitro/src/runtime/hooks/captureStorageEvents.ts +++ b/packages/nitro/src/runtime/hooks/captureStorageEvents.ts @@ -1,5 +1,5 @@ import * as dc from 'node:diagnostics_channel'; -import { CACHE_HIT, CACHE_KEY, CACHE_OPERATION, SENTRY_OP } from '@sentry/conventions/attributes'; +import { CACHE_HIT, CACHE_KEY, CACHE_OPERATION, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { CACHE_GET, CACHE_PUT, CACHE_REMOVE } from '@sentry/conventions/op'; import { CACHE_OPERATION_NAMES, @@ -7,7 +7,6 @@ import { GLOBAL_OBJ, hasSpanStreamingEnabled, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { flushIfServerless } from '@sentry/core/server'; @@ -95,7 +94,7 @@ function setupStorageTracingChannel(operation: TracedOperation): void { attributes: { [SENTRY_OP]: OPERATION_SPAN_OPS[operation], [CACHE_OPERATION]: cacheOperationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [CACHE_KEY]: cacheKeys.length > 1 ? cacheKeys : cacheKeys[0], 'db.operation.name': operation, 'db.collection.name': mountBase(data), diff --git a/packages/nitro/src/runtime/hooks/captureTracingEvents.ts b/packages/nitro/src/runtime/hooks/captureTracingEvents.ts index da1f517acc7c..2752e2f63d79 100644 --- a/packages/nitro/src/runtime/hooks/captureTracingEvents.ts +++ b/packages/nitro/src/runtime/hooks/captureTracingEvents.ts @@ -1,5 +1,5 @@ import * as dc from 'node:diagnostics_channel'; -import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HTTP_SERVER, MIDDLEWARE } from '@sentry/conventions/op'; import { isObjectLike, @@ -12,7 +12,6 @@ import { httpHeadersToSpanAttributes, HTTP_SPAN_NAME_FALLBACK, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, type Span, startInactiveSpan, @@ -121,7 +120,7 @@ function setupH3TracingChannels(): void { : spanName, attributes: { ...urlAttributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.nitro.h3', + [SENTRY_ORIGIN]: 'auto.http.nitro.h3', [SENTRY_OP]: data?.type === 'middleware' ? MIDDLEWARE : HTTP_SERVER, }, }); @@ -199,7 +198,7 @@ function setupSrvxTracingChannels(): void { attributes: { ...urlAttributes, ...headerAttributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.nitro.srvx', + [SENTRY_ORIGIN]: 'auto.http.nitro.srvx', [SENTRY_OP]: data.middleware ? MIDDLEWARE : HTTP_SERVER, 'server.port': data.server.options.port, }, @@ -238,7 +237,7 @@ function setupSrvxTracingChannels(): void { name: `${data.middleware?.handler.name ?? 'unknown'} - ${data.request.method} ${data.request._url?.pathname}`, attributes: { ...urlAttributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.nitro.srvx', + [SENTRY_ORIGIN]: 'auto.http.nitro.srvx', [SENTRY_OP]: MIDDLEWARE, }, parentSpan: requestParentSpans.get(data.request) || undefined, diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index deed6c7c0b65..1a1105557d9f 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -113,7 +113,9 @@ export { setAttributes, setUser, setConversationId, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, diff --git a/packages/node/src/integrations/fs/vendored/instrumentation.ts b/packages/node/src/integrations/fs/vendored/instrumentation.ts index c2effd4a23f1..d341a3d9ffa3 100644 --- a/packages/node/src/integrations/fs/vendored/instrumentation.ts +++ b/packages/node/src/integrations/fs/vendored/instrumentation.ts @@ -14,12 +14,10 @@ * `error.type` (the syscall error code, e.g. `ENOENT`). */ -import { ERROR_TYPE } from '@sentry/conventions/attributes'; +import { ERROR_TYPE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { FILE } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, getActiveSpan, startInactiveSpan, @@ -101,8 +99,8 @@ function getSpanAttributes( config: FsInstrumentationConfig, ): SpanAttributes { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: SPAN_OP, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN, + [SENTRY_OP]: SPAN_OP, + [SENTRY_ORIGIN]: SPAN_ORIGIN, }; if (!config.recordFilePaths) { diff --git a/packages/node/src/integrations/http/httpServerSpansIntegration.ts b/packages/node/src/integrations/http/httpServerSpansIntegration.ts index 4712bdd61e7a..b690854c87d2 100644 --- a/packages/node/src/integrations/http/httpServerSpansIntegration.ts +++ b/packages/node/src/integrations/http/httpServerSpansIntegration.ts @@ -24,6 +24,7 @@ import { URL_QUERY, URL_SCHEME, USER_AGENT_ORIGINAL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; import type { Event, Integration, IntegrationFn, Span, SpanAttributes, SpanStatus } from '@sentry/core'; @@ -39,7 +40,6 @@ import { httpHeadersToSpanAttributes, getContentLengthFromHeaders, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, stripUrlQueryAndFragment, isTracingSuppressed, @@ -168,7 +168,7 @@ const _httpServerSpansIntegration = ((options: HttpServerSpansIntegrationOptions [SENTRY_KIND]: 'server', [SENTRY_OP]: HTTP_SERVER, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.http_server', + [SENTRY_ORIGIN]: 'auto.http.http_server', [SENTRY_HTTP_PREFETCH]: isKnownPrefetchRequest(request) || undefined, [URL_FULL]: filterCollectedUrl(fullUrl, client), [URL_PATH]: urlObj?.pathname ?? httpTargetWithoutQueryFragment, diff --git a/packages/node/src/integrations/node-fetch/undici-instrumentation.ts b/packages/node/src/integrations/node-fetch/undici-instrumentation.ts index 0def1c3be01d..4b9f9f82324c 100644 --- a/packages/node/src/integrations/node-fetch/undici-instrumentation.ts +++ b/packages/node/src/integrations/node-fetch/undici-instrumentation.ts @@ -31,7 +31,6 @@ import { parseUrl, safeCallback, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, stripDataUrlContent, @@ -59,6 +58,7 @@ import { URL_QUERY, URL_SCHEME, USER_AGENT_ORIGINAL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; import { DEBUG_BUILD } from '../../debug-build'; @@ -220,7 +220,7 @@ function onRequestCreated(config: NodeFetchOptions, { request }: RequestMessage) [URL_QUERY]: filterCollectedUrlQuery(getUrlQuery(requestUrl.search)), [URL_FRAGMENT]: getUrlFragment(requestUrl.hash), [URL_SCHEME]: urlScheme, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.node_fetch', + [SENTRY_ORIGIN]: 'auto.http.node_fetch', }; // Sanitize data URLs to prevent long base64 strings in span attributes diff --git a/packages/node/src/utils/addOriginToSpan.ts b/packages/node/src/utils/addOriginToSpan.ts index 2a23710fa7cf..afb1c8872aaf 100644 --- a/packages/node/src/utils/addOriginToSpan.ts +++ b/packages/node/src/utils/addOriginToSpan.ts @@ -1,8 +1,8 @@ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Span } from '@opentelemetry/api'; import type { SpanOrigin } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; /** Adds an origin to an OTEL Span. */ export function addOriginToSpan(span: Span, origin: SpanOrigin): void { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin); + span.setAttribute(SENTRY_ORIGIN, origin); } diff --git a/packages/node/test/integration/transactions.test.ts b/packages/node/test/integration/transactions.test.ts index a4bf5e3281ff..681c988eef10 100644 --- a/packages/node/test/integration/transactions.test.ts +++ b/packages/node/test/integration/transactions.test.ts @@ -1,7 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { context, trace, TraceFlags } from '@opentelemetry/api'; import type { ErrorEvent, TransactionEvent } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import * as Sentry from '../../src'; import { cleanupOtel, mockSdkInit } from '../helpers/mockSdkInit'; @@ -38,7 +37,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }, span => { @@ -168,7 +167,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }, span => { @@ -460,7 +459,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }, () => { diff --git a/packages/node/test/integrations/undici.test.ts b/packages/node/test/integrations/undici.test.ts index f278ccc726d7..807b16ac5468 100644 --- a/packages/node/test/integrations/undici.test.ts +++ b/packages/node/test/integrations/undici.test.ts @@ -10,8 +10,8 @@ import { URL_PATH, URL_QUERY, URL_SCHEME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { channel } from 'node:diagnostics_channel'; import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import type { UndiciRequest } from '../../src/integrations/node-fetch/types'; @@ -70,7 +70,7 @@ describe('instrumentUndici', () => { [URL_QUERY]: 'limit=10', [URL_FRAGMENT]: undefined, [URL_SCHEME]: 'https', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.node_fetch', + [SENTRY_ORIGIN]: 'auto.http.node_fetch', [SERVER_ADDRESS]: 'api.example.com', [SERVER_PORT]: 443, }, diff --git a/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts b/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts index f5adf02ea0eb..270654bb9ff8 100644 --- a/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts +++ b/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts @@ -1,11 +1,10 @@ -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { MIDDLEWARE } from '@sentry/conventions/op'; import { captureException, debug, getClient, httpHeadersToSpanAttributes, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, type SpanAttributes, @@ -134,7 +133,7 @@ function withSpan( captureException(error, { mechanism: { handled: false, - type: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], + type: attributes[SENTRY_ORIGIN], }, }); @@ -166,7 +165,7 @@ function getSpanAttributes( const attributes: SpanAttributes = { [SENTRY_OP]: MIDDLEWARE, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.middleware.nuxt', + [SENTRY_ORIGIN]: 'auto.middleware.nuxt', 'nuxt.middleware.name': middlewareName, 'nuxt.middleware.hook.name': hookName ?? 'handler', }; diff --git a/packages/nuxt/src/runtime/utils/instrumentDatabase.ts b/packages/nuxt/src/runtime/utils/instrumentDatabase.ts index 8584d7ec123c..7b7c04753d43 100644 --- a/packages/nuxt/src/runtime/utils/instrumentDatabase.ts +++ b/packages/nuxt/src/runtime/utils/instrumentDatabase.ts @@ -1,4 +1,4 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN as SENTRY_ORIGIN_ATTRIBUTE } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; import { addBreadcrumb, @@ -7,7 +7,6 @@ import { debug, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, type Span, SPAN_STATUS_ERROR, startSpan, @@ -275,7 +274,7 @@ function createStartSpanOptions( attributes: { [DB_QUERY_TEXT]: queryText, [DB_QUERY_SUMMARY]: querySummary, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SENTRY_ORIGIN, + [SENTRY_ORIGIN_ATTRIBUTE]: SENTRY_ORIGIN, [SENTRY_OP]: DB_QUERY, ...data, }, diff --git a/packages/nuxt/src/runtime/utils/instrumentStorage.ts b/packages/nuxt/src/runtime/utils/instrumentStorage.ts index 7d6cc98177fc..1480c1b7b32d 100644 --- a/packages/nuxt/src/runtime/utils/instrumentStorage.ts +++ b/packages/nuxt/src/runtime/utils/instrumentStorage.ts @@ -1,4 +1,4 @@ -import { CACHE_HIT, CACHE_KEY, CACHE_OPERATION, SENTRY_OP } from '@sentry/conventions/attributes'; +import { CACHE_HIT, CACHE_KEY, CACHE_OPERATION, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { CACHE_GET, CACHE_PUT, CACHE_REMOVE } from '@sentry/conventions/op'; import { CACHE_OPERATION_NAMES, @@ -7,7 +7,6 @@ import { getClient, hasSpanStreamingEnabled, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, type SpanAttributes, @@ -187,7 +186,7 @@ function createMethodWrapper( captureException(error, { mechanism: { handled: false, - type: options.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], + type: options.attributes?.[SENTRY_ORIGIN], }, }); @@ -239,7 +238,7 @@ function createSpanStartOptions( const attributes: SpanAttributes = { [SENTRY_OP]: cacheOperation, [CACHE_OPERATION]: cacheOperationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', + [SENTRY_ORIGIN]: 'auto.cache.nuxt', [CACHE_KEY]: keys.length > 1 ? keys : keys[0], 'db.operation.name': methodName, 'db.collection.name': mountBase.replace(/:$/, ''), diff --git a/packages/nuxt/test/runtime/hooks/updateRouteBeforeResponse.test.ts b/packages/nuxt/test/runtime/hooks/updateRouteBeforeResponse.test.ts index fec51364d935..9d6a84fa318f 100644 --- a/packages/nuxt/test/runtime/hooks/updateRouteBeforeResponse.test.ts +++ b/packages/nuxt/test/runtime/hooks/updateRouteBeforeResponse.test.ts @@ -1,5 +1,5 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; -import { getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, SentrySpan } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { getActiveSpan, SentrySpan } from '@sentry/core'; import { afterEach, describe, expect, it, type Mock, vi } from 'vitest'; import { updateRouteBeforeResponse } from '../../../src/runtime/hooks/updateRouteBeforeResponse'; @@ -15,7 +15,7 @@ vi.mock(import('@sentry/core'), async importOriginal => { describe('updateRouteBeforeResponse', () => { const mockRootSpan = new SentrySpan({ attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', }, }); mockRootSpan.updateName = vi.fn(); diff --git a/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts b/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts index d7fb10fe2eef..c91f26abf59b 100644 --- a/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts +++ b/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; import * as SentryCoreServer from '@sentry/core/server'; import type { EventHandler, EventHandlerRequest, H3Event } from 'h3'; @@ -187,7 +188,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'object-middleware', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware', + [SENTRY_OP]: 'middleware', 'nuxt.middleware.name': 'object-middleware', }), }), @@ -218,7 +219,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'request-middleware.onRequest', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware', + [SENTRY_OP]: 'middleware', 'nuxt.middleware.name': 'request-middleware', 'nuxt.middleware.hook.name': 'onRequest', }), @@ -305,7 +306,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'response-middleware.onBeforeResponse', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware', + [SENTRY_OP]: 'middleware', 'nuxt.middleware.name': 'response-middleware', 'nuxt.middleware.hook.name': 'onBeforeResponse', }), @@ -517,7 +518,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'v2-middleware.middleware', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware', + [SENTRY_OP]: 'middleware', 'nuxt.middleware.name': 'v2-middleware', 'nuxt.middleware.hook.name': 'middleware', 'nuxt.middleware.hook.index': 0, @@ -596,7 +597,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'api-middleware', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware', + [SENTRY_OP]: 'middleware', 'nuxt.middleware.name': 'api-middleware', 'http.request.method': 'GET', 'http.route': '/test-path', diff --git a/packages/opentelemetry/test/integration/transactions.test.ts b/packages/opentelemetry/test/integration/transactions.test.ts index 4ff73f163f0c..21f24a0f8555 100644 --- a/packages/opentelemetry/test/integration/transactions.test.ts +++ b/packages/opentelemetry/test/integration/transactions.test.ts @@ -1,16 +1,9 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { SpanContext } from '@opentelemetry/api'; import { context, ROOT_CONTEXT, trace, TraceFlags } from '@opentelemetry/api'; import { TraceState } from '../../src/utils/TraceState'; import type { Event, TransactionEvent } from '@sentry/core'; -import { - addBreadcrumb, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setTag, - startInactiveSpan, - startSpan, - withIsolationScope, -} from '@sentry/core'; +import { addBreadcrumb, setTag, startInactiveSpan, startSpan, withIsolationScope } from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { SENTRY_TRACE_STATE_DSC } from '../../src/constants'; import { makeTraceState } from '../../src/utils/makeTraceState'; @@ -44,7 +37,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }, span => { @@ -168,7 +161,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, @@ -324,7 +317,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, @@ -438,7 +431,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, diff --git a/packages/opentelemetry/test/trace.test.ts b/packages/opentelemetry/test/trace.test.ts index 1b967dfc051a..448692f6a505 100644 --- a/packages/opentelemetry/test/trace.test.ts +++ b/packages/opentelemetry/test/trace.test.ts @@ -1,7 +1,7 @@ /* eslint-disable typescript/no-deprecated */ import type { Span, TimeInput } from '@opentelemetry/api'; import { context, ROOT_CONTEXT, trace, TraceFlags } from '@opentelemetry/api'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_KIND } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Event, Scope } from '@sentry/core'; import { getCapturedScopesOnSpan, @@ -10,8 +10,6 @@ import { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, spanToJSON, startInactiveSpan, @@ -211,7 +209,7 @@ describe('trace', () => { span => { expect(span).toBeDefined(); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }); @@ -224,15 +222,15 @@ describe('trace', () => { op: 'my-op', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', + [SENTRY_ORIGIN]: 'auto.test.origin', }, }, span => { expect(span).toBeDefined(); expect(getSpanAttributes(span)).toEqual({ [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'my-op', + [SENTRY_ORIGIN]: 'auto.test.origin', + [SENTRY_OP]: 'my-op', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, }); }, @@ -257,7 +255,7 @@ describe('trace', () => { expect(getSpanName(span)).toEqual('outer'); expect(getSpanStartTime(span)).toEqual(date); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1', @@ -608,7 +606,7 @@ describe('trace', () => { expect(span).toBeDefined(); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }); @@ -618,7 +616,7 @@ describe('trace', () => { op: 'my-op', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', + [SENTRY_ORIGIN]: 'auto.test.origin', }, }); @@ -626,8 +624,8 @@ describe('trace', () => { expect(getSpanAttributes(span2)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'my-op', + [SENTRY_ORIGIN]: 'auto.test.origin', + [SENTRY_OP]: 'my-op', }); }); @@ -648,7 +646,7 @@ describe('trace', () => { expect(getSpanName(span)).toEqual('outer'); expect(getSpanStartTime(span)).toEqual(date); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1', @@ -981,7 +979,7 @@ describe('trace', () => { expect(getSpanName(span)).toEqual('outer'); expect(getSpanStartTime(span)).toEqual(date); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1', diff --git a/packages/react-router/src/client/createClientInstrumentation.ts b/packages/react-router/src/client/createClientInstrumentation.ts index faa39b4fbe75..fb77746120fc 100644 --- a/packages/react-router/src/client/createClientInstrumentation.ts +++ b/packages/react-router/src/client/createClientInstrumentation.ts @@ -9,7 +9,6 @@ import { GLOBAL_OBJ, hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, SPAN_STATUS_ERROR, updateSpanName, @@ -32,6 +31,7 @@ import { SENTRY_OP, URL_FULL, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, MIDDLEWARE, NAVIGATION } from '@sentry/conventions/op'; @@ -119,7 +119,7 @@ export function createSentryClientInstrumentation( attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'browser.popstate', }, }, @@ -164,7 +164,7 @@ export function createSentryClientInstrumentation( attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': navigationType, }, }, @@ -211,7 +211,7 @@ export function createSentryClientInstrumentation( attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', }, }, @@ -244,7 +244,7 @@ export function createSentryClientInstrumentation( attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'fetcher', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', // Relay infers a `function` span's description from `code.function.name` alone, which drops the key. ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -286,7 +286,7 @@ export function createSentryClientInstrumentation( attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'clientLoader', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', // Relay infers a `function` span's description from `code.function.name` alone, which drops the route. ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: routePattern }), }, @@ -320,7 +320,7 @@ export function createSentryClientInstrumentation( attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'clientAction', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', // Relay infers a `function` span's description from `code.function.name` alone, which drops the route. ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: routePattern }), }, @@ -356,7 +356,7 @@ export function createSentryClientInstrumentation( attributes: { [SENTRY_OP]: MIDDLEWARE, [CODE_FUNCTION_NAME]: 'clientMiddleware', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', 'react_router.route.id': routeId, 'http.route': routePattern, 'react_router.middleware.index': middlewareIndex, @@ -381,7 +381,7 @@ export function createSentryClientInstrumentation( attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'lazy', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, async span => { diff --git a/packages/react-router/src/client/hydratedRouter.ts b/packages/react-router/src/client/hydratedRouter.ts index 70b8e195f090..a0bc90ff72e4 100644 --- a/packages/react-router/src/client/hydratedRouter.ts +++ b/packages/react-router/src/client/hydratedRouter.ts @@ -9,7 +9,6 @@ import { hasSpanStreamingEnabled, isThenable, NAVIGATION_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; import type { DataRouter } from 'react-router'; @@ -22,7 +21,13 @@ import { resolveNavigateArg, updateSpanWithParameterizedRoute, } from './utils'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_OP, + URL_PATH, + URL_TEMPLATE, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { NAVIGATION } from '@sentry/conventions/op'; const GLOBAL_OBJ_WITH_DATA_ROUTER = GLOBAL_OBJ as typeof GLOBAL_OBJ & { @@ -58,7 +63,7 @@ export function instrumentHydratedRouter(): void { // this event is for the currently active pageload normalizePathname(router.state.location.pathname) === normalizePathname(pageloadPath) ) { - pageloadSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.pageload.react_router'); + pageloadSpan.setAttribute(SENTRY_ORIGIN, 'auto.pageload.react_router'); updateSpanWithParameterizedRoute(pageloadSpan, router.state); } } @@ -187,7 +192,7 @@ function maybeCreateNavigationTransaction(name: string, url: string, source: 'ur attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: source, [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router', + [SENTRY_ORIGIN]: 'auto.navigation.react_router', ...(source === 'route' ? { [URL_TEMPLATE]: name } : {}), }, }, diff --git a/packages/react-router/src/server/createServerInstrumentation.ts b/packages/react-router/src/server/createServerInstrumentation.ts index f6fdee0e0133..ebf16d85c87d 100644 --- a/packages/react-router/src/server/createServerInstrumentation.ts +++ b/packages/react-router/src/server/createServerInstrumentation.ts @@ -7,6 +7,7 @@ import { SENTRY_OP, URL_FULL, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, HTTP_SERVER, MIDDLEWARE } from '@sentry/conventions/op'; import { @@ -17,7 +18,6 @@ import { getRootSpan, hasSpanStreamingEnabled, HTTP_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan, updateSpanName, @@ -82,7 +82,7 @@ export function createSentryServerInstrumentation( updateSpanName(existingRootSpan, unparameterizedName); existingRootSpan.setAttributes({ [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: filterCollectedUrl(info.request.url), [URL_PATH]: pathname, @@ -106,7 +106,7 @@ export function createSentryServerInstrumentation( name: unparameterizedName, attributes: { [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [HTTP_REQUEST_METHOD]: info.request.method, [URL_PATH]: pathname, @@ -156,7 +156,7 @@ export function createSentryServerInstrumentation( attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'loader', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', // Relay infers a `function` span's description from `code.function.name` alone, which drops the route. ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: routePattern }), }, @@ -191,7 +191,7 @@ export function createSentryServerInstrumentation( attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'action', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', // Relay infers a `function` span's description from `code.function.name` alone, which drops the route. ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: routePattern }), }, @@ -237,7 +237,7 @@ export function createSentryServerInstrumentation( attributes: { [SENTRY_OP]: MIDDLEWARE, [CODE_FUNCTION_NAME]: 'middleware', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', 'react_router.route.id': routeId, [HTTP_ROUTE]: routePattern, ...(middlewareName && { 'react_router.middleware.name': middlewareName }), @@ -264,7 +264,7 @@ export function createSentryServerInstrumentation( attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'lazy', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', + [SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, async span => { diff --git a/packages/react-router/src/server/wrapSentryHandleRequest.ts b/packages/react-router/src/server/wrapSentryHandleRequest.ts index f40d56cad735..2ffeb9102cbf 100644 --- a/packages/react-router/src/server/wrapSentryHandleRequest.ts +++ b/packages/react-router/src/server/wrapSentryHandleRequest.ts @@ -1,11 +1,5 @@ -import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; -import { - getActiveSpan, - getCurrentScope, - getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - updateSpanName, -} from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { getActiveSpan, getCurrentScope, getRootSpan, updateSpanName } from '@sentry/core'; import { flushIfServerless } from '@sentry/core/server'; import type { AppLoadContext, EntryContext, RouterContextProvider } from 'react-router'; import { registerServerBuildGlobal } from './serverBuild'; @@ -95,7 +89,7 @@ export function wrapSentryHandleRequest( rootSpan.setAttributes({ [HTTP_ROUTE]: routeName, [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', + [SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', }); } } diff --git a/packages/react-router/test/server/wrapSentryHandleRequest.test.ts b/packages/react-router/test/server/wrapSentryHandleRequest.test.ts index 6fa1f2ef1026..7fa8b1066cfb 100644 --- a/packages/react-router/test/server/wrapSentryHandleRequest.test.ts +++ b/packages/react-router/test/server/wrapSentryHandleRequest.test.ts @@ -1,6 +1,6 @@ import { PassThrough } from 'node:stream'; -import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; -import { getActiveSpan, getRootSpan, getTraceMetaTags, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { getActiveSpan, getRootSpan, getTraceMetaTags } from '@sentry/core'; import { flushIfServerless } from '@sentry/core/server'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { getMetaTagTransformer } from '../../src/server/getMetaTagTransformer'; @@ -70,7 +70,7 @@ describe('wrapSentryHandleRequest', () => { expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ [HTTP_ROUTE]: '/some-path', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', + [SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', }); }); @@ -90,7 +90,7 @@ describe('wrapSentryHandleRequest', () => { expect(mockRootSpan.setAttributes).toHaveBeenLastCalledWith({ [HTTP_ROUTE]: '/', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', + [SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', }); const nestedIndexContext = { @@ -109,7 +109,7 @@ describe('wrapSentryHandleRequest', () => { expect(mockRootSpan.setAttributes).toHaveBeenLastCalledWith({ [HTTP_ROUTE]: '/dashboard', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', + [SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', }); }); diff --git a/packages/react/src/profiler.tsx b/packages/react/src/profiler.tsx index 7f2e07aaf9ec..508d9e508bdf 100644 --- a/packages/react/src/profiler.tsx +++ b/packages/react/src/profiler.tsx @@ -2,7 +2,6 @@ import { getClient, startInactiveSpan } from '@sentry/browser'; import type { Span } from '@sentry/core'; import { hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, timestampInSeconds, UI_MOUNT_SPAN_NAME_FALLBACK, @@ -10,7 +9,7 @@ import { UI_UPDATE_SPAN_NAME_FALLBACK, withActiveSpan, } from '@sentry/core'; -import { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME } from '@sentry/conventions/attributes'; +import { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { UI_MOUNT, UI_RENDER, UI_UPDATE } from '@sentry/conventions/op'; import * as React from 'react'; import { hoistNonReactStatics } from './hoist-non-react-statics'; @@ -66,7 +65,7 @@ class Profiler extends React.Component { onlyIfParent: true, attributes: { [SENTRY_OP]: UI_MOUNT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler', + [SENTRY_ORIGIN]: 'auto.ui.react.profiler', ...(componentName && { [UI_COMPONENT_NAME]: componentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -102,7 +101,7 @@ class Profiler extends React.Component { startTime: now, attributes: { [SENTRY_OP]: UI_UPDATE, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler', + [SENTRY_ORIGIN]: 'auto.ui.react.profiler', ...(componentName && { [UI_COMPONENT_NAME]: componentName }), 'ui.react.changed_props': changedProps, ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), @@ -142,7 +141,7 @@ class Profiler extends React.Component { startTime, attributes: { [SENTRY_OP]: UI_RENDER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler', + [SENTRY_ORIGIN]: 'auto.ui.react.profiler', ...(componentName && { [UI_COMPONENT_NAME]: componentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -229,7 +228,7 @@ function useProfiler( onlyIfParent: true, attributes: { [SENTRY_OP]: UI_MOUNT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler', + [SENTRY_ORIGIN]: 'auto.ui.react.profiler', ...(componentName && { [UI_COMPONENT_NAME]: componentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -257,7 +256,7 @@ function useProfiler( startTime, attributes: { [SENTRY_OP]: UI_RENDER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler', + [SENTRY_ORIGIN]: 'auto.ui.react.profiler', ...(componentName && { [UI_COMPONENT_NAME]: componentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, diff --git a/packages/react/src/reactrouter-compat-utils/instrumentation.tsx b/packages/react/src/reactrouter-compat-utils/instrumentation.tsx index ff860013dd59..629b839d11ad 100644 --- a/packages/react/src/reactrouter-compat-utils/instrumentation.tsx +++ b/packages/react/src/reactrouter-compat-utils/instrumentation.tsx @@ -18,7 +18,6 @@ import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; import * as React from 'react'; @@ -49,7 +48,7 @@ import { setNavigationContext, transactionNameHasWildcard, } from './utils'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD } from '@sentry/conventions/op'; const reactRouterConfigByClient = new WeakMap(); @@ -756,7 +755,7 @@ export function createReactRouterV6CompatibleTracingIntegration( attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter${version ? `_v${version}` : ''}`, + [SENTRY_ORIGIN]: `auto.pageload.react.reactrouter${version ? `_v${version}` : ''}`, }, }); } @@ -1078,7 +1077,7 @@ export function handleNavigation(opts: { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: source, [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter${version ? `_v${version}` : ''}`, + [SENTRY_ORIGIN]: `auto.navigation.react.reactrouter${version ? `_v${version}` : ''}`, ...(source === 'route' && { [URL_TEMPLATE]: placeholderEntry.routeName }), }, }); diff --git a/packages/react/src/reactrouter.tsx b/packages/react/src/reactrouter.tsx index 2110d4835cf0..c843c6cd3a43 100644 --- a/packages/react/src/reactrouter.tsx +++ b/packages/react/src/reactrouter.tsx @@ -12,15 +12,13 @@ import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; import type { ReactElement } from 'react'; import * as React from 'react'; import { hoistNonReactStatics } from './hoist-non-react-statics'; import type { Action, Location } from './types'; -import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD } from '@sentry/conventions/op'; // We need to disable eslint no-explicit-any because any is required for the @@ -165,7 +163,7 @@ function instrumentReactRouter( name: source === 'route' || !hasSpanStreamingEnabled(client) ? name : PAGELOAD_SPAN_NAME_FALLBACK, attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`, + [SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`, [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: name }), }, @@ -182,7 +180,7 @@ function instrumentReactRouter( name: source === 'route' || !hasSpanStreamingEnabled(client) ? name : NAVIGATION_SPAN_NAME_FALLBACK, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`, + [SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`, [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: name }), }, @@ -287,7 +285,7 @@ function getActiveRootSpan(): Span | undefined { return undefined; } - const op = spanToJSON(rootSpan).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]; + const op = spanToJSON(rootSpan).attributes[SENTRY_OP]; // Only use this root span if it is a pageload or navigation span return op === 'navigation' || op === 'pageload' ? rootSpan : undefined; diff --git a/packages/react/src/reactrouterv3.ts b/packages/react/src/reactrouterv3.ts index 7e799b742aea..501c13f0d6bb 100644 --- a/packages/react/src/reactrouterv3.ts +++ b/packages/react/src/reactrouterv3.ts @@ -5,14 +5,9 @@ import { WINDOW, } from '@sentry/browser'; import type { Integration, TransactionSource } from '@sentry/core'; -import { - hasSpanStreamingEnabled, - NAVIGATION_SPAN_NAME_FALLBACK, - PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '@sentry/core'; +import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK } from '@sentry/core'; import type { Location } from './types'; -import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD } from '@sentry/conventions/op'; // Many of the types below had to be mocked out to prevent typescript issues @@ -70,7 +65,7 @@ export function reactRouterV3BrowserTracingIntegration( name: source === 'route' || !hasSpanStreamingEnabled(client) ? localName : PAGELOAD_SPAN_NAME_FALLBACK, attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3', [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: localName }), }, @@ -93,7 +88,7 @@ export function reactRouterV3BrowserTracingIntegration( source === 'route' || !hasSpanStreamingEnabled(client) ? localName : NAVIGATION_SPAN_NAME_FALLBACK, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: localName }), }, diff --git a/packages/react/src/tanstackrouter.ts b/packages/react/src/tanstackrouter.ts index 3d4007d7d155..41eec4694aae 100644 --- a/packages/react/src/tanstackrouter.ts +++ b/packages/react/src/tanstackrouter.ts @@ -12,7 +12,6 @@ import { NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types'; import { PARAMS_KEY_BASE, @@ -22,6 +21,7 @@ import { URL_PATH, URL_PATH_PARAMETER_KEY_BASE, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD } from '@sentry/conventions/op'; @@ -104,7 +104,7 @@ export function tanstackRouterBrowserTracingIntegration( : initialWindowLocation.pathname, attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router', + [SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), @@ -161,7 +161,7 @@ export function tanstackRouterBrowserTracingIntegration( name: routeMatch ? routeMatch.routeId : fallbackName, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router', + [SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), diff --git a/packages/react/test/react-router.test.tsx b/packages/react/test/react-router.test.tsx index cb100633002f..b25323e691c2 100644 --- a/packages/react/test/react-router.test.tsx +++ b/packages/react/test/react-router.test.tsx @@ -5,14 +5,8 @@ * directly from `react` / `react-router` so `reactRouterBrowserTracingIntegration()` can be used * without passing them in. */ -import { - createTransport, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, -} from '@sentry/core'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { createTransport, getCurrentScope, setCurrentClient } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { fireEvent, render } from '@testing-library/react'; import * as React from 'react'; import { MemoryRouter, Route, Routes, useNavigate } from 'react-router'; @@ -78,9 +72,9 @@ describe('@sentry/react/react-router', () => { name: 'Pageload', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', // version-agnostic origin (no `_v6`/`_v7` suffix) - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter', }, }); expect(getCurrentScope().getScopeData().transactionName).toEqual('/about'); @@ -120,8 +114,8 @@ describe('@sentry/react/react-router', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter', }, }); }); diff --git a/packages/react/test/reactrouter-cross-usage.test.tsx b/packages/react/test/reactrouter-cross-usage.test.tsx index 3711626a27c2..580cd11841df 100644 --- a/packages/react/test/reactrouter-cross-usage.test.tsx +++ b/packages/react/test/reactrouter-cross-usage.test.tsx @@ -1,14 +1,8 @@ /** * @vitest-environment jsdom */ -import { - createTransport, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, -} from '@sentry/core'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { createTransport, getCurrentScope, setCurrentClient } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { render, waitFor } from '@testing-library/react'; import * as React from 'react'; import { act } from 'react'; @@ -667,8 +661,8 @@ describe('React Router cross usage of wrappers', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '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/settings', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -687,8 +681,8 @@ describe('React Router cross usage of wrappers', () => { const calls = mockStartBrowserTracingNavigationSpan.mock.calls; expect(calls[0]![1].name).toBe('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/settings'); expect(calls[1]![1].name).toBe('/profile'); - expect(calls[0]![1].attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('navigation'); - expect(calls[1]![1].attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('navigation'); + expect(calls[0]![1].attributes[SENTRY_OP]).toBe('navigation'); + expect(calls[1]![1].attributes[SENTRY_OP]).toBe('navigation'); }); it('should create separate transactions for rapid consecutive navigations', async () => { @@ -786,8 +780,8 @@ describe('React Router cross usage of wrappers', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/user/:id', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -808,8 +802,8 @@ describe('React Router cross usage of wrappers', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/user/:id', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -864,7 +858,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '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/settings/*', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }), }); }); @@ -912,7 +906,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenCalledWith(expect.any(BrowserClient), { name: '/details/*', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }), }); }); diff --git a/packages/react/test/reactrouter-descendant-routes.test.tsx b/packages/react/test/reactrouter-descendant-routes.test.tsx index 10804904f5e5..7f712ad0f5d7 100644 --- a/packages/react/test/reactrouter-descendant-routes.test.tsx +++ b/packages/react/test/reactrouter-descendant-routes.test.tsx @@ -1,14 +1,8 @@ /** * @vitest-environment jsdom */ -import { - createTransport, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, -} from '@sentry/core'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { createTransport, getCurrentScope, setCurrentClient } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { render } from '@testing-library/react'; import * as React from 'react'; import { @@ -177,8 +171,8 @@ describe('React Router Descendant Routes', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/child/:id', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -309,8 +303,8 @@ describe('React Router Descendant Routes', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/:orgId/:id', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -420,8 +414,8 @@ describe('React Router Descendant Routes', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -481,8 +475,8 @@ describe('React Router Descendant Routes', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -634,8 +628,8 @@ describe('React Router Descendant Routes', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); diff --git a/packages/react/test/reactrouterv3.test.tsx b/packages/react/test/reactrouterv3.test.tsx index e77d9584499b..29f54903d579 100644 --- a/packages/react/test/reactrouterv3.test.tsx +++ b/packages/react/test/reactrouterv3.test.tsx @@ -2,14 +2,8 @@ * @vitest-environment jsdom */ import { BrowserClient } from '@sentry/browser'; -import { - createTransport, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, -} from '@sentry/core'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { createTransport, getCurrentScope, setCurrentClient } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { render } from '@testing-library/react'; import * as React from 'react'; import { act } from 'react'; @@ -108,8 +102,8 @@ describe('browserTracingReactRouterV3', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3', + [SENTRY_OP]: 'pageload', }, }); }); @@ -145,8 +139,8 @@ describe('browserTracingReactRouterV3', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', + [SENTRY_OP]: 'navigation', }, }); @@ -159,8 +153,8 @@ describe('browserTracingReactRouterV3', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/features', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', + [SENTRY_OP]: 'navigation', }, }); }); @@ -201,8 +195,8 @@ describe('browserTracingReactRouterV3', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/:userid', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', + [SENTRY_OP]: 'navigation', }, }); expect(getCurrentScope().getScopeData().transactionName).toEqual('/users/:userid'); @@ -217,8 +211,8 @@ describe('browserTracingReactRouterV3', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/teams/:teamId/details', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', + [SENTRY_OP]: 'navigation', }, }); expect(getCurrentScope().getScopeData().transactionName).toEqual('/teams/:teamId/details'); diff --git a/packages/react/test/reactrouterv4.test.tsx b/packages/react/test/reactrouterv4.test.tsx index 98c4da18df5a..157e0e43efeb 100644 --- a/packages/react/test/reactrouterv4.test.tsx +++ b/packages/react/test/reactrouterv4.test.tsx @@ -1,20 +1,14 @@ /** * @vitest-environment jsdom */ -import { - createTransport, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, -} from '@sentry/core'; +import { createTransport, getCurrentScope, setCurrentClient } from '@sentry/core'; import { render } from '@testing-library/react'; import { createMemoryHistory } from 'history-4'; import * as React from 'react'; import { act } from 'react'; import { matchPath, Route, Router, Switch } from 'react-router-4'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { BrowserClient, reactRouterV4BrowserTracingIntegration, withSentryRouting } from '../src'; import type { RouteConfig } from '../src/reactrouter'; @@ -86,8 +80,8 @@ describe('browserTracingReactRouterV4', () => { name: 'Pageload', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v4', + [SENTRY_OP]: 'pageload', }, }); }); @@ -131,8 +125,8 @@ describe('browserTracingReactRouterV4', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', + [SENTRY_OP]: 'navigation', }, }); @@ -144,8 +138,8 @@ describe('browserTracingReactRouterV4', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', + [SENTRY_OP]: 'navigation', }, }); }); @@ -203,8 +197,8 @@ describe('browserTracingReactRouterV4', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', + [SENTRY_OP]: 'navigation', }, }); }); @@ -240,8 +234,8 @@ describe('browserTracingReactRouterV4', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(2); @@ -285,8 +279,8 @@ describe('browserTracingReactRouterV4', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(2); @@ -308,8 +302,8 @@ describe('browserTracingReactRouterV4', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(3); @@ -357,8 +351,8 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid/v1/:teamid', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', + [SENTRY_OP]: 'navigation', }, }); @@ -371,8 +365,8 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', + [SENTRY_OP]: 'navigation', }, }); }); diff --git a/packages/react/test/reactrouterv5.test.tsx b/packages/react/test/reactrouterv5.test.tsx index 489735c46d47..a36474c9a5a0 100644 --- a/packages/react/test/reactrouterv5.test.tsx +++ b/packages/react/test/reactrouterv5.test.tsx @@ -1,20 +1,14 @@ /** * @vitest-environment jsdom */ -import { - createTransport, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, -} from '@sentry/core'; +import { createTransport, getCurrentScope, setCurrentClient } from '@sentry/core'; import { render } from '@testing-library/react'; import { createMemoryHistory } from 'history-4'; import * as React from 'react'; import { act } from 'react'; import { matchPath, Route, Router, Switch } from 'react-router-5'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { BrowserClient, reactRouterV5BrowserTracingIntegration, withSentryRouting } from '../src'; import type { RouteConfig } from '../src/reactrouter'; @@ -86,8 +80,8 @@ describe('browserTracingReactRouterV5', () => { name: 'Pageload', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v5', + [SENTRY_OP]: 'pageload', }, }); }); @@ -131,8 +125,8 @@ describe('browserTracingReactRouterV5', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', + [SENTRY_OP]: 'navigation', }, }); @@ -144,8 +138,8 @@ describe('browserTracingReactRouterV5', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', + [SENTRY_OP]: 'navigation', }, }); }); @@ -203,8 +197,8 @@ describe('browserTracingReactRouterV5', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', + [SENTRY_OP]: 'navigation', }, }); }); @@ -240,8 +234,8 @@ describe('browserTracingReactRouterV5', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(2); @@ -285,8 +279,8 @@ describe('browserTracingReactRouterV5', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(2); @@ -308,8 +302,8 @@ describe('browserTracingReactRouterV5', () => { name: 'Navigation', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(3); @@ -356,8 +350,8 @@ describe('browserTracingReactRouterV5', () => { name: '/organizations/:orgid/v1/:teamid', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', + [SENTRY_OP]: 'navigation', [URL_TEMPLATE]: '/organizations/:orgid/v1/:teamid', }, }); @@ -370,8 +364,8 @@ describe('browserTracingReactRouterV5', () => { name: '/organizations/:orgid', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', + [SENTRY_OP]: 'navigation', [URL_TEMPLATE]: '/organizations/:orgid', }, }); diff --git a/packages/react/test/reactrouterv6.test.tsx b/packages/react/test/reactrouterv6.test.tsx index b4b94eb6c5ca..fc9e7e664644 100644 --- a/packages/react/test/reactrouterv6.test.tsx +++ b/packages/react/test/reactrouterv6.test.tsx @@ -1,14 +1,8 @@ /** * @vitest-environment jsdom */ -import { - createTransport, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, -} from '@sentry/core'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { createTransport, getCurrentScope, setCurrentClient } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { fireEvent, render } from '@testing-library/react'; import * as React from 'react'; import type { RouteObject } from 'react-router-6'; @@ -214,8 +208,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { name: 'Pageload', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, }); @@ -261,8 +255,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { name: 'Pageload', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, }); @@ -298,8 +292,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { name: 'Pageload', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, }); }); @@ -416,8 +410,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -503,8 +497,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '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/about/us', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -541,8 +535,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about/:page', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -581,8 +575,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/stores/:storeId/products/:productId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -629,8 +623,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -679,8 +673,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -731,8 +725,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -771,8 +765,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -811,8 +805,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -883,8 +877,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { name: 'Pageload', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, }); }); @@ -1035,8 +1029,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -1087,8 +1081,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '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/about/us', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -1139,8 +1133,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about/:page', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -1197,8 +1191,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/stores/:storeId/products/:productId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -1279,8 +1273,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -1359,8 +1353,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/param-page/:id/details/:superId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -1516,8 +1510,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); @@ -1556,8 +1550,8 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); }); diff --git a/packages/react/test/tanstackrouter.test.ts b/packages/react/test/tanstackrouter.test.ts index 5ae27a3550c9..4922d3c39ca8 100644 --- a/packages/react/test/tanstackrouter.test.ts +++ b/packages/react/test/tanstackrouter.test.ts @@ -1,6 +1,5 @@ import * as SentryBrowser from '@sentry/browser'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { tanstackRouterBrowserTracingIntegration } from '../src/tanstackrouter'; @@ -84,7 +83,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { expect(startBrowserTracingPageLoadSpanSpy).toHaveBeenCalledWith(mockClient, { name: '/posts/$postId', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router', + [SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/posts/$postId', 'url.path.parameter.postId': '999', diff --git a/packages/remix/src/client/performance.tsx b/packages/remix/src/client/performance.tsx index 7ee7d7654025..80132fd4a254 100644 --- a/packages/remix/src/client/performance.tsx +++ b/packages/remix/src/client/performance.tsx @@ -7,7 +7,6 @@ import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, } from '@sentry/core'; import { isNodeEnv } from '@sentry/core/server'; import type { BrowserClient, browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/react'; @@ -15,7 +14,7 @@ import { getClient, startBrowserTracingNavigationSpan, startBrowserTracingPageLo import * as React from 'react'; import { DEBUG_BUILD } from '../utils/debug-build'; import { hasManifest, maybeParameterizeRemixRoute } from './remixRouteParameterization'; -import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD } from '@sentry/conventions/op'; export type Params = { @@ -104,7 +103,7 @@ export function startPageloadSpan(client: Client): void { name: source === 'route' || !hasSpanStreamingEnabled(client) ? spanName : PAGELOAD_SPAN_NAME_FALLBACK, attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.remix', + [SENTRY_ORIGIN]: 'auto.pageload.remix', [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: spanName }), }, @@ -129,7 +128,7 @@ function startNavigationSpan(matches: RouteMatch[], location: ReturnType name: source === 'route' || !hasSpanStreamingEnabled(client) ? name : NAVIGATION_SPAN_NAME_FALLBACK, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.remix', + [SENTRY_ORIGIN]: 'auto.navigation.remix', [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: name }), }, diff --git a/packages/remix/src/cloudflare/index.ts b/packages/remix/src/cloudflare/index.ts index 543dd239a67e..e012093aaf76 100644 --- a/packages/remix/src/cloudflare/index.ts +++ b/packages/remix/src/cloudflare/index.ts @@ -106,7 +106,9 @@ export { supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, spanToStaticSpanJSON, diff --git a/packages/remix/src/server/index.ts b/packages/remix/src/server/index.ts index f18b713dac6b..d35dceb18969 100644 --- a/packages/remix/src/server/index.ts +++ b/packages/remix/src/server/index.ts @@ -84,7 +84,9 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setContext, diff --git a/packages/remix/src/server/instrumentServer.ts b/packages/remix/src/server/instrumentServer.ts index 6ec3c819c9f2..ca31c9f3894d 100644 --- a/packages/remix/src/server/instrumentServer.ts +++ b/packages/remix/src/server/instrumentServer.ts @@ -25,7 +25,6 @@ import { hasSpanStreamingEnabled, HTTP_SPAN_NAME_FALLBACK, httpHeadersToSpanAttributes, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, spanToJSON, startSpan, @@ -49,6 +48,7 @@ import { SENTRY_OP, URL_FULL, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, HTTP_SERVER } from '@sentry/conventions/op'; @@ -145,7 +145,7 @@ function makeWrappedDocumentRequestFunction(instrumentTracing?: boolean) { attributes: { method: request.method, [URL_FULL]: filterCollectedUrl(request.url), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.remix', + [SENTRY_ORIGIN]: 'auto.function.remix', [SENTRY_OP]: FUNCTION, [SENTRY_DESCRIPTION]: description, [CODE_FUNCTION_NAME]: 'documentRequest', @@ -231,7 +231,7 @@ function makeWrappedDataFunction( // module id stays on `router.navigation.route.id`. name: client && hasSpanStreamingEnabled(client) ? name : id, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.remix', + [SENTRY_ORIGIN]: 'auto.ui.remix', [SENTRY_OP]: FUNCTION, [SENTRY_DESCRIPTION]: id, [CODE_FUNCTION_NAME]: name, @@ -415,7 +415,7 @@ function wrapRequestHandler ServerBuild | Promise { name: spanName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.remix', + [SENTRY_ORIGIN]: 'auto.http.remix', [SENTRY_SEGMENT_NAME_SOURCE]: source, [SENTRY_OP]: HTTP_SERVER, [URL_FULL]: filterCollectedUrl(url.href), diff --git a/packages/remix/src/server/integrations/tracing-channel.ts b/packages/remix/src/server/integrations/tracing-channel.ts index 89c1216c9857..6ab1645ca503 100644 --- a/packages/remix/src/server/integrations/tracing-channel.ts +++ b/packages/remix/src/server/integrations/tracing-channel.ts @@ -9,7 +9,6 @@ import { isObjectLike, isURLObjectRelative, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, startInactiveSpan, waitForTracingChannelBinding, @@ -28,6 +27,7 @@ import { SENTRY_OP, HTTP_REQUEST_METHOD, HTTP_RESPONSE_STATUS_CODE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, HTTP_SERVER } from '@sentry/conventions/op'; import { remixChannels } from '@sentry/server-utils/orchestrion/config'; @@ -161,7 +161,7 @@ function subscribeRequestHandler(): void { : 'remix.request', attributes: { [SENTRY_KIND]: 'server', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: HTTP_SERVER, ...(hasUrlName && { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' }), [CODE_FUNCTION_NAME]: 'requestHandler', @@ -201,7 +201,7 @@ function subscribeCallRouteLoader(): void { // stays on `match.route.id`. name: client && hasSpanStreamingEnabled(client) ? 'loader' : description, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: FUNCTION, [SENTRY_DESCRIPTION]: description, [CODE_FUNCTION_NAME]: 'loader', @@ -240,7 +240,7 @@ function subscribeCallRouteAction(formDataCapture: FormDataCapture | undefined): // stays on `match.route.id`. name: client && hasSpanStreamingEnabled(client) ? 'action' : description, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: FUNCTION, [SENTRY_DESCRIPTION]: description, [CODE_FUNCTION_NAME]: 'action', diff --git a/packages/remix/src/v3/client/browserTracingIntegration.ts b/packages/remix/src/v3/client/browserTracingIntegration.ts index c9832db5c4cd..e5322f484320 100644 --- a/packages/remix/src/v3/client/browserTracingIntegration.ts +++ b/packages/remix/src/v3/client/browserTracingIntegration.ts @@ -3,14 +3,8 @@ import { startBrowserTracingNavigationSpan, WINDOW, } from '@sentry/browser'; -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; -import { - type Client, - hasSpanStreamingEnabled, - type Integration, - NAVIGATION_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { type Client, hasSpanStreamingEnabled, type Integration, NAVIGATION_SPAN_NAME_FALLBACK } from '@sentry/core'; type Options = Parameters[0]; @@ -57,7 +51,7 @@ function instrumentNavigationApi(client: Client): void { name: hasSpanStreamingEnabled(client) ? NAVIGATION_SPAN_NAME_FALLBACK : pathnameOf(url) || '/', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.remix_v3', + [SENTRY_ORIGIN]: 'auto.navigation.remix_v3', }, }, // The span needs the destination: `location` still points at the previous page until the diff --git a/packages/server-utils/src/ai/anthropic-ai/index.ts b/packages/server-utils/src/ai/anthropic-ai/index.ts index f45d875d8b6e..c285a043bc4c 100644 --- a/packages/server-utils/src/ai/anthropic-ai/index.ts +++ b/packages/server-utils/src/ai/anthropic-ai/index.ts @@ -1,12 +1,5 @@ /* eslint-disable typescript-eslint/no-deprecated */ -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startSpan, - startSpanManual, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startSpan, startSpanManual } from '@sentry/core'; import type { Span, SpanAttributeValue } from '@sentry/core'; import { GEN_AI_OPERATION_NAME, @@ -22,6 +15,7 @@ import { GEN_AI_RESPONSE_TEXT, GEN_AI_RESPONSE_TOOL_CALLS, GEN_AI_TOOL_DEFINITIONS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../core/gen-ai-attributes'; import type { InstrumentedMethodEntry } from '../core/utils'; @@ -56,7 +50,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: 'anthropic', [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.anthropic', + [SENTRY_ORIGIN]: 'auto.ai.anthropic', }; if (args.length > 0 && typeof args[0] === 'object' && args[0] !== null) { diff --git a/packages/server-utils/src/ai/flue/index.ts b/packages/server-utils/src/ai/flue/index.ts index 67e59c9fcdc6..7243aeb1351f 100644 --- a/packages/server-utils/src/ai/flue/index.ts +++ b/packages/server-utils/src/ai/flue/index.ts @@ -5,11 +5,15 @@ import { continueTrace, getActiveSpan, LRUMap, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, withActiveSpan, } from '@sentry/core'; -import { GEN_AI_AGENT_NAME, GEN_AI_CONVERSATION_ID, GEN_AI_OPERATION_NAME } from '@sentry/conventions/attributes'; +import { + GEN_AI_AGENT_NAME, + GEN_AI_CONVERSATION_ID, + GEN_AI_OPERATION_NAME, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { ANTHROPIC_AI_INTEGRATION_NAME } from '../anthropic-ai/constants'; import type { GenAiOptions } from '../core/utils'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../core/utils'; @@ -104,7 +108,7 @@ export function createFlueInstrumentation(options: FlueOptions = {}): FlueInstru name: `invoke_agent ${ctx.agentName ?? 'agent'}`, op: getGenAiSpanOp('invoke_agent'), attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FLUE_ORIGIN, + [SENTRY_ORIGIN]: FLUE_ORIGIN, [GEN_AI_OPERATION_NAME]: 'invoke_agent', ...(ctx.agentName ? { [GEN_AI_AGENT_NAME]: ctx.agentName } : {}), ...(ctx.conversationId ? { [GEN_AI_CONVERSATION_ID]: ctx.conversationId } : {}), diff --git a/packages/server-utils/src/ai/flue/utils.ts b/packages/server-utils/src/ai/flue/utils.ts index a1b463cbfbd7..2661eea0892c 100644 --- a/packages/server-utils/src/ai/flue/utils.ts +++ b/packages/server-utils/src/ai/flue/utils.ts @@ -1,12 +1,5 @@ import type { LRUMap, Span } from '@sentry/core'; -import { - captureException, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, - stringify, - withActiveSpan, -} from '@sentry/core'; +import { captureException, SPAN_STATUS_ERROR, startInactiveSpan, stringify, withActiveSpan } from '@sentry/core'; import { GEN_AI_CONVERSATION_ID, GEN_AI_COST_CACHE_CREATION_INPUT_TOKENS, @@ -37,6 +30,7 @@ import { GEN_AI_USAGE_TOTAL_TOKENS, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { getGenAiSpanOp } from '../core/utils'; import { FLUE_ORIGIN, MAX_TRACKED_FLUE_SPANS } from './constants'; @@ -123,7 +117,7 @@ export function startTurnSpan(observation: FlueObservation, turnSpans: SpanTrack name: 'chat', op: getGenAiSpanOp('chat'), attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FLUE_ORIGIN, + [SENTRY_ORIGIN]: FLUE_ORIGIN, [GEN_AI_OPERATION_NAME]: 'chat', ...(observation.conversationId ? { [GEN_AI_CONVERSATION_ID]: observation.conversationId } : {}), // No conventional attribute for this; it is the only way to tell a compaction turn from a @@ -237,7 +231,7 @@ export function startToolSpan(observation: FlueObservation, toolSpans: SpanTrack name: `execute_tool ${toolName ?? 'unknown'}`, op: getGenAiSpanOp('execute_tool'), attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FLUE_ORIGIN, + [SENTRY_ORIGIN]: FLUE_ORIGIN, [GEN_AI_OPERATION_NAME]: 'execute_tool', ...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}), ...(observation.conversationId ? { [GEN_AI_CONVERSATION_ID]: observation.conversationId } : {}), diff --git a/packages/server-utils/src/ai/google-genai/index.ts b/packages/server-utils/src/ai/google-genai/index.ts index 01b7cfb0f6c0..06bd425bc188 100644 --- a/packages/server-utils/src/ai/google-genai/index.ts +++ b/packages/server-utils/src/ai/google-genai/index.ts @@ -4,7 +4,6 @@ import { getClient, handleCallbackErrors, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan, startSpanManual, @@ -31,6 +30,7 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { InstrumentedMethodEntry } from '../core/utils'; import { buildMethodPath, getGenAiSpanOp, resolveAIRecordingOptions } from '../core/utils'; @@ -113,7 +113,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: GOOGLE_GENAI_SYSTEM_NAME, [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.google_genai', + [SENTRY_ORIGIN]: 'auto.ai.google_genai', }; if (params) { diff --git a/packages/server-utils/src/ai/langchain/embeddings.ts b/packages/server-utils/src/ai/langchain/embeddings.ts index 1a8f61c867f6..e1c4fd25fd9b 100644 --- a/packages/server-utils/src/ai/langchain/embeddings.ts +++ b/packages/server-utils/src/ai/langchain/embeddings.ts @@ -1,10 +1,4 @@ -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startSpan, - stringify, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, startSpan, stringify } from '@sentry/core'; import type { SpanAttributeValue } from '@sentry/core'; import { GEN_AI_EMBEDDINGS_INPUT, @@ -12,6 +6,7 @@ import { GEN_AI_PROVIDER_NAME, GEN_AI_REQUEST_MODEL, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_EMBEDDINGS } from '@sentry/conventions/op'; import { @@ -45,7 +40,7 @@ function extractEmbeddingAttributes(instance: unknown): Record const embeddingsInstance = (instance ?? {}) as Record; const attributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, + [SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, [SENTRY_OP]: GEN_AI_EMBEDDINGS, [GEN_AI_OPERATION_NAME]: 'embeddings', [GEN_AI_REQUEST_MODEL]: embeddingsInstance.model ?? 'unknown', diff --git a/packages/server-utils/src/ai/langchain/index.ts b/packages/server-utils/src/ai/langchain/index.ts index ea60eef3305e..e9d7df2a9d3d 100644 --- a/packages/server-utils/src/ai/langchain/index.ts +++ b/packages/server-utils/src/ai/langchain/index.ts @@ -1,12 +1,5 @@ /* eslint-disable max-lines */ -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startSpanManual, - stringify, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startSpanManual, stringify } from '@sentry/core'; import type { Span, SpanAttributeValue } from '@sentry/core'; import { GEN_AI_OPERATION_NAME, @@ -17,6 +10,7 @@ import { GEN_AI_TOOL_DEFINITIONS, GEN_AI_TOOL_NAME, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_CHAT, GEN_AI_EXECUTE_TOOL, GEN_AI_INVOKE_AGENT } from '@sentry/conventions/op'; import { resolveAIRecordingOptions } from '../core/utils'; @@ -227,7 +221,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): const chainName = runName || chain.name; const attributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.langchain', + [SENTRY_ORIGIN]: 'auto.ai.langchain', [GEN_AI_OPERATION_NAME]: 'invoke_agent', }; @@ -307,7 +301,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): const toolName = runName || tool.name || 'unknown_tool'; const attributes: Record = { ...getAgentNameFromMetadata(metadata), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, + [SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, [GEN_AI_OPERATION_NAME]: 'execute_tool', [GEN_AI_TOOL_NAME]: toolName, }; diff --git a/packages/server-utils/src/ai/langchain/utils.ts b/packages/server-utils/src/ai/langchain/utils.ts index 4c29d93068ec..fa5a4948d519 100644 --- a/packages/server-utils/src/ai/langchain/utils.ts +++ b/packages/server-utils/src/ai/langchain/utils.ts @@ -1,6 +1,6 @@ /* eslint-disable max-lines */ /* eslint-disable typescript-eslint/no-deprecated */ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, stringify } from '@sentry/core'; +import { stringify } from '@sentry/core'; import type { SpanAttributeValue } from '@sentry/core'; import { GEN_AI_AGENT_NAME, @@ -24,6 +24,7 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE, GEN_AI_RESPONSE_STOP_REASON_ATTRIBUTE } from '../core/gen-ai-attributes'; import { extractSystemInstructions } from '../core/utils'; @@ -227,7 +228,7 @@ function baseRequestAttributes( [GEN_AI_PROVIDER_NAME]: stringify(system ?? 'langchain', String), [GEN_AI_OPERATION_NAME]: 'chat', [GEN_AI_REQUEST_MODEL]: stringify(modelName, String), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, + [SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, ...extractCommonRequestAttributes(serialized, invocationParams, langSmithMetadata), }; } diff --git a/packages/server-utils/src/ai/langgraph/index.ts b/packages/server-utils/src/ai/langgraph/index.ts index 00825cbd6206..6795c3bd6317 100644 --- a/packages/server-utils/src/ai/langgraph/index.ts +++ b/packages/server-utils/src/ai/langgraph/index.ts @@ -1,5 +1,5 @@ /* eslint-disable typescript-eslint/no-deprecated */ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan, stringify } from '@sentry/core'; +import { SPAN_STATUS_ERROR, startSpan, stringify } from '@sentry/core'; import { GEN_AI_AGENT_NAME, GEN_AI_CONVERSATION_ID, @@ -10,6 +10,7 @@ import { GEN_AI_SYSTEM_INSTRUCTIONS, GEN_AI_TOOL_DEFINITIONS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_INVOKE_AGENT } from '@sentry/conventions/op'; import { extractSystemInstructions, resolveAIRecordingOptions } from '../core/utils'; @@ -99,7 +100,7 @@ export function instrumentCompiledGraphInvoke( { name: 'invoke_agent', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, + [SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, [SENTRY_OP]: GEN_AI_INVOKE_AGENT, [GEN_AI_OPERATION_NAME]: 'invoke_agent', }, diff --git a/packages/server-utils/src/ai/langgraph/utils.ts b/packages/server-utils/src/ai/langgraph/utils.ts index 86e43d2d33a0..94e39318d10e 100644 --- a/packages/server-utils/src/ai/langgraph/utils.ts +++ b/packages/server-utils/src/ai/langgraph/utils.ts @@ -1,5 +1,5 @@ /* eslint-disable typescript-eslint/no-deprecated */ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan } from '@sentry/core'; +import { SPAN_STATUS_ERROR, startSpan } from '@sentry/core'; import type { Span, SpanAttributes } from '@sentry/core'; import { GEN_AI_AGENT_NAME, @@ -16,6 +16,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_EXECUTE_TOOL } from '@sentry/conventions/op'; import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../core/gen-ai-attributes'; @@ -75,7 +76,7 @@ export function wrapToolsWithSpans(tools: unknown[], options: LangGraphOptions, const wrappedInvoke = new Proxy(originalInvoke as (...args: unknown[]) => unknown, { apply(target, thisArg, args: unknown[]): unknown { const spanAttributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, + [SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, [SENTRY_OP]: GEN_AI_EXECUTE_TOOL, [GEN_AI_OPERATION_NAME]: 'execute_tool', [GEN_AI_TOOL_NAME]: toolName, diff --git a/packages/server-utils/src/ai/mastra/index.ts b/packages/server-utils/src/ai/mastra/index.ts index 10ca720d976c..0bfcdd712777 100644 --- a/packages/server-utils/src/ai/mastra/index.ts +++ b/packages/server-utils/src/ai/mastra/index.ts @@ -5,12 +5,10 @@ import { getActiveSpan, getClient, LRUMap, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; -import { GEN_AI_RESPONSE_MODEL } from '@sentry/conventions/attributes'; +import { GEN_AI_RESPONSE_MODEL, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DEBUG_BUILD } from '../../debug-build'; import type { GenAiOptions } from '../core/utils'; import { resolveAIRecordingOptions } from '../core/utils'; @@ -144,8 +142,8 @@ export class SentryMastraExporter implements MastraObservabilityExporter { parentSpan: parentSpan ?? activeSpan, attributes: { ...this._attributesFor(span), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getOperation(span.type)?.op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: MASTRA_ORIGIN, + [SENTRY_OP]: getOperation(span.type)?.op, + [SENTRY_ORIGIN]: MASTRA_ORIGIN, }, }); diff --git a/packages/server-utils/src/ai/mistral/index.ts b/packages/server-utils/src/ai/mistral/index.ts index 96a335d0ebf2..4f6ba7b25f7e 100644 --- a/packages/server-utils/src/ai/mistral/index.ts +++ b/packages/server-utils/src/ai/mistral/index.ts @@ -1,10 +1,4 @@ -import { - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startSpan, - startSpanManual, - stringify, -} from '@sentry/core'; +import { SPAN_STATUS_ERROR, startSpan, startSpanManual, stringify } from '@sentry/core'; import type { Span, SpanAttributeValue } from '@sentry/core'; import { GEN_AI_AGENT_NAME, @@ -14,6 +8,7 @@ import { GEN_AI_PROVIDER_NAME, GEN_AI_SYSTEM_INSTRUCTIONS, GEN_AI_TOOL_DEFINITIONS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { InstrumentedMethodEntry } from '../core/utils'; import { @@ -55,7 +50,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: MISTRAL_PROVIDER_NAME, [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: MISTRAL_ORIGIN, + [SENTRY_ORIGIN]: MISTRAL_ORIGIN, [GEN_AI_REQUEST_STREAM_ATTRIBUTE]: streaming, }; diff --git a/packages/server-utils/src/ai/openai/index.ts b/packages/server-utils/src/ai/openai/index.ts index 7bed7ab27743..981da4281ef5 100644 --- a/packages/server-utils/src/ai/openai/index.ts +++ b/packages/server-utils/src/ai/openai/index.ts @@ -3,7 +3,6 @@ import { DEBUG_BUILD } from '../../debug-build'; import { getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan, startSpanManual, @@ -19,6 +18,7 @@ import { GEN_AI_REQUEST_MODEL, GEN_AI_SYSTEM_INSTRUCTIONS, GEN_AI_TOOL_DEFINITIONS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { InstrumentedMethodEntry } from '../core/utils'; import { @@ -67,7 +67,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_ORIGIN]: 'auto.ai.openai', }; if (args.length > 0 && typeof args[0] === 'object' && args[0] !== null) { diff --git a/packages/server-utils/src/ai/typesafe/index.ts b/packages/server-utils/src/ai/typesafe/index.ts index 328853cf5b02..0155969192d0 100644 --- a/packages/server-utils/src/ai/typesafe/index.ts +++ b/packages/server-utils/src/ai/typesafe/index.ts @@ -8,16 +8,10 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '@sentry/core'; -import { - isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, - stringify, - withActiveSpan, -} from '@sentry/core'; +import { isObjectLike, SPAN_STATUS_ERROR, startInactiveSpan, stringify, withActiveSpan } from '@sentry/core'; import type { GenAiOptions } from '../core/utils'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../core/utils'; import { TYPESAFE_ORIGIN, TYPESAFE_PROVIDER_NAME } from './constants'; @@ -45,7 +39,7 @@ function getRequestAttributes( recordInputs: boolean, ): SpanAttributes { return { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: TYPESAFE_ORIGIN, + [SENTRY_ORIGIN]: TYPESAFE_ORIGIN, [GEN_AI_OPERATION_NAME]: 'evaluate', [GEN_AI_PROVIDER_NAME]: TYPESAFE_PROVIDER_NAME, ...(model ? { [GEN_AI_REQUEST_MODEL]: model } : {}), diff --git a/packages/server-utils/src/ai/workers-ai/utils.ts b/packages/server-utils/src/ai/workers-ai/utils.ts index 67645a456988..3a9537a989bf 100644 --- a/packages/server-utils/src/ai/workers-ai/utils.ts +++ b/packages/server-utils/src/ai/workers-ai/utils.ts @@ -14,9 +14,10 @@ import { GEN_AI_RESPONSE_TEXT, GEN_AI_RESPONSE_TOOL_CALLS, GEN_AI_SYSTEM_INSTRUCTIONS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_CHAT, GEN_AI_EMBEDDINGS } from '@sentry/conventions/op'; -import { isObjectLike, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, stringify } from '@sentry/core'; +import { isObjectLike, stringify } from '@sentry/core'; import type { Span, SpanAttributeValue } from '@sentry/core'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../core/gen-ai-attributes'; import { @@ -70,7 +71,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: WORKERS_AI_PROVIDER_NAME, [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, + [SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, [GEN_AI_REQUEST_MODEL]: typeof model === 'string' ? model : 'unknown', }; diff --git a/packages/server-utils/src/integrations/amqplib.ts b/packages/server-utils/src/integrations/amqplib.ts index b67b546d8b2f..9b227d7e0e2c 100644 --- a/packages/server-utils/src/integrations/amqplib.ts +++ b/packages/server-utils/src/integrations/amqplib.ts @@ -7,7 +7,6 @@ import { getClient, getTraceData, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, timestampInSeconds, @@ -26,6 +25,7 @@ import { SERVER_ADDRESS, SERVER_PORT, URL_FULL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { QUEUE_PROCESS, QUEUE_PUBLISH } from '@sentry/conventions/op'; import { amqplibModuleNames } from '../orchestrion/config/amqplib'; @@ -464,7 +464,7 @@ function startPublishSpan(data: AmqpChannelContext): Span { [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_VALUE_SEND, [MESSAGING_MESSAGE_ID]: options?.messageId as string | undefined, [ATTR_MESSAGING_CONVERSATION_ID]: options?.correlationId as string | undefined, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PUBLISHER_ORIGIN, + [SENTRY_ORIGIN]: PUBLISHER_ORIGIN, }, }); @@ -510,7 +510,7 @@ function startConsumeSpan(queue: string | undefined, msg: ConsumeMessage, channe [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_VALUE_PROCESS, [MESSAGING_MESSAGE_ID]: msg.properties?.messageId as string | undefined, [ATTR_MESSAGING_CONVERSATION_ID]: msg.properties?.correlationId as string | undefined, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN, + [SENTRY_ORIGIN]: CONSUMER_ORIGIN, }, }); } diff --git a/packages/server-utils/src/integrations/anthropic.ts b/packages/server-utils/src/integrations/anthropic.ts index 33517d4730c2..d14d3cbb2f6a 100644 --- a/packages/server-utils/src/integrations/anthropic.ts +++ b/packages/server-utils/src/integrations/anthropic.ts @@ -1,4 +1,4 @@ -import { GEN_AI_REQUEST_MODEL } from '@sentry/conventions/attributes'; +import { GEN_AI_REQUEST_MODEL, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as diagnosticsChannel from '../utils/diagnosticsChannel'; import type { IntegrationFn, Span, SpanAttributeValue } from '@sentry/core'; import { @@ -7,7 +7,6 @@ import { getActiveSpan, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../ai/core/utils'; @@ -115,7 +114,7 @@ function createGenAiSpan( const attributes = extractRequestAttributes(args, operation, recordInputs); const model = (attributes[GEN_AI_REQUEST_MODEL] as string) || 'unknown'; - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN; + attributes[SENTRY_ORIGIN] = ORIGIN; const client = getClient(); const span = startInactiveSpan({ diff --git a/packages/server-utils/src/integrations/aws-sdk/index.ts b/packages/server-utils/src/integrations/aws-sdk/index.ts index eb966dcd56c6..25a75931deb7 100644 --- a/packages/server-utils/src/integrations/aws-sdk/index.ts +++ b/packages/server-utils/src/integrations/aws-sdk/index.ts @@ -1,12 +1,13 @@ import * as diagnosticsChannel from '../../utils/diagnosticsChannel'; import type { IntegrationFn, Span } from '@sentry/core'; -import { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { defineIntegration, startInactiveSpan } from '@sentry/core'; import { _AWS_REQUEST_ID as AWS_REQUEST_ID, AWS_REQUEST_EXTENDED_ID, CLOUD_REGION, SENTRY_KIND, HTTP_RESPONSE_STATUS_CODE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { RPC } from '@sentry/conventions/op'; import { CHANNELS } from '../../orchestrion/channels'; @@ -111,7 +112,7 @@ function instrumentAwsSdk(servicesExtensions: ServicesExtensions): void { op: requestMetadata.spanOp || RPC, attributes: { [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: AWS_SDK_ORIGIN, + [SENTRY_ORIGIN]: AWS_SDK_ORIGIN, ...extractAttributesFromNormalizedRequest(normalizedRequest), ...requestMetadata.spanAttributes, }, diff --git a/packages/server-utils/src/integrations/dataloader.ts b/packages/server-utils/src/integrations/dataloader.ts index ac928f3ceeca..89decb7338e9 100644 --- a/packages/server-utils/src/integrations/dataloader.ts +++ b/packages/server-utils/src/integrations/dataloader.ts @@ -6,6 +6,7 @@ import { DB_OPERATION_NAME, SENTRY_KIND, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { CACHE_GET, CACHE_PUT, CACHE_REMOVE } from '@sentry/conventions/op'; import type { IntegrationFn, Span, StartSpanOptions } from '@sentry/core'; @@ -15,7 +16,6 @@ import { defineIntegration, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, startSpan, waitForTracingChannelBinding, @@ -113,7 +113,7 @@ function makeSpanOptions( // the vendored OTel instrumentation. The `batch` runs off a deferred tick with no obvious network // peer, so it gets no kind. [SENTRY_KIND]: operation === 'batch' ? undefined : 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [DB_OPERATION_NAME]: operation, // A loader batches and caches one entity type, so it is the closest thing dataloader has to a // collection. Unnamed loaders report nothing. diff --git a/packages/server-utils/src/integrations/express/instrumentation.ts b/packages/server-utils/src/integrations/express/instrumentation.ts index ae442c454602..753ebbc90660 100644 --- a/packages/server-utils/src/integrations/express/instrumentation.ts +++ b/packages/server-utils/src/integrations/express/instrumentation.ts @@ -1,5 +1,5 @@ import type * as diagnosticsChannel from 'node:diagnostics_channel'; -import { HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { HTTP_ROUTE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HANDLER, MIDDLEWARE, ROUTER } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; import { @@ -12,7 +12,6 @@ import { hasSpanStreamingEnabled, REQUEST_HANDLER_SPAN_NAME_FALLBACK, ROUTER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, stringMatchesSomePattern, withActiveSpan, @@ -340,7 +339,7 @@ function getSpanForLayer(data: HandleChannelContext, options: ExpressIntegration ? matchedRoute || REQUEST_HANDLER_SPAN_NAME_FALLBACK : name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: EXPRESS_TYPE_TO_SPAN_OP[type], [ATTR_EXPRESS_NAME]: name, [ATTR_EXPRESS_TYPE]: type, diff --git a/packages/server-utils/src/integrations/fastify/instrumentation.ts b/packages/server-utils/src/integrations/fastify/instrumentation.ts index 92f71c908fe4..6d34c4f66f2d 100644 --- a/packages/server-utils/src/integrations/fastify/instrumentation.ts +++ b/packages/server-utils/src/integrations/fastify/instrumentation.ts @@ -21,6 +21,7 @@ import { HTTP_ROUTE, SENTRY_OP, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HANDLER, MIDDLEWARE } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; @@ -30,7 +31,6 @@ import { getIsolationScope, hasSpanStreamingEnabled, REQUEST_HANDLER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, startSpan, @@ -168,7 +168,7 @@ function onRequest(this: any, request: any, _reply: any, hookDone: () => void): getIsolationScope().setTransactionName(`${method} ${routeName}`); const attributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: HANDLER, [HTTP_REQUEST_METHOD]: request.method, [URL_PATH]: request.url, @@ -359,7 +359,7 @@ function handlerWrapper(handler: AnyFn, hookName: string, spanAttributes: Record attributes: { ...spanAttributes, [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }, parentSpan, }, diff --git a/packages/server-utils/src/integrations/firebase/firestore.ts b/packages/server-utils/src/integrations/firebase/firestore.ts index 161daca6abaf..43928bd504b0 100644 --- a/packages/server-utils/src/integrations/firebase/firestore.ts +++ b/packages/server-utils/src/integrations/firebase/firestore.ts @@ -8,10 +8,11 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core'; import type { FirebaseApp, FirebaseOptions, FirestoreReference, FirestoreSettings } from './firestore-types'; /** @@ -24,7 +25,7 @@ export function startFirestoreSpan(spanName: string, reference: FirestoreReferen attributes: { [SENTRY_OP]: DB_QUERY, [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.firebase.firestore', + [SENTRY_ORIGIN]: 'auto.firebase.firestore', [DB_OPERATION_NAME]: spanName, ...buildAttributes(reference), }, diff --git a/packages/server-utils/src/integrations/firebase/functions.ts b/packages/server-utils/src/integrations/firebase/functions.ts index c8a919ef6fa8..75fd439a3cd6 100644 --- a/packages/server-utils/src/integrations/firebase/functions.ts +++ b/packages/server-utils/src/integrations/firebase/functions.ts @@ -5,6 +5,7 @@ import { SENTRY_KIND, SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { SpanAttributes } from '@sentry/core'; @@ -13,7 +14,6 @@ import { flush, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, SPAN_STATUS_ERROR, startSpanManual, @@ -65,7 +65,7 @@ function wrapHandler(handler: Handler, triggerType: string): Handler { const enhancedTriggerType = `firebase.function.${triggerType}`; const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FUNCTIONS_ORIGIN, + [SENTRY_ORIGIN]: FUNCTIONS_ORIGIN, [FAAS_NAME]: functionName, [FAAS_TRIGGER]: triggerType, 'faas.provider': 'firebase', diff --git a/packages/server-utils/src/integrations/generic-pool.ts b/packages/server-utils/src/integrations/generic-pool.ts index 40d0f4c530a1..f5236f5a364c 100644 --- a/packages/server-utils/src/integrations/generic-pool.ts +++ b/packages/server-utils/src/integrations/generic-pool.ts @@ -1,8 +1,8 @@ import * as diagnosticsChannel from '../utils/diagnosticsChannel'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { IntegrationFn } from '@sentry/core'; -import { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { defineIntegration, startInactiveSpan } from '@sentry/core'; import { CHANNELS } from '../orchestrion/channels'; import { genericPoolModuleNames } from '../orchestrion/config/generic-pool'; import { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation'; @@ -41,7 +41,7 @@ function instrumentGenericPool(): void { name: 'generic-pool.acquire', attributes: { [SENTRY_OP]: DB, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.generic_pool', + [SENTRY_ORIGIN]: 'auto.db.generic_pool', }, }), ); diff --git a/packages/server-utils/src/integrations/google-genai.ts b/packages/server-utils/src/integrations/google-genai.ts index 6ddaf8757d6a..b191c503df5b 100644 --- a/packages/server-utils/src/integrations/google-genai.ts +++ b/packages/server-utils/src/integrations/google-genai.ts @@ -7,7 +7,6 @@ import { getActiveSpan, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, startInactiveSpan, } from '@sentry/core'; @@ -116,7 +115,7 @@ function createGenAiSpan( const attributes = extractRequestAttributes(operation, params, data.self, recordInputs); const model = (attributes[GEN_AI_REQUEST_MODEL] as string) || 'unknown'; - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN; + attributes[SENTRY_ORIGIN] = ORIGIN; const client = getClient(); const span = startInactiveSpan({ diff --git a/packages/server-utils/src/integrations/graphql/graphql-dc-subscriber.ts b/packages/server-utils/src/integrations/graphql/graphql-dc-subscriber.ts index 68f7c832fe14..8ea8a5d91944 100644 --- a/packages/server-utils/src/integrations/graphql/graphql-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/graphql/graphql-dc-subscriber.ts @@ -1,14 +1,13 @@ import type { TracingChannel } from 'node:diagnostics_channel'; -import { GRAPHQL_DOCUMENT, GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE } from '@sentry/conventions/attributes'; -import { GRAPHQL } from '@sentry/conventions/op'; import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, -} from '@sentry/core'; + GRAPHQL_DOCUMENT, + GRAPHQL_OPERATION_NAME, + GRAPHQL_OPERATION_TYPE, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; +import { GRAPHQL } from '@sentry/conventions/op'; +import { getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../../tracing-channel'; import { GRAPHQL_FIELD_NAME, @@ -159,8 +158,8 @@ function setupParseChannel(tracingChannel: GraphqlTracingChannelFactory): void { return startInactiveSpan({ name: client && hasSpanStreamingEnabled(client) ? `GraphQL ${PROCESSING_TYPE_PARSE}` : SPAN_NAME_PARSE, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GRAPHQL, + [SENTRY_ORIGIN]: ORIGIN, + [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_PARSE, }, }); @@ -176,8 +175,8 @@ function setupValidateChannel(tracingChannel: GraphqlTracingChannelFactory): voi return startInactiveSpan({ name: client && hasSpanStreamingEnabled(client) ? `GraphQL ${PROCESSING_TYPE_VALIDATE}` : SPAN_NAME_VALIDATE, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GRAPHQL, + [SENTRY_ORIGIN]: ORIGIN, + [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_VALIDATE, [GRAPHQL_DOCUMENT]: collectGraphqlDocument(data.document), }, @@ -212,8 +211,8 @@ function setupOperationChannel( ? streamedName : getOperationSpanName(data.operationType, data.operationName, fallbackName), attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GRAPHQL, + [SENTRY_ORIGIN]: ORIGIN, + [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_EXECUTE, [GRAPHQL_OPERATION_TYPE]: data.operationType, [GRAPHQL_OPERATION_NAME]: data.operationName || undefined, @@ -254,8 +253,8 @@ function setupResolveChannel(tracingChannel: GraphqlTracingChannelFactory, ignor ? `GraphQL ${PROCESSING_TYPE_RESOLVE}` : `${SPAN_NAME_RESOLVE} ${data.fieldPath}`, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GRAPHQL, + [SENTRY_ORIGIN]: ORIGIN, + [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_RESOLVE, [GRAPHQL_FIELD_NAME]: data.fieldName, [GRAPHQL_FIELD_PATH]: data.fieldPath, diff --git a/packages/server-utils/src/integrations/graphql/resolvers.ts b/packages/server-utils/src/integrations/graphql/resolvers.ts index 8e028d939ee8..c432b06b79ec 100644 --- a/packages/server-utils/src/integrations/graphql/resolvers.ts +++ b/packages/server-utils/src/integrations/graphql/resolvers.ts @@ -6,14 +6,13 @@ * call runs). Resolver spans use the same origin/op/field attributes as the native subscriber. */ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { GRAPHQL } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; import { getClient, hasSpanStreamingEnabled, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, withActiveSpan, @@ -182,8 +181,8 @@ function createFieldIfNotExists( function createResolverSpan(info: GraphQLResolveInfo, path: string[], parentSpan?: Span): Span { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GRAPHQL, + [SENTRY_ORIGIN]: ORIGIN, + [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_RESOLVE, [GRAPHQL_FIELD_NAME]: info.fieldName, [GRAPHQL_FIELD_PATH]: path.join('.'), diff --git a/packages/server-utils/src/integrations/graphql/spans.ts b/packages/server-utils/src/integrations/graphql/spans.ts index 16f27d8a5a9c..329407428a81 100644 --- a/packages/server-utils/src/integrations/graphql/spans.ts +++ b/packages/server-utils/src/integrations/graphql/spans.ts @@ -5,17 +5,16 @@ * arguments of the injected `parse`/`validate`/`execute` calls rather than graphql's native events. */ -import { GRAPHQL_DOCUMENT, GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE } from '@sentry/conventions/attributes'; +import { + GRAPHQL_DOCUMENT, + GRAPHQL_OPERATION_NAME, + GRAPHQL_OPERATION_TYPE, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { GRAPHQL } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startInactiveSpan } from '@sentry/core'; import type { GraphqlDocumentNode } from './types'; import { collectGraphqlDocument, getOperationSpanName, hasResultErrors, renameRootSpanWithOperation } from './utils'; import { @@ -40,8 +39,8 @@ import type { } from './types'; const BASE_ATTRIBUTES = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GRAPHQL, + [SENTRY_ORIGIN]: ORIGIN, + [SENTRY_OP]: GRAPHQL, } as const; export function startParseSpan(): Span { diff --git a/packages/server-utils/src/integrations/hapi/hapi-utils.ts b/packages/server-utils/src/integrations/hapi/hapi-utils.ts index 21c27d91eec5..5c7afa11a268 100644 --- a/packages/server-utils/src/integrations/hapi/hapi-utils.ts +++ b/packages/server-utils/src/integrations/hapi/hapi-utils.ts @@ -16,10 +16,9 @@ import { isObjectLike, REQUEST_HANDLER_SPAN_NAME_FALLBACK, ROUTER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, } from '@sentry/core'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HANDLER, MIDDLEWARE, ROUTER } from '@sentry/conventions/op'; import type { HapiRequest, @@ -179,7 +178,7 @@ function startMetadataSpan(metadata: SpanMetadata, original: () => unknown): unk attributes: { ...metadata.attributes, [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.hapi', + [SENTRY_ORIGIN]: 'auto.http.hapi', }, }, original, diff --git a/packages/server-utils/src/integrations/hono/honoIntegration.ts b/packages/server-utils/src/integrations/hono/honoIntegration.ts index 6c30f31ccafb..d62e949125ef 100644 --- a/packages/server-utils/src/integrations/hono/honoIntegration.ts +++ b/packages/server-utils/src/integrations/hono/honoIntegration.ts @@ -1,9 +1,9 @@ import * as diagnosticsChannel from '../../utils/diagnosticsChannel'; import { createRequire } from 'node:module'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; import type { IntegrationFn } from '@sentry/core'; -import { debug, defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { debug, defineIntegration, startInactiveSpan } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import type { Env, GetConnInfo, Hono, MiddlewareHandler } from './honoTypes'; import { CHANNELS } from '../../orchestrion/channels'; @@ -171,7 +171,7 @@ function instrumentInternalRequests(): void { name: `${method} ${extractPathname(input)}`, attributes: { [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, + [SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, }, }); }, diff --git a/packages/server-utils/src/integrations/hono/patchAppRequest.ts b/packages/server-utils/src/integrations/hono/patchAppRequest.ts index bc54e3716b32..15bb20cc21fd 100644 --- a/packages/server-utils/src/integrations/hono/patchAppRequest.ts +++ b/packages/server-utils/src/integrations/hono/patchAppRequest.ts @@ -1,13 +1,6 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; -import { - debug, - getActiveSpan, - getOriginalFunction, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startSpan, - type WrappedFunction, -} from '@sentry/core'; +import { debug, getActiveSpan, getOriginalFunction, startSpan, type WrappedFunction } from '@sentry/core'; import { INTERNAL_REQUEST_ORIGIN } from './constants'; import type { Env, Hono } from './honoTypes'; import { DEBUG_BUILD } from '../../debug-build'; @@ -104,7 +97,7 @@ export function patchAppRequest(app: Hono): void { onlyIfParent: true, attributes: { [SENTRY_OP]: INTERNAL_REQUEST_OP, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, + [SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, }, }, () => { diff --git a/packages/server-utils/src/integrations/hono/wrapMiddlewareSpan.ts b/packages/server-utils/src/integrations/hono/wrapMiddlewareSpan.ts index e3e451247614..86f96e05039c 100644 --- a/packages/server-utils/src/integrations/hono/wrapMiddlewareSpan.ts +++ b/packages/server-utils/src/integrations/hono/wrapMiddlewareSpan.ts @@ -1,10 +1,9 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { MIDDLEWARE } from '@sentry/conventions/op'; import { getActiveSpan, getOriginalFunction, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, type WrappedFunction, @@ -43,7 +42,7 @@ export function wrapMiddlewareWithSpan(handler: MiddlewareHandler): MiddlewareHa parentSpan: rootSpan, attributes: { [SENTRY_OP]: MIDDLEWARE, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: MIDDLEWARE_ORIGIN, + [SENTRY_ORIGIN]: MIDDLEWARE_ORIGIN, }, }); diff --git a/packages/server-utils/src/integrations/kafkajs/spans.ts b/packages/server-utils/src/integrations/kafkajs/spans.ts index 4aef66e08395..fdae5a0d46bd 100644 --- a/packages/server-utils/src/integrations/kafkajs/spans.ts +++ b/packages/server-utils/src/integrations/kafkajs/spans.ts @@ -18,6 +18,7 @@ import { MESSAGING_SYSTEM, SENTRY_KIND, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { QUEUE_PROCESS, QUEUE_PUBLISH, QUEUE_RECEIVE } from '@sentry/conventions/op'; import type { Span, SpanAttributes, SpanLink } from '@sentry/core'; @@ -26,7 +27,6 @@ import { getTraceData, hasSpanStreamingEnabled, propagationContextFromHeaders, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; @@ -135,7 +135,7 @@ export function startConsumerSpan({ topic, message, operationType, links, attrib [ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset as string | undefined, // Mirror the upstream behavior of only tagging per-message processing spans (not the batch // receiving span, which carries no message) with the auto origin. - ...(message ? { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}), + ...(message ? { [SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}), }, }); } @@ -155,7 +155,7 @@ export function startProducerSpan(topic: string, message: Message): Span { message.partition !== undefined ? String(message.partition) : undefined, [MESSAGING_OPERATION_NAME]: 'send', [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN, + [SENTRY_ORIGIN]: PRODUCER_ORIGIN, }, }); diff --git a/packages/server-utils/src/integrations/knex.ts b/packages/server-utils/src/integrations/knex.ts index 5d85d1491682..781d26aa70c8 100644 --- a/packages/server-utils/src/integrations/knex.ts +++ b/packages/server-utils/src/integrations/knex.ts @@ -10,7 +10,6 @@ import { getActiveSpan, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, truncate, @@ -28,6 +27,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import { DEBUG_BUILD } from '../debug-build'; @@ -182,7 +182,7 @@ function subscribeQuery(): void { const attributes: SpanAttributes = { [SENTRY_OP]: DB, [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, 'knex.version': data.moduleVersion, [DB_SYSTEM_NAME]: dbSystem, [ATTR_DB_SQL_TABLE]: table, diff --git a/packages/server-utils/src/integrations/koa/index.ts b/packages/server-utils/src/integrations/koa/index.ts index 3ee982041147..e3f1c10690c0 100644 --- a/packages/server-utils/src/integrations/koa/index.ts +++ b/packages/server-utils/src/integrations/koa/index.ts @@ -10,10 +10,9 @@ import { getIsolationScope, hasSpanStreamingEnabled, ROUTER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, } from '@sentry/core'; -import { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_TYPE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_TYPE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { MIDDLEWARE, ROUTER } from '@sentry/conventions/op'; import { DEBUG_BUILD } from '../../debug-build'; import { CHANNELS } from '../../orchestrion/channels'; @@ -213,7 +212,7 @@ function patchLayer( attributes: { ...metadata.attributes, [SENTRY_OP]: layerType === LAYER_TYPE.MIDDLEWARE ? MIDDLEWARE : ROUTER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }, }, () => { diff --git a/packages/server-utils/src/integrations/mistral.ts b/packages/server-utils/src/integrations/mistral.ts index 117f0f965c0b..f70d026cf358 100644 --- a/packages/server-utils/src/integrations/mistral.ts +++ b/packages/server-utils/src/integrations/mistral.ts @@ -1,11 +1,7 @@ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as diagnosticsChannel from '../utils/diagnosticsChannel'; import type { IntegrationFn, Span, SpanAttributeValue } from '@sentry/core'; -import { - _INTERNAL_shouldSkipAiProviderWrapping, - defineIntegration, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { _INTERNAL_shouldSkipAiProviderWrapping, defineIntegration, startInactiveSpan } from '@sentry/core'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../ai/core/utils'; import { addRequestAttributes, extractRequestAttributes } from '../ai/mistral'; import { MISTRAL_INTEGRATION_NAME, MISTRAL_ORIGIN } from '../ai/mistral/constants'; @@ -86,7 +82,7 @@ function createGenAiSpan( const { recordInputs } = resolveAIRecordingOptions(options); const attributes = extractRequestAttributes(args, operation, recordInputs, streaming); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = MISTRAL_ORIGIN; + attributes[SENTRY_ORIGIN] = MISTRAL_ORIGIN; const span = startInactiveSpan({ name: getSpanName(operation, attributes), diff --git a/packages/server-utils/src/integrations/mongodb/mongodb-span.ts b/packages/server-utils/src/integrations/mongodb/mongodb-span.ts index 455b86653ac5..2f0a86721314 100644 --- a/packages/server-utils/src/integrations/mongodb/mongodb-span.ts +++ b/packages/server-utils/src/integrations/mongodb/mongodb-span.ts @@ -8,16 +8,11 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { - getClient, - hasSpanStreamingEnabled, - isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from '@sentry/core'; // `db.connection_string` is not part of `@sentry/conventions`, so it stays inlined to match // what `@opentelemetry/instrumentation-mongodb` emitted. @@ -127,7 +122,7 @@ export function getSpanAttributes( origin: string, ): SpanAttributes { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, + [SENTRY_ORIGIN]: origin, [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MONGODB, [DB_NAMESPACE]: dbName, [DB_COLLECTION_NAME]: dbCollection, diff --git a/packages/server-utils/src/integrations/mongoose/mongoose-dc-subscriber.ts b/packages/server-utils/src/integrations/mongoose/mongoose-dc-subscriber.ts index 7e4230b84fbe..9739ba070096 100644 --- a/packages/server-utils/src/integrations/mongoose/mongoose-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/mongoose/mongoose-dc-subscriber.ts @@ -9,16 +9,10 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { - debug, - getClient, - hasSpanStreamingEnabled, - isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { debug, getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import { bindTracingChannelToSpan } from '../../tracing-channel'; @@ -138,7 +132,7 @@ function setupChannel(tracingChannel: MongooseTracingChannelFactory, channelName return startInactiveSpan({ name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB, [DB_OPERATION_NAME]: data.operation, diff --git a/packages/server-utils/src/integrations/mongoose/mongoose-legacy-span.ts b/packages/server-utils/src/integrations/mongoose/mongoose-legacy-span.ts index b279343435f8..d22e7c8a1063 100644 --- a/packages/server-utils/src/integrations/mongoose/mongoose-legacy-span.ts +++ b/packages/server-utils/src/integrations/mongoose/mongoose-legacy-span.ts @@ -8,10 +8,11 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { getClient, hasSpanStreamingEnabled, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, startInactiveSpan } from '@sentry/core'; const DB_SYSTEM_NAME_VALUE_MONGODB = 'mongodb'; @@ -59,7 +60,7 @@ export function startMongooseLegacySpan({ [SERVER_PORT]: collection?.conn?.port, [DB_OPERATION_NAME]: operation, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, + [SENTRY_ORIGIN]: origin, }; const client = getClient(); diff --git a/packages/server-utils/src/integrations/mysql.ts b/packages/server-utils/src/integrations/mysql.ts index ccbbad5a1565..e4049b65d30a 100644 --- a/packages/server-utils/src/integrations/mysql.ts +++ b/packages/server-utils/src/integrations/mysql.ts @@ -9,6 +9,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { IntegrationFn, Scope } from '@sentry/core'; @@ -19,7 +20,6 @@ import { getClient, getCurrentScope, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { sanitizeSqlQueryWithSummary } from '../utils/sql'; @@ -102,7 +102,7 @@ function instrumentMysql(): void { [SENTRY_OP]: DB, [SENTRY_KIND]: 'client', [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.mysql', + [SENTRY_ORIGIN]: 'auto.db.mysql', [ATTR_DB_CONNECTION_STRING]: getJDBCString(host, portIsNumber ? portNumber : undefined, database), ...(database ? { [DB_NAMESPACE]: database } : {}), ...(user ? { [DB_USER]: user } : {}), diff --git a/packages/server-utils/src/integrations/mysql2/index.ts b/packages/server-utils/src/integrations/mysql2/index.ts index 4d01b681f1ce..b8f6501a26ba 100644 --- a/packages/server-utils/src/integrations/mysql2/index.ts +++ b/packages/server-utils/src/integrations/mysql2/index.ts @@ -5,7 +5,6 @@ import { getClient, hasSpanStreamingEnabled, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, waitForTracingChannelBinding, } from '@sentry/core'; @@ -26,6 +25,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; @@ -96,7 +96,7 @@ function subscribeQueryChannel(channelName: ChannelName): void { name, attributes: { [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MYSQL, [DB_QUERY_TEXT]: queryText || undefined, diff --git a/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts b/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts index 71264c73565f..6ba7d1699d01 100644 --- a/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts @@ -8,9 +8,10 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { getClient, hasSpanStreamingEnabled, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../../tracing-channel'; import { sanitizeSqlQueryWithSummary } from '../../utils/sql'; @@ -109,7 +110,7 @@ function setupQueryChannel(tracingChannel: MySQL2TracingChannelFactory, channelN return startInactiveSpan({ name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL, [DB_QUERY_TEXT]: queryText, @@ -132,7 +133,7 @@ function setupConnectChannel(tracingChannel: MySQL2TracingChannelFactory, channe return startInactiveSpan({ name: spanName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL, [DB_NAMESPACE]: data.database || undefined, diff --git a/packages/server-utils/src/integrations/openai-compatible.ts b/packages/server-utils/src/integrations/openai-compatible.ts index be98c3de7a9e..2c23c711b60f 100644 --- a/packages/server-utils/src/integrations/openai-compatible.ts +++ b/packages/server-utils/src/integrations/openai-compatible.ts @@ -4,10 +4,9 @@ import { _INTERNAL_shouldSkipAiProviderWrapping, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; -import { GEN_AI_PROVIDER_NAME } from '@sentry/conventions/attributes'; +import { GEN_AI_PROVIDER_NAME, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../ai/core/utils'; import { wrapApiPromiseResponse } from '../ai/core/apiPromise'; import { addRequestAttributes, extractRequestAttributes } from '../ai/openai'; @@ -117,7 +116,7 @@ function createGenAiSpan( // `extractRequestAttributes` defaults the provider to openai; override it for the concrete provider. const attributes = extractRequestAttributes(args, operation, recordInputs); attributes[GEN_AI_PROVIDER_NAME] = provider.providerName; - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = provider.origin; + attributes[SENTRY_ORIGIN] = provider.origin; const model = (params?.model as string) || 'unknown'; const client = getClient(); diff --git a/packages/server-utils/src/integrations/openai.ts b/packages/server-utils/src/integrations/openai.ts index ada6e60411a2..a5375794033e 100644 --- a/packages/server-utils/src/integrations/openai.ts +++ b/packages/server-utils/src/integrations/openai.ts @@ -1,3 +1,4 @@ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as diagnosticsChannel from '../utils/diagnosticsChannel'; import type { IntegrationFn, Span, SpanAttributeValue } from '@sentry/core'; import { @@ -5,7 +6,6 @@ import { defineIntegration, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../ai/core/utils'; @@ -93,7 +93,7 @@ function createGenAiSpan(data: OpenAiChatChannelContext, operation: string, opti const { recordInputs } = resolveAIRecordingOptions(options); const attributes = extractRequestAttributes(args, operation, recordInputs); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN; + attributes[SENTRY_ORIGIN] = ORIGIN; const model = (params?.model as string) || 'unknown'; const client = getClient(); diff --git a/packages/server-utils/src/integrations/postgres-js.ts b/packages/server-utils/src/integrations/postgres-js.ts index afb8d5ecc099..5d3b865cd20d 100644 --- a/packages/server-utils/src/integrations/postgres-js.ts +++ b/packages/server-utils/src/integrations/postgres-js.ts @@ -7,6 +7,7 @@ import { ERROR_TYPE, SENTRY_KIND, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { IntegrationFn, Span } from '@sentry/core'; @@ -15,7 +16,6 @@ import { defineIntegration, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; @@ -299,7 +299,7 @@ function instrumentPostgresJs(options: PostgresJsIntegrationOptions): void { attributes: { [SENTRY_OP]: DB, [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES, [DB_QUERY_TEXT]: sanitizedSqlQuery, [DB_QUERY_SUMMARY]: querySummary, diff --git a/packages/server-utils/src/integrations/postgres.ts b/packages/server-utils/src/integrations/postgres.ts index 1e7f0fdeb018..5d93ac17769f 100644 --- a/packages/server-utils/src/integrations/postgres.ts +++ b/packages/server-utils/src/integrations/postgres.ts @@ -9,6 +9,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { IntegrationFn, Scope, SpanAttributes } from '@sentry/core'; @@ -19,7 +20,6 @@ import { getClient, getCurrentScope, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { sanitizeSqlQueryWithSummary } from '../utils/sql'; @@ -191,7 +191,7 @@ function querySpanOptions(ctx: PgChannelContext): { name: string; attributes: Sp attributes: { [SENTRY_OP]: DB, ...getConnectionAttributes(params), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [DB_QUERY_TEXT]: queryText || undefined, [DB_QUERY_SUMMARY]: querySummary, [ATTR_PG_PLAN]: typeof queryConfig?.name === 'string' ? queryConfig.name : undefined, diff --git a/packages/server-utils/src/integrations/prisma/orchestrion.ts b/packages/server-utils/src/integrations/prisma/orchestrion.ts index b85f7c7d8d45..656b7cf8fc75 100644 --- a/packages/server-utils/src/integrations/prisma/orchestrion.ts +++ b/packages/server-utils/src/integrations/prisma/orchestrion.ts @@ -1,14 +1,7 @@ import * as diagnosticsChannel from '../../utils/diagnosticsChannel'; import type { Span } from '@sentry/core'; -import { - getActiveSpan, - getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - spanIsIgnored, - startInactiveSpan, - withActiveSpan, -} from '@sentry/core'; -import { DB_COLLECTION_NAME, DB_OPERATION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { getActiveSpan, getRootSpan, spanIsIgnored, startInactiveSpan, withActiveSpan } from '@sentry/core'; +import { DB_COLLECTION_NAME, DB_OPERATION_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import { prismaChannels, PRISMA_LAZY_TERMINALS } from '../../orchestrion/config/prisma'; import type { TracingChannelLifeCycleOptions } from '../../tracing-channel'; @@ -84,7 +77,7 @@ function startOperationSpan(method: string, data: PrismaTerminalChannelContext): name: OPERATION_SPAN_NAME, parentSpan, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRISMA_ORIGIN, + [SENTRY_ORIGIN]: PRISMA_ORIGIN, [SENTRY_OP]: DB, [DB_OPERATION_NAME]: method, [DB_COLLECTION_NAME]: table ?? model, diff --git a/packages/server-utils/src/integrations/prisma/tracing-helper.ts b/packages/server-utils/src/integrations/prisma/tracing-helper.ts index 0cfe6cf471d0..218e7c788134 100644 --- a/packages/server-utils/src/integrations/prisma/tracing-helper.ts +++ b/packages/server-utils/src/integrations/prisma/tracing-helper.ts @@ -20,7 +20,6 @@ import { getClient, hasSpanStreamingEnabled, LRUMap, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, startSpanManual, } from '@sentry/core'; @@ -34,6 +33,7 @@ import { DB_SYSTEM_NAME, SENTRY_KIND, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { getSqlQuerySummary, sanitizeSqlQuery, type SqlDialect, toSqlDialect } from '../../utils/sql'; @@ -98,7 +98,7 @@ function registerPrismaSpan(id: string, span: Span): void { function buildSpanAttributes(name: string, attributes: Record | undefined): SpanAttributes { const merged: SpanAttributes = { ...(attributes as SpanAttributes | undefined), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRISMA_ORIGIN, + [SENTRY_ORIGIN]: PRISMA_ORIGIN, }; // Prisma itself emits the deprecated `db.system` on older versions, so both spellings are checked diff --git a/packages/server-utils/src/integrations/redis/index.ts b/packages/server-utils/src/integrations/redis/index.ts index fb19018aa598..4140156cee57 100644 --- a/packages/server-utils/src/integrations/redis/index.ts +++ b/packages/server-utils/src/integrations/redis/index.ts @@ -8,6 +8,7 @@ import { SERVER_ADDRESS, SERVER_PORT, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB_QUERY, DB } from '@sentry/conventions/op'; import type { IntegrationFn, Span, SpanAttributes } from '@sentry/core'; @@ -15,7 +16,6 @@ import { isObjectLike, defineIntegration, getActiveSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, withActiveSpan, @@ -104,7 +104,7 @@ function nodeRedisAttributes(options: NodeRedisClientOptions | undefined): SpanA [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS, [SERVER_ADDRESS]: host, ...(port != null ? { [SERVER_PORT]: port } : {}), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }; } @@ -160,7 +160,7 @@ function subscribeLegacyRedisCommand(cacheOptions: RedisCacheOptions): void { const client = data.self as LegacyRedisClient | undefined; const attributes: SpanAttributes = { [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }; if (client?.connection_options?.host != null) { diff --git a/packages/server-utils/src/integrations/redis/ioredis-channel-subscriber.ts b/packages/server-utils/src/integrations/redis/ioredis-channel-subscriber.ts index f50060a29a8e..0e91d59c03bb 100644 --- a/packages/server-utils/src/integrations/redis/ioredis-channel-subscriber.ts +++ b/packages/server-utils/src/integrations/redis/ioredis-channel-subscriber.ts @@ -7,10 +7,11 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB_QUERY, DB } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core'; import { CHANNELS } from '../../orchestrion/channels'; import { bindTracingChannelToSpan } from '../../tracing-channel'; import type { RedisCacheOptions } from './redis-cache'; @@ -50,7 +51,7 @@ function connectionAttributes(host: string | undefined, port: number | undefined [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS, ...(host != null ? { [SERVER_ADDRESS]: host } : {}), ...(port != null ? { [SERVER_PORT]: port } : {}), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }; } diff --git a/packages/server-utils/src/integrations/redis/redis-cache.ts b/packages/server-utils/src/integrations/redis/redis-cache.ts index ac74bee358f4..bdc860872a6d 100644 --- a/packages/server-utils/src/integrations/redis/redis-cache.ts +++ b/packages/server-utils/src/integrations/redis/redis-cache.ts @@ -7,17 +7,11 @@ import { NETWORK_PEER_PORT, SERVER_ADDRESS, SERVER_PORT, + SENTRY_OP, } from '@sentry/conventions/attributes'; import { CACHE_GET, CACHE_PUT, CACHE_REMOVE } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { - CACHE_OPERATION_NAMES, - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - spanToJSON, - truncate, -} from '@sentry/core'; +import { CACHE_OPERATION_NAMES, getClient, hasSpanStreamingEnabled, spanToJSON, truncate } from '@sentry/core'; // Runtime-agnostic on purpose: imports nothing from `node:*` and touches `Buffer` only inside // function bodies (never at module load), so bundling this into an edge runtime is safe and the @@ -174,7 +168,7 @@ export function getRedisCacheAttributes( } const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation, + [SENTRY_OP]: cacheOperation, [CACHE_KEY]: safeKey, [CACHE_OPERATION]: CACHE_OPERATION_NAMES[cacheOperation], }; @@ -208,7 +202,7 @@ export function getRedisCacheAttributes( * meaningless. */ export function applyCacheResponseAttributes(span: Span, response: unknown): void { - const op = spanToJSON(span).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]; + const op = spanToJSON(span).attributes[SENTRY_OP]; if (op !== CACHE_GET && op !== CACHE_PUT) { return; } diff --git a/packages/server-utils/src/integrations/redis/redis-dc-subscriber.ts b/packages/server-utils/src/integrations/redis/redis-dc-subscriber.ts index 090b02d7272e..de092c109bd7 100644 --- a/packages/server-utils/src/integrations/redis/redis-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/redis/redis-dc-subscriber.ts @@ -7,10 +7,11 @@ import { SERVER_ADDRESS, SERVER_PORT, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB_QUERY, DB } from '@sentry/conventions/op'; import type { SpanAttributes } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../../tracing-channel'; import type { RedisCacheOptions } from './redis-cache'; import { applyCacheResponseAttributes, getRedisCacheAttributes } from './redis-cache'; @@ -148,7 +149,7 @@ function setupCommandChannel( port: data.serverPort, }); const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB_QUERY, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, [DB_OPERATION_NAME]: data.command, @@ -182,7 +183,7 @@ function setupBatchChannel( return startInactiveSpan({ name: operation, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB_QUERY, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, [DB_OPERATION_NAME]: operation, @@ -201,7 +202,7 @@ function setupConnectChannel(tracingChannel: RedisTracingChannelFactory, channel return startInactiveSpan({ name: 'redis-connect', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, ...(data.serverAddress != null ? { [SERVER_ADDRESS]: data.serverAddress } : {}), diff --git a/packages/server-utils/src/integrations/tedious.ts b/packages/server-utils/src/integrations/tedious.ts index a2b3ea352791..21ff279dd13f 100644 --- a/packages/server-utils/src/integrations/tedious.ts +++ b/packages/server-utils/src/integrations/tedious.ts @@ -9,7 +9,6 @@ import { defineIntegration, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; @@ -23,6 +22,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import { CHANNELS } from '../orchestrion/channels'; @@ -138,7 +138,7 @@ function subscribeQuery(channelName: string, operation: string): void { const attributes: SpanAttributes = { [SENTRY_OP]: DB, [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MSSQL, [DB_NAMESPACE]: databaseName, // `>=4` uses the `authentication` object; older versions expose `userName` directly. diff --git a/packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts b/packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts index 78b4763f0240..d1b420635876 100644 --- a/packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts @@ -25,6 +25,7 @@ import { GEN_AI_USAGE_REASONING_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_EMBEDDINGS, @@ -39,7 +40,6 @@ import { captureException, getClient, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, spanToJSON, spanToTraceContext, @@ -418,7 +418,7 @@ export function createSpanFromMessage( } const baseAttributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, ...(provider ? { [GEN_AI_PROVIDER_NAME]: provider, [VERCEL_AI_MODEL_PROVIDER_ATTRIBUTE]: provider } : {}), ...(modelId ? { [GEN_AI_REQUEST_MODEL]: modelId } : {}), ...(maxRetries !== undefined ? { [VERCEL_AI_SETTINGS_MAX_RETRIES_ATTRIBUTE]: maxRetries } : {}), @@ -533,7 +533,7 @@ function buildToolSpan(event: Record, recordInputs: boolean): S const description = recordInputs && toolName ? resolveToolDescription(asString(event.callId), toolName, event.tools) : undefined; return startGenAiSpan('execute_tool', toolName, { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, ...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}), ...(toolCallId ? { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: toolCallId } : {}), ...(description ? { [GEN_AI_TOOL_DESCRIPTION]: description } : {}), diff --git a/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts b/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts index bc282e0348bc..f2784635c5f2 100644 --- a/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts +++ b/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts @@ -11,12 +11,12 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { getMainCarrier, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, spanToStaticSpanJSON, @@ -69,8 +69,8 @@ describe('instrumentWorkersAiClient', () => { * are on here because the `run` call is the root span in these tests, with no active parent. */ const ALWAYS_RECORDED = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', + [SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', + [SENTRY_OP]: 'gen_ai.chat', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [GEN_AI_PROVIDER_NAME]: 'cloudflare.workers_ai', @@ -187,8 +187,8 @@ describe('instrumentWorkersAiClient', () => { const span = spanToStaticSpanJSON(endedSpans[0]!); expect(span.description).toBe('evaluate typesafe/jev'); expect(span.data).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.evaluate', + [SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', + [SENTRY_OP]: 'gen_ai.evaluate', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [GEN_AI_PROVIDER_NAME]: 'cloudflare.workers_ai', diff --git a/packages/server-utils/test/ai/lib/utils/workers-ai-utils.test.ts b/packages/server-utils/test/ai/lib/utils/workers-ai-utils.test.ts index 8d9f9d15b257..4c628f90a418 100644 --- a/packages/server-utils/test/ai/lib/utils/workers-ai-utils.test.ts +++ b/packages/server-utils/test/ai/lib/utils/workers-ai-utils.test.ts @@ -1,5 +1,4 @@ import { describe, expect, it } from 'vitest'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type { Span } from '@sentry/core'; import { GEN_AI_PROVIDER_NAME, @@ -21,6 +20,7 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../../../../src/ai/core/gen-ai-attributes'; import { WORKERS_AI_ORIGIN, WORKERS_AI_PROVIDER_NAME } from '../../../../src/ai/workers-ai/constants'; @@ -80,7 +80,7 @@ describe('workers-ai utils', () => { expect(extractRequestAttributes(MODEL, { prompt: 'Hello' }, 'chat')).toEqual({ [GEN_AI_PROVIDER_NAME]: WORKERS_AI_PROVIDER_NAME, [GEN_AI_OPERATION_NAME]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, + [SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, [GEN_AI_REQUEST_MODEL]: MODEL, }); }); @@ -104,7 +104,7 @@ describe('workers-ai utils', () => { ).toEqual({ [GEN_AI_PROVIDER_NAME]: WORKERS_AI_PROVIDER_NAME, [GEN_AI_OPERATION_NAME]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, + [SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, [GEN_AI_REQUEST_MODEL]: MODEL, [GEN_AI_REQUEST_TEMPERATURE]: 0.5, [GEN_AI_REQUEST_MAX_TOKENS]: 100, diff --git a/packages/solid/src/solidrouter.ts b/packages/solid/src/solidrouter.ts index a9e133da3a97..40f91c2323ed 100644 --- a/packages/solid/src/solidrouter.ts +++ b/packages/solid/src/solidrouter.ts @@ -14,17 +14,11 @@ import { URL_PATH, URL_PATH_PARAMETER_KEY_BASE, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { NAVIGATION } from '@sentry/conventions/op'; import type { Client, Integration, Span } from '@sentry/core'; -import { - getClient, - hasSpanStreamingEnabled, - NAVIGATION_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - filterCollectedUrl, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, filterCollectedUrl } from '@sentry/core'; import type { BeforeLeaveEventArgs, HashRouter, @@ -71,7 +65,7 @@ function handleNavigation(location: string): void { name: hasSpanStreamingEnabled(client) ? NAVIGATION_SPAN_NAME_FALLBACK : location, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.${framework}.solidrouter`, + [SENTRY_ORIGIN]: `auto.navigation.${framework}.solidrouter`, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }, @@ -153,7 +147,7 @@ function withSentryRouterRoot(Root: Component): Component( : initialWindowLocation.pathname, attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.solid.tanstack_router', + [SENTRY_ORIGIN]: 'auto.pageload.solid.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), @@ -156,7 +156,7 @@ export function tanstackRouterBrowserTracingIntegration( name: routeMatch ? routeMatch.routeId : fallbackName, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.tanstack_router', + [SENTRY_ORIGIN]: 'auto.navigation.solid.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), diff --git a/packages/solid/test/solidrouter.test.tsx b/packages/solid/test/solidrouter.test.tsx index 138cf7e7e868..36d36b11b2c5 100644 --- a/packages/solid/test/solidrouter.test.tsx +++ b/packages/solid/test/solidrouter.test.tsx @@ -1,13 +1,7 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { spanToJSON } from '@sentry/browser'; import type { Span } from '@sentry/core'; -import { - createTransport, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, -} from '@sentry/core'; +import { createTransport, getCurrentScope, setCurrentClient } from '@sentry/core'; import type { MemoryHistory } from '@solidjs/router'; import { createMemoryHistory, MemoryRouter, Navigate, Route } from '@solidjs/router'; import { render, waitFor } from '@solidjs/testing-library'; @@ -74,8 +68,8 @@ describe('solidRouterBrowserTracingIntegration', () => { name: 'Pageload', attributes: expect.objectContaining({ [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.browser', }), }), ); @@ -105,8 +99,8 @@ describe('solidRouterBrowserTracingIntegration', () => { name: 'Pageload', attributes: expect.objectContaining({ [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.browser', }), }), ); @@ -150,8 +144,8 @@ describe('solidRouterBrowserTracingIntegration', () => { expect(span.name).toBe(parametrizedRoute); expect(span.attributes).toMatchObject({ [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter', }); for (const [key, value] of Object.entries(expectedParams as Record)) { @@ -186,8 +180,8 @@ describe('solidRouterBrowserTracingIntegration', () => { name: '/about', attributes: expect.objectContaining({ [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter', }), }), ); diff --git a/packages/solid/test/tanstackrouter.test.ts b/packages/solid/test/tanstackrouter.test.ts index de3a2e9496d7..92908d5b1aa0 100644 --- a/packages/solid/test/tanstackrouter.test.ts +++ b/packages/solid/test/tanstackrouter.test.ts @@ -1,6 +1,5 @@ import * as SentryBrowser from '@sentry/browser'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { tanstackRouterBrowserTracingIntegration } from '../src/tanstackrouter'; @@ -91,7 +90,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { expect(startBrowserTracingPageLoadSpanSpy).toHaveBeenCalledWith(mockClient, { name: '/posts/$postId', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.solid.tanstack_router', + [SENTRY_ORIGIN]: 'auto.pageload.solid.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/posts/$postId', 'url.path.parameter.postId': '999', diff --git a/packages/solidstart/src/server/index.ts b/packages/solidstart/src/server/index.ts index bc01f6bb9906..8c8576aeb7ae 100644 --- a/packages/solidstart/src/server/index.ts +++ b/packages/solidstart/src/server/index.ts @@ -88,7 +88,9 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setContext, diff --git a/packages/solidstart/src/server/withServerActionInstrumentation.ts b/packages/solidstart/src/server/withServerActionInstrumentation.ts index 2c572a4f0e2a..785ab1432f91 100644 --- a/packages/solidstart/src/server/withServerActionInstrumentation.ts +++ b/packages/solidstart/src/server/withServerActionInstrumentation.ts @@ -1,4 +1,4 @@ -import { handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR } from '@sentry/core'; +import { handleCallbackErrors, SPAN_STATUS_ERROR } from '@sentry/core'; import { flushIfServerless } from '@sentry/core/server'; import { captureException, getActiveSpan, spanToJSON, startSpan } from '@sentry/node'; import { isRedirect } from './utils'; @@ -9,6 +9,7 @@ import { HTTP_TARGET, SENTRY_OP, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; import { setHttpServerSpanRouteAttribute } from '@sentry/server-utils'; @@ -48,7 +49,7 @@ export async function withServerActionInstrumentation { name: 'Pageload', attributes: expect.objectContaining({ [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.browser', }), }), ); @@ -105,8 +99,8 @@ describe('solidRouterBrowserTracingIntegration', () => { name: '/', attributes: expect.objectContaining({ [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', + [SENTRY_OP]: 'pageload', + [SENTRY_ORIGIN]: 'auto.pageload.browser', }), }), ); @@ -150,8 +144,8 @@ describe('solidRouterBrowserTracingIntegration', () => { expect(span.name).toBe(parametrizedRoute); expect(span.attributes).toMatchObject({ [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solidstart.solidrouter', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.solidstart.solidrouter', }); for (const [key, value] of Object.entries(expectedParams as Record)) { @@ -186,8 +180,8 @@ describe('solidRouterBrowserTracingIntegration', () => { name: '/about', attributes: expect.objectContaining({ [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solidstart.solidrouter', + [SENTRY_OP]: 'navigation', + [SENTRY_ORIGIN]: 'auto.navigation.solidstart.solidrouter', }), }), ); diff --git a/packages/solidstart/test/server/withServerActionInstrumentation.test.ts b/packages/solidstart/test/server/withServerActionInstrumentation.test.ts index b196f7a78a2a..1a908c0908b9 100644 --- a/packages/solidstart/test/server/withServerActionInstrumentation.test.ts +++ b/packages/solidstart/test/server/withServerActionInstrumentation.test.ts @@ -1,15 +1,13 @@ -import { SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + CODE_FUNCTION_NAME, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; import * as SentryCoreServer from '@sentry/core/server'; import * as SentryNode from '@sentry/node'; -import { - createTransport, - NodeClient, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setCurrentClient, - spanToJSON, -} from '@sentry/node'; +import { createTransport, NodeClient, setCurrentClient, spanToJSON } from '@sentry/node'; import { redirect } from '@solidjs/router'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { withServerActionInstrumentation } from '../../src/server'; @@ -101,10 +99,10 @@ describe('withServerActionInstrumentation', () => { expect.objectContaining({ name: 'getPrefecture', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', [CODE_FUNCTION_NAME]: 'getPrefecture', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', + [SENTRY_ORIGIN]: 'auto.function.solidstart', }), }), ); @@ -128,7 +126,7 @@ describe('withServerActionInstrumentation', () => { const span = new SentryCore.SentrySpan({ attributes: { 'http.target': '/_server', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', }, }); mockGetActiveSpan.mockReturnValue(span); @@ -153,7 +151,7 @@ describe('withServerActionInstrumentation', () => { const span = new SentryCore.SentrySpan({ attributes: { 'url.path': '/_server', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', }, }); mockGetActiveSpan.mockReturnValue(span); diff --git a/packages/svelte/src/performance.ts b/packages/svelte/src/performance.ts index 62fbc3a144d0..59f7c1b8174a 100644 --- a/packages/svelte/src/performance.ts +++ b/packages/svelte/src/performance.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; import type { Span } from '@sentry/core'; import { debug, @@ -8,7 +7,7 @@ import { UI_UPDATE_SPAN_NAME_FALLBACK, } from '@sentry/core'; import { startInactiveSpan } from '@sentry/core/browser'; -import { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME } from '@sentry/conventions/attributes'; +import { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { UI_MOUNT, UI_UPDATE } from '@sentry/conventions/op'; import { afterUpdate, beforeUpdate, onMount } from 'svelte'; import { DEBUG_BUILD } from './debug_build'; @@ -65,7 +64,7 @@ function recordInitSpan(componentName: string | undefined, description: string): name: hasSpanStreaming ? componentName || UI_MOUNT_SPAN_NAME_FALLBACK : description, attributes: { [SENTRY_OP]: UI_MOUNT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte', + [SENTRY_ORIGIN]: 'auto.ui.svelte', ...(componentName && { [UI_COMPONENT_NAME]: componentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -87,7 +86,7 @@ function recordUpdateSpans(componentName: string | undefined, description: strin name: hasSpanStreaming ? componentName || UI_UPDATE_SPAN_NAME_FALLBACK : description, attributes: { [SENTRY_OP]: UI_UPDATE, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.svelte', + [SENTRY_ORIGIN]: 'auto.ui.svelte', ...(componentName && { [UI_COMPONENT_NAME]: componentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, diff --git a/packages/sveltekit/src/client/load.ts b/packages/sveltekit/src/client/load.ts index 4ddeaad8ffef..a1a78995ce0e 100644 --- a/packages/sveltekit/src/client/load.ts +++ b/packages/sveltekit/src/client/load.ts @@ -4,7 +4,6 @@ import { handleCallbackErrors, hasSpanStreamingEnabled, objectify, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, } from '@sentry/core'; import { startSpan } from '@sentry/core/browser'; import { @@ -14,6 +13,7 @@ import { SENTRY_OP, URL_PATH, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; import { captureException } from '@sentry/svelte'; @@ -95,7 +95,7 @@ export function wrapLoadWithSentry any>(origLoad: T) attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: routeId ? 'route' : 'url', [URL_PATH]: event.url.pathname, ...(routeId && { [URL_TEMPLATE]: routeId }), diff --git a/packages/sveltekit/src/client/svelte4BrowserTracing.ts b/packages/sveltekit/src/client/svelte4BrowserTracing.ts index b80651ad0734..19c0f3600b98 100644 --- a/packages/sveltekit/src/client/svelte4BrowserTracing.ts +++ b/packages/sveltekit/src/client/svelte4BrowserTracing.ts @@ -4,7 +4,6 @@ import { NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, ROUTER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, } from '@sentry/core'; import { getCurrentScope, @@ -13,7 +12,7 @@ import { startInactiveSpan, WINDOW, } from '@sentry/svelte'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD, ROUTER } from '@sentry/conventions/op'; import type { Navigation, Page } from '@sveltejs/kit'; // eslint-disable-next-line typescript/no-deprecated @@ -49,7 +48,7 @@ function _instrumentPageload(client: Client, pageStore: Readable): void { name: hasSpanStreamingEnabled(client) ? PAGELOAD_SPAN_NAME_FALLBACK : initialPath, attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.sveltekit', + [SENTRY_ORIGIN]: 'auto.pageload.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }); @@ -127,7 +126,7 @@ function _instrumentNavigations(client: Client, navigatingStore: Readable any>(origLoad: T) attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: routeId ? 'route' : 'url', [URL_PATH]: event.url.pathname, [HTTP_ROUTE]: routeId, @@ -130,7 +125,7 @@ export function wrapServerLoadWithSentry any>(origSe attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit.server', + [SENTRY_ORIGIN]: 'auto.function.sveltekit.server', [SENTRY_SEGMENT_NAME_SOURCE]: routeId ? 'route' : 'url', [HTTP_REQUEST_METHOD]: event.request.method, [URL_PATH]: event.url.pathname, diff --git a/packages/sveltekit/src/server-common/serverRoute.ts b/packages/sveltekit/src/server-common/serverRoute.ts index 97f06bcbaf5c..4a62f5268820 100644 --- a/packages/sveltekit/src/server-common/serverRoute.ts +++ b/packages/sveltekit/src/server-common/serverRoute.ts @@ -3,7 +3,6 @@ import { FUNCTION_SPAN_NAME_FALLBACK, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, } from '@sentry/core'; import { flushIfServerless } from '@sentry/core/server'; @@ -13,6 +12,7 @@ import { HTTP_ROUTE, SENTRY_DESCRIPTION, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; import type { RequestEvent } from '@sveltejs/kit'; @@ -71,7 +71,7 @@ export function wrapServerRouteWithSentry( attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: httpMethod, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [HTTP_REQUEST_METHOD]: httpMethod, [HTTP_ROUTE]: routeId, // Relay infers the description from `code.function.name`, which would drop the route. diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index cff338b62ed0..cb0730b4c513 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -87,7 +87,9 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setContext, diff --git a/packages/sveltekit/src/worker/index.ts b/packages/sveltekit/src/worker/index.ts index 22927842682c..c7b6c5b11d54 100644 --- a/packages/sveltekit/src/worker/index.ts +++ b/packages/sveltekit/src/worker/index.ts @@ -53,7 +53,9 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setContext, diff --git a/packages/sveltekit/test/client/browserTracingIntegration.test.ts b/packages/sveltekit/test/client/browserTracingIntegration.test.ts index 587af53544af..c27d9db8ddb6 100644 --- a/packages/sveltekit/test/client/browserTracingIntegration.test.ts +++ b/packages/sveltekit/test/client/browserTracingIntegration.test.ts @@ -4,13 +4,12 @@ /* eslint-disable @typescript-eslint/unbound-method */ import type { Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as SentrySvelte from '@sentry/svelte'; import { writable } from 'svelte/store'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { navigating, page } from '$app/stores'; import { browserTracingIntegration } from '../../src/client'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; // we have to overwrite the global mock from `vitest.setup.ts` here to reset the // `navigating` store for each test. @@ -115,7 +114,7 @@ describe('browserTracingIntegration', () => { name: '/', attributes: { 'sentry.op': 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.sveltekit', + [SENTRY_ORIGIN]: 'auto.pageload.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }); @@ -219,7 +218,7 @@ describe('browserTracingIntegration', () => { name: '/users/[id]', attributes: { 'sentry.op': 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.sveltekit', + [SENTRY_ORIGIN]: 'auto.navigation.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/[id]', 'sentry.sveltekit.navigation.from': '/users', @@ -234,7 +233,7 @@ describe('browserTracingIntegration', () => { name: 'SvelteKit Route Change', attributes: { [SENTRY_OP]: 'router', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.sveltekit', + [SENTRY_ORIGIN]: 'auto.ui.sveltekit', 'sentry.sveltekit.navigation.from': '/users', 'sentry.sveltekit.navigation.to': '/users/[id]', 'sentry.sveltekit.navigation.type': 'link', @@ -364,7 +363,7 @@ describe('browserTracingIntegration', () => { attributes: { 'sentry.op': 'navigation', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.sveltekit', + [SENTRY_ORIGIN]: 'auto.navigation.sveltekit', [URL_TEMPLATE]: '/users/[id]', 'sentry.sveltekit.navigation.from': '/users/[id]', 'sentry.sveltekit.navigation.to': '/users/[id]', @@ -377,7 +376,7 @@ describe('browserTracingIntegration', () => { name: 'SvelteKit Route Change', attributes: { [SENTRY_OP]: 'router', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.sveltekit', + [SENTRY_ORIGIN]: 'auto.ui.sveltekit', 'sentry.sveltekit.navigation.from': '/users/[id]', 'sentry.sveltekit.navigation.to': '/users/[id]', }, diff --git a/packages/sveltekit/test/client/load.test.ts b/packages/sveltekit/test/client/load.test.ts index 616326565f46..5978a2bffc01 100644 --- a/packages/sveltekit/test/client/load.test.ts +++ b/packages/sveltekit/test/client/load.test.ts @@ -1,6 +1,5 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Client } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as SentryCore from '@sentry/core'; import * as SentrySvelte from '@sentry/svelte'; import type { Load } from '@sveltejs/kit'; @@ -106,9 +105,9 @@ describe('wrapLoadWithSentry', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.path': '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/users/123', 'url.template': '/users/[id]', @@ -136,9 +135,9 @@ describe('wrapLoadWithSentry', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', 'url.path': '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/users/123', }, @@ -202,9 +201,9 @@ describe('wrapLoadWithSentry', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.path': '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/users/123', 'url.template': '/users/[id]', @@ -223,9 +222,9 @@ describe('wrapLoadWithSentry', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', 'url.path': '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/users/123', 'sentry.description': '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/users/123', diff --git a/packages/sveltekit/test/client/svelte5BrowserTracing.test.ts b/packages/sveltekit/test/client/svelte5BrowserTracing.test.ts index f77d2c0f8195..eca41882dd76 100644 --- a/packages/sveltekit/test/client/svelte5BrowserTracing.test.ts +++ b/packages/sveltekit/test/client/svelte5BrowserTracing.test.ts @@ -4,9 +4,8 @@ /* eslint-disable @typescript-eslint/unbound-method */ import type { Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as SentrySvelte from '@sentry/svelte'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { instrumentSvelteKitTracing } from '../../src/client/svelte5BrowserTracing'; @@ -83,7 +82,7 @@ describe('svelte5 browser tracing', () => { name: '/', attributes: { 'sentry.op': 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.sveltekit', + [SENTRY_ORIGIN]: 'auto.pageload.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }); @@ -124,7 +123,7 @@ describe('svelte5 browser tracing', () => { name: '/users/[id]', attributes: expect.objectContaining({ 'sentry.op': 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.sveltekit', + [SENTRY_ORIGIN]: 'auto.navigation.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/[id]', }), diff --git a/packages/sveltekit/test/server-common/integrations/svelteKitSpans.test.ts b/packages/sveltekit/test/server-common/integrations/svelteKitSpans.test.ts index 3412e9376b25..2c53de829a3e 100644 --- a/packages/sveltekit/test/server-common/integrations/svelteKitSpans.test.ts +++ b/packages/sveltekit/test/server-common/integrations/svelteKitSpans.test.ts @@ -1,5 +1,5 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { SpanJSON, StreamedSpanJSON, TransactionEvent } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { _enhanceKitSpan, @@ -47,8 +47,8 @@ describe('svelteKitSpansIntegration', () => { expect(event.spans).toHaveLength(1); expect(event.spans?.[0]?.op).toBe('function'); expect(event.spans?.[0]?.origin).toBe('auto.http.sveltekit'); - expect(event.spans?.[0]?.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('function'); - expect(event.spans?.[0]?.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); + expect(event.spans?.[0]?.data[SENTRY_OP]).toBe('function'); + expect(event.spans?.[0]?.data[SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); }); describe('_enhanceKitSpan', () => { @@ -74,8 +74,8 @@ describe('svelteKitSpansIntegration', () => { expect(span.op).toBe(op); expect(span.origin).toBe(origin); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe(op); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe(origin); + expect(span.data[SENTRY_OP]).toBe(op); + expect(span.data[SENTRY_ORIGIN]).toBe(origin); }); it("doesn't change spans from other origins", () => { @@ -88,8 +88,8 @@ describe('svelteKitSpansIntegration', () => { expect(span.op).toBeUndefined(); expect(span.origin).toBeUndefined(); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBeUndefined(); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBeUndefined(); + expect(span.data[SENTRY_OP]).toBeUndefined(); + expect(span.data[SENTRY_ORIGIN]).toBeUndefined(); }); it("doesn't overwrite the sveltekit.handle.root span", () => { @@ -98,8 +98,8 @@ describe('svelteKitSpansIntegration', () => { op: 'http.server', origin: 'auto.http.sveltekit', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', + [SENTRY_OP]: 'http.server', + [SENTRY_ORIGIN]: 'auto.http.sveltekit', }, span_id: '123', trace_id: 'abc', @@ -108,8 +108,8 @@ describe('svelteKitSpansIntegration', () => { _enhanceKitSpan(rootHandleSpan); - expect(rootHandleSpan.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); - expect(rootHandleSpan.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); + expect(rootHandleSpan.data[SENTRY_OP]).toBe('http.server'); + expect(rootHandleSpan.data[SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); expect(rootHandleSpan.op).toBe('http.server'); expect(rootHandleSpan.origin).toBe('auto.http.sveltekit'); }); @@ -118,8 +118,8 @@ describe('svelteKitSpansIntegration', () => { const span = { description: 'someOtherSpan', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.pg', + [SENTRY_OP]: 'db', + [SENTRY_ORIGIN]: 'auto.db.pg', }, op: 'db', origin: 'auto.db.pg', @@ -132,8 +132,8 @@ describe('svelteKitSpansIntegration', () => { expect(span.op).toBe('db'); expect(span.origin).toBe('auto.db.pg'); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('db'); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.db.pg'); + expect(span.data[SENTRY_OP]).toBe('db'); + expect(span.data[SENTRY_ORIGIN]).toBe('auto.db.pg'); }); it("doesn't overwrite already set ops or origins on sveltekit spans", () => { @@ -142,7 +142,7 @@ describe('svelteKitSpansIntegration', () => { description: 'sveltekit.resolve', origin: 'auto.custom.origin', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'custom.op', + [SENTRY_OP]: 'custom.op', }, span_id: '123', trace_id: 'abc', @@ -152,7 +152,7 @@ describe('svelteKitSpansIntegration', () => { _enhanceKitSpan(span); expect(span.origin).toBe('auto.custom.origin'); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('custom.op'); + expect(span.data[SENTRY_OP]).toBe('custom.op'); }); it('overwrites previously set "manual" origins on sveltekit spans', () => { @@ -161,7 +161,7 @@ describe('svelteKitSpansIntegration', () => { description: 'sveltekit.resolve', origin: 'manual', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'custom.op', + [SENTRY_OP]: 'custom.op', }, span_id: '123', trace_id: 'abc', @@ -171,7 +171,7 @@ describe('svelteKitSpansIntegration', () => { _enhanceKitSpan(span); expect(span.origin).toBe('auto.http.sveltekit'); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('custom.op'); + expect(span.data[SENTRY_OP]).toBe('custom.op'); }); }); @@ -202,8 +202,8 @@ describe('svelteKitSpansIntegration', () => { _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe(op); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe(origin); + expect(span.attributes?.[SENTRY_OP]).toBe(op); + expect(span.attributes?.[SENTRY_ORIGIN]).toBe(origin); expect(span.attributes?.['sentry.description']).toBe(spanName); }); @@ -212,8 +212,8 @@ describe('svelteKitSpansIntegration', () => { _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBeUndefined(); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBeUndefined(); + expect(span.attributes?.[SENTRY_OP]).toBeUndefined(); + expect(span.attributes?.[SENTRY_ORIGIN]).toBeUndefined(); expect(span.attributes?.['sentry.description']).toBeUndefined(); }); @@ -221,30 +221,30 @@ describe('svelteKitSpansIntegration', () => { const rootHandleSpan = makeStreamedSpan({ name: 'sveltekit.handle.root', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', + [SENTRY_OP]: 'http.server', + [SENTRY_ORIGIN]: 'auto.http.sveltekit', }, }); _enhanceKitSpanStreamed(rootHandleSpan); - expect(rootHandleSpan.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); - expect(rootHandleSpan.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); + expect(rootHandleSpan.attributes?.[SENTRY_OP]).toBe('http.server'); + expect(rootHandleSpan.attributes?.[SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); }); it("doesn't enhance unrelated spans", () => { const span = makeStreamedSpan({ name: 'someOtherSpan', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.pg', + [SENTRY_OP]: 'db', + [SENTRY_ORIGIN]: 'auto.db.pg', }, }); _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('db'); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.db.pg'); + expect(span.attributes?.[SENTRY_OP]).toBe('db'); + expect(span.attributes?.[SENTRY_ORIGIN]).toBe('auto.db.pg'); }); it("doesn't overwrite already set ops or origins on sveltekit spans", () => { @@ -252,15 +252,15 @@ describe('svelteKitSpansIntegration', () => { const span = makeStreamedSpan({ name: 'sveltekit.resolve', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'custom.op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.custom.origin', + [SENTRY_OP]: 'custom.op', + [SENTRY_ORIGIN]: 'auto.custom.origin', }, }); _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('custom.op'); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.custom.origin'); + expect(span.attributes?.[SENTRY_OP]).toBe('custom.op'); + expect(span.attributes?.[SENTRY_ORIGIN]).toBe('auto.custom.origin'); }); it("doesn't overwrite an already set description", () => { @@ -278,15 +278,15 @@ describe('svelteKitSpansIntegration', () => { const span = makeStreamedSpan({ name: 'sveltekit.resolve', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'custom.op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_OP]: 'custom.op', + [SENTRY_ORIGIN]: 'manual', }, }); _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('custom.op'); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); + expect(span.attributes?.[SENTRY_OP]).toBe('custom.op'); + expect(span.attributes?.[SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); }); }); }); diff --git a/packages/sveltekit/test/server-common/load.test.ts b/packages/sveltekit/test/server-common/load.test.ts index 4dc513b778c7..97b3a6390c08 100644 --- a/packages/sveltekit/test/server-common/load.test.ts +++ b/packages/sveltekit/test/server-common/load.test.ts @@ -1,6 +1,5 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Client, Event } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as SentryCore from '@sentry/core'; import { NodeClient, setCurrentClient } from '@sentry/node'; import type { Load, ServerLoad } from '@sveltejs/kit'; @@ -166,9 +165,9 @@ describe('wrapLoadWithSentry calls `startSpan`', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.path': '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/users/123', 'http.route': '/users/[id]', @@ -187,9 +186,9 @@ describe('wrapLoadWithSentry calls `startSpan`', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', 'url.path': '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/users/123', }, @@ -257,9 +256,9 @@ describe('wrapServerLoadWithSentry calls `startSpan`', () => { expect(transaction.contexts?.trace).toEqual({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit.server', + [SENTRY_ORIGIN]: 'auto.function.sveltekit.server', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', 'http.request.method': 'GET', 'url.path': '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/users/123', @@ -301,7 +300,7 @@ describe('wrapServerLoadWithSentry calls `startSpan`', () => { expect(mockStartSpan).toHaveBeenCalledWith( expect.objectContaining({ attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', }), name: '/users/[id]', // <-- this shows that the route was still accessed }), @@ -356,9 +355,9 @@ describe('with span streaming enabled', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.path': '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/users/123', 'http.route': '/users/[id]', @@ -377,9 +376,9 @@ describe('with span streaming enabled', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', 'url.path': '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/users/123', 'sentry.description': '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/users/123', @@ -397,9 +396,9 @@ describe('with span streaming enabled', () => { expect(mockStartSpan).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'load', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit.server', + [SENTRY_ORIGIN]: 'auto.function.sveltekit.server', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'http.request.method': 'GET', 'url.path': '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/users/123', diff --git a/packages/sveltekit/test/server-common/serverRoute.test.ts b/packages/sveltekit/test/server-common/serverRoute.test.ts index 72efa31c1a7e..ef984fbb8af9 100644 --- a/packages/sveltekit/test/server-common/serverRoute.test.ts +++ b/packages/sveltekit/test/server-common/serverRoute.test.ts @@ -1,13 +1,10 @@ +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Client } from '@sentry/core'; import * as SentryCore from '@sentry/core'; import type { NumericRange, RequestEvent } from '@sveltejs/kit'; import { error, redirect } from '@sveltejs/kit'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - wrapServerRouteWithSentry, -} from '../../src/server'; +import { wrapServerRouteWithSentry } from '../../src/server'; describe('wrapServerRouteWithSentry', () => { const originalRouteHandler = vi.fn(); @@ -37,9 +34,9 @@ describe('wrapServerRouteWithSentry', () => { expect(startSpanSpy).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'GET', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', 'http.request.method': 'GET', 'http.route': '/api/users/:id', }, @@ -60,9 +57,9 @@ describe('wrapServerRouteWithSentry', () => { expect(startSpanSpy).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'GET', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', 'http.request.method': 'GET', }, name: 'GET Server Route', @@ -93,9 +90,9 @@ describe('wrapServerRouteWithSentry', () => { expect(startSpanSpy).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'GET', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', 'http.request.method': 'GET', 'http.route': '/api/users/:id', 'sentry.description': 'GET /api/users/:id', @@ -115,9 +112,9 @@ describe('wrapServerRouteWithSentry', () => { expect(startSpanSpy).toHaveBeenCalledWith( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', 'code.function.name': 'GET', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', + [SENTRY_ORIGIN]: 'auto.function.sveltekit', 'http.request.method': 'GET', 'sentry.description': 'GET Server Route', }, diff --git a/packages/tanstackstart-react/src/server/utils.ts b/packages/tanstackstart-react/src/server/utils.ts index 5d58be067658..7f6793fc806b 100644 --- a/packages/tanstackstart-react/src/server/utils.ts +++ b/packages/tanstackstart-react/src/server/utils.ts @@ -1,7 +1,6 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { MIDDLEWARE } from '@sentry/conventions/op'; import type { StartSpanOptions } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/node'; /** * Returns span options for TanStack Start middleware spans. @@ -10,7 +9,7 @@ export function getMiddlewareSpanOptions(name: string): StartSpanOptions { return { name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.middleware.tanstackstart', + [SENTRY_ORIGIN]: 'auto.middleware.tanstackstart', [SENTRY_OP]: MIDDLEWARE, }, }; diff --git a/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts b/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts index 77029ebbf907..83f148a77771 100644 --- a/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts +++ b/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts @@ -1,7 +1,13 @@ import { getClient, getTraceMetaTags, hasSpanStreamingEnabled } from '@sentry/core'; import { flushIfServerless } from '@sentry/core/server'; -import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/node'; -import { CODE_FUNCTION_NAME, HTTP_REQUEST_METHOD, SENTRY_DESCRIPTION, SENTRY_OP } from '@sentry/conventions/attributes'; +import { captureException, startSpan } from '@sentry/node'; +import { + CODE_FUNCTION_NAME, + HTTP_REQUEST_METHOD, + SENTRY_DESCRIPTION, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; import { updateSpanWithRouteParametrization } from './routeParametrization'; @@ -154,7 +160,7 @@ export function wrapFetchWithSentry(serverEntry: ServerEntry): ServerEntry { // request path carries the generated server function id, which is high cardinality. name: hasSpanStreaming ? 'serverFn' : description, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server', + [SENTRY_ORIGIN]: 'auto.function.tanstackstart.server', [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: 'serverFn', // The global function middleware renames this span and needs the method, which it diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index 30d4a428eefb..abe436f67705 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -83,7 +83,9 @@ export { instrumentSupabaseClient, zodErrorsIntegration, consoleIntegration, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_OP, + // oxlint-disable-next-line typescript/no-deprecated SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, spanToStaticSpanJSON, diff --git a/packages/vue/src/router.ts b/packages/vue/src/router.ts index 6e8db5868f85..3f28ec5259b4 100644 --- a/packages/vue/src/router.ts +++ b/packages/vue/src/router.ts @@ -6,6 +6,7 @@ import { SENTRY_OP, URL_PATH_PARAMETER_KEY_BASE, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { NAVIGATION } from '@sentry/conventions/op'; import type { Span, SpanAttributes, StartSpanOptions, TransactionSource } from '@sentry/core'; @@ -17,7 +18,6 @@ import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; @@ -134,7 +134,7 @@ export function instrumentVueRouter( // This will override the origin, and add params & query attributes activePageLoadSpan.setAttributes({ ...attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue', + [SENTRY_ORIGIN]: 'auto.pageload.vue', }); hasHandledFirstPageLoad = true; @@ -153,7 +153,7 @@ export function instrumentVueRouter( attributes: { ...attributes, [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', + [SENTRY_ORIGIN]: 'auto.navigation.vue', [SENTRY_SEGMENT_NAME_SOURCE]: transactionSource, }, }, diff --git a/packages/vue/src/tanstackrouter.ts b/packages/vue/src/tanstackrouter.ts index ed2c659c76f9..f485c6cb3fd3 100644 --- a/packages/vue/src/tanstackrouter.ts +++ b/packages/vue/src/tanstackrouter.ts @@ -13,6 +13,7 @@ import { URL_PATH, URL_PATH_PARAMETER_KEY_BASE, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD } from '@sentry/conventions/op'; import type { Integration } from '@sentry/core'; @@ -20,7 +21,6 @@ import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, filterCollectedUrl, } from '@sentry/core'; import type { AnyRouter } from '@tanstack/vue-router'; @@ -103,7 +103,7 @@ export function tanstackRouterBrowserTracingIntegration( : initialWindowLocation.pathname, attributes: { [SENTRY_OP]: PAGELOAD, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue.tanstack_router', + [SENTRY_ORIGIN]: 'auto.pageload.vue.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), @@ -163,7 +163,7 @@ export function tanstackRouterBrowserTracingIntegration( name: routeMatch ? routeMatch.routeId : fallbackName, attributes: { [SENTRY_OP]: NAVIGATION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue.tanstack_router', + [SENTRY_ORIGIN]: 'auto.navigation.vue.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), diff --git a/packages/vue/src/tracing.ts b/packages/vue/src/tracing.ts index a6084cd58ff0..822ef2909a45 100644 --- a/packages/vue/src/tracing.ts +++ b/packages/vue/src/tracing.ts @@ -1,4 +1,4 @@ -import { getActiveSpan, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/browser'; +import { getActiveSpan, getClient, startInactiveSpan } from '@sentry/browser'; import type { Span } from '@sentry/core'; import { debug, @@ -10,7 +10,7 @@ import { UI_UPDATE_SPAN_NAME_FALLBACK, uniq, } from '@sentry/core'; -import { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME } from '@sentry/conventions/attributes'; +import { SENTRY_DESCRIPTION, SENTRY_OP, UI_COMPONENT_NAME, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { UI_MOUNT, UI_RENDER, UI_UNMOUNT, UI_UPDATE } from '@sentry/conventions/op'; import { DEFAULT_HOOKS, DEFAULT_ROOT_SPAN_TIMEOUT } from './constants'; import { DEBUG_BUILD } from './debug-build'; @@ -145,7 +145,7 @@ export const createTracingMixins = (options: Partial = {}): Mixi name: hasSpanStreaming ? conventionComponentName || UI_RENDER_SPAN_NAME_FALLBACK : description, attributes: { [SENTRY_OP]: UI_RENDER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.vue', + [SENTRY_ORIGIN]: 'auto.ui.vue', ...(conventionComponentName && { [UI_COMPONENT_NAME]: conventionComponentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, @@ -196,7 +196,7 @@ export const createTracingMixins = (options: Partial = {}): Mixi : description, attributes: { [SENTRY_OP]: VUE_OPERATION_TO_SPAN_OP[operation], - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.vue', + [SENTRY_ORIGIN]: 'auto.ui.vue', ...(conventionComponentName && { [UI_COMPONENT_NAME]: conventionComponentName }), ...(hasSpanStreaming && { [SENTRY_DESCRIPTION]: description }), }, diff --git a/packages/vue/test/router.test.ts b/packages/vue/test/router.test.ts index 94aed649b7e8..bd0972bfcd09 100644 --- a/packages/vue/test/router.test.ts +++ b/packages/vue/test/router.test.ts @@ -1,8 +1,12 @@ import * as SentryBrowser from '@sentry/browser'; import type { Span, SpanAttributes } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; -import { SENTRY_SEGMENT_NAME_SOURCE, ROUTER_NAVIGATION_ROUTE_ID, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + ROUTER_NAVIGATION_ROUTE_ID, + URL_TEMPLATE, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import type { Route } from '../src/router'; import { instrumentVueRouter } from '../src/router'; @@ -127,7 +131,7 @@ describe('instrumentVueRouter()', () => { name: transactionName, attributes: { 'sentry.op': 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', + [SENTRY_ORIGIN]: 'auto.navigation.vue', [SENTRY_SEGMENT_NAME_SOURCE]: transactionSource, ...getAttributesForRoute(to, transactionSource === 'route' ? transactionName : undefined), }, @@ -179,7 +183,7 @@ describe('instrumentVueRouter()', () => { expect(mockRootSpan.updateName).toHaveBeenCalledWith(transactionName); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, transactionSource); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue', + [SENTRY_ORIGIN]: 'auto.pageload.vue', ...getAttributesForRoute(to, transactionSource === 'route' ? transactionName : undefined), }); }, @@ -207,7 +211,7 @@ describe('instrumentVueRouter()', () => { name: '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/login', attributes: { 'sentry.op': 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', + [SENTRY_ORIGIN]: 'auto.navigation.vue', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', ...getAttributesForRoute(to, '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/login'), }, @@ -238,7 +242,7 @@ describe('instrumentVueRouter()', () => { name: 'login-screen', attributes: { 'sentry.op': 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', + [SENTRY_ORIGIN]: 'auto.navigation.vue', [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', ...getAttributesForRoute(to), }, @@ -298,7 +302,7 @@ describe('instrumentVueRouter()', () => { expect(mockRootSpan.updateName).not.toHaveBeenCalled(); expect(mockRootSpan.setAttribute).not.toHaveBeenCalled(); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue', + [SENTRY_ORIGIN]: 'auto.pageload.vue', ...getAttributesForRoute(to, '/books/:bookId/chapter/:chapterId'), }); expect(mockRootSpan.name).toEqual('customTxnName'); @@ -471,7 +475,7 @@ describe('instrumentVueRouter()', () => { name: 'Navigation', attributes: { 'sentry.op': 'navigation', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', + [SENTRY_ORIGIN]: 'auto.navigation.vue', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', ...getAttributesForRoute(to), }, diff --git a/packages/vue/test/tanstackrouter.test.ts b/packages/vue/test/tanstackrouter.test.ts index 593d4da842ef..54384e81908c 100644 --- a/packages/vue/test/tanstackrouter.test.ts +++ b/packages/vue/test/tanstackrouter.test.ts @@ -1,6 +1,5 @@ import * as SentryBrowser from '@sentry/browser'; -import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { AnyRouter } from '@tanstack/vue-router'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { tanstackRouterBrowserTracingIntegration } from '../src/tanstackrouter'; @@ -119,7 +118,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { expect(startBrowserTracingPageLoadSpanSpy).toHaveBeenCalledWith(mockClient, { name: '/test/:id', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue.tanstack_router', + [SENTRY_ORIGIN]: 'auto.pageload.vue.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.path.parameter.id': '123', 'params.id': '123', @@ -292,7 +291,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { { name: '/test/:id', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue.tanstack_router', + [SENTRY_ORIGIN]: 'auto.navigation.vue.tanstack_router', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }), },