diff --git a/.cursor/BUGBOT.md b/.cursor/BUGBOT.md index 2a7095d29832..023d0c8af5fa 100644 --- a/.cursor/BUGBOT.md +++ b/.cursor/BUGBOT.md @@ -34,7 +34,7 @@ Unless explicitly noted (e.g. in the `Testing Conventions` section), only flag t - `SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN` (`'sentry.origin'`) with a proper span origin - a proper origin must only contain [a-z], [A-Z], [0-9], `_` and `.` characters. - flag any non-conforming origin values as invalid and link to the trace origin specification (https://develop.sentry.dev/sdk/telemetry/traces/trace-origin/) - - `SEMANTIC_ATTRIBUTE_SENTRY_OP` (`'sentry.op'`) with a proper span op + - `SENTRY_OP` (`'sentry.op'`) with a proper span op - Span ops should be lower case only, and use snake_case. The `.` character is used to delimit op parts. - flag any non-conforming op values as invalid and link to the span op specification (https://develop.sentry.dev/sdk/telemetry/traces/span-operations/) - When calling `captureException`, always make sure that the `mechanism` is set: diff --git a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts index 1d91e558afc8..acdd8e63c572 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/fetch/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -53,7 +54,7 @@ sentryTest('should update spans for GraphQL fetch requests', async ({ getLocalTe 'url.full': 'http://sentry-test.io/foo', url: 'http://sentry-test.io/foo', 'server.address': 'sentry-test.io', - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', 'graphql.document': query, }), diff --git a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-fetch/test.ts b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-fetch/test.ts index 48571bab503f..cb9d7dc13fb7 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-fetch/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-fetch/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -47,7 +48,7 @@ sentryTest('should update spans for GraphQL persisted query fetch requests', asy 'url.full': 'http://sentry-test.io/graphql', url: 'http://sentry-test.io/graphql', 'server.address': 'sentry-test.io', - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', 'graphql.persisted_query.hash.sha256': 'ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38', 'graphql.persisted_query.version': 1, diff --git a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-xhr/test.ts b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-xhr/test.ts index c7eda0d5bb00..f1019d5e1c4e 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-xhr/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/persistedQuery-xhr/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -47,7 +48,7 @@ sentryTest('should update spans for GraphQL persisted query XHR requests', async 'url.full': 'http://sentry-test.io/graphql', url: 'http://sentry-test.io/graphql', 'server.address': 'sentry-test.io', - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', 'graphql.persisted_query.hash.sha256': 'ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38', 'graphql.persisted_query.version': 1, diff --git a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts index 5d49fff05a05..a0f2f4ad6323 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/graphqlClient/xhr/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -53,7 +54,7 @@ sentryTest('should update spans for GraphQL XHR requests', async ({ getLocalTest 'url.full': 'http://sentry-test.io/foo', url: 'http://sentry-test.io/foo', 'server.address': 'sentry-test.io', - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', 'graphql.document': query, }, diff --git a/dev-packages/browser-integration-tests/suites/integrations/supabase/auth/test.ts b/dev-packages/browser-integration-tests/suites/integrations/supabase/auth/test.ts index fa1353f64c5d..754dd69c45c5 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/supabase/auth/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/supabase/auth/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Page } from '@playwright/test'; import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; @@ -94,7 +95,7 @@ sentryTest('should capture Supabase authentication spans', async ({ getLocalTest trace_id: eventData.contexts?.trace?.trace_id, status: 'ok', data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': 'auto.db.supabase', 'db.operation': 'auth.signInWithPassword', 'db.system': 'postgresql', @@ -111,7 +112,7 @@ sentryTest('should capture Supabase authentication spans', async ({ getLocalTest trace_id: eventData.contexts?.trace?.trace_id, status: 'ok', data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': 'auto.db.supabase', 'db.operation': 'auth.signOut', 'db.system': 'postgresql', @@ -145,7 +146,7 @@ sentryTest('should capture Supabase authentication errors', async ({ getLocalTes trace_id: transactionEvent.contexts?.trace?.trace_id, status: 'internal_error', data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': 'auto.db.supabase', 'db.operation': 'auth.signInWithPassword', 'db.system': 'postgresql', diff --git a/dev-packages/browser-integration-tests/suites/public-api/beforeSendSpan-streamed/init.js b/dev-packages/browser-integration-tests/suites/public-api/beforeSendSpan-streamed/init.js index f099c1f61c3e..7328cf06add5 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/beforeSendSpan-streamed/init.js +++ b/dev-packages/browser-integration-tests/suites/public-api/beforeSendSpan-streamed/init.js @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; @@ -7,7 +8,7 @@ Sentry.init({ integrations: [Sentry.browserTracingIntegration(), Sentry.spanStreamingIntegration()], tracesSampleRate: 1, beforeSendSpan: Sentry.withStreamedSpan(span => { - if (span.attributes['sentry.op'] === 'pageload') { + if (span.attributes[SENTRY_OP] === 'pageload') { span.name = 'customPageloadSpanName'; span.links = [ { 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 8aacd9528d57..6acbb792e024 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,7 +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, @@ -18,6 +17,7 @@ import { SENTRY_SDK_NAME, SENTRY_SDK_VERSION, SENTRY_TRACE_LIFECYCLE, + SENTRY_OP, } from '@sentry/conventions/attributes'; sentryTest( @@ -75,7 +75,7 @@ sentryTest( expect(spans).toEqual([ { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'test-child', }, @@ -223,7 +223,7 @@ sentryTest( type: 'string', value: expect.any(String), }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'test', }, diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions-streamed/test.ts index aad52b5b78c8..80fa2ace7be2 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions-streamed/test.ts @@ -3,7 +3,6 @@ import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -14,6 +13,7 @@ import { SENTRY_SDK_NAME, SENTRY_SDK_VERSION, SENTRY_TRACE_LIFECYCLE, + SENTRY_OP, } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -73,7 +73,7 @@ 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', }, @@ -133,7 +133,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', }, 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 379495f4e5ac..0df14e73b5c6 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,7 @@ 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 { SENTRY_OP } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { getSpanOp, waitForStreamedSpans } from '../../../../utils/spanUtils'; @@ -45,7 +45,7 @@ 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' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long-animation-frame' }, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, }), }), @@ -94,7 +94,7 @@ 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.filepath': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.long-animation-frame' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long-animation-frame' }, [SEMANTIC_ATTRIBUTE_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 5a0e27f84c2e..a1b3b08c4e33 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,7 @@ import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -44,7 +45,7 @@ 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', + [SENTRY_OP]: 'ui.long-animation-frame', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }), @@ -98,7 +99,7 @@ sentryTest( 'browser.script.invoker': 'BUTTON#clickme.onclick', 'browser.script.invoker_type': 'event-listener', 'code.filepath': 'https://sentry-test-site.example/path/to/script.js', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long-animation-frame', + [SENTRY_OP]: 'ui.long-animation-frame', [SEMANTIC_ATTRIBUTE_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 4e3ef4f35f2c..2c8deba4f7dc 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,8 @@ +import { 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,7 +48,7 @@ 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' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long-animation-frame' }, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' }, }), }), @@ -96,7 +97,7 @@ 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.filepath': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.long-animation-frame' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long-animation-frame' }, [SEMANTIC_ATTRIBUTE_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 50791c09bfa9..4bea624bdb51 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,7 @@ import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/browser'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -46,7 +47,7 @@ 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', + [SENTRY_OP]: 'ui.long-animation-frame', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }), @@ -100,7 +101,7 @@ sentryTest( 'browser.script.invoker': 'BUTTON#clickme.onclick', 'browser.script.invoker_type': 'event-listener', 'code.filepath': 'https://sentry-test-site.example/path/to/script.js', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long-animation-frame', + [SENTRY_OP]: 'ui.long-animation-frame', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }), diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled-streamed/test.ts index e312078254d8..a9b76605fdd7 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled-streamed/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; @@ -28,7 +29,7 @@ sentryTest('captures long task.', async ({ browserName, getLocalTestUrl, page }) name: 'Main UI thread blocked', parent_span_id: pageloadSpan.span_id, attributes: expect.objectContaining({ - 'sentry.op': { type: 'string', value: 'ui.long-task' }, + [SENTRY_OP]: { type: 'string', value: 'ui.long-task' }, }), }), ); 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 b68d1903a0db..c2f3e162993d 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -47,14 +47,14 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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 581c2881dbc4..1c7efc53deac 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,13 +1,12 @@ import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; sentryTest( 'creates a pageload and navigation root spans each with multiple navigation.redirect childspans', @@ -35,7 +34,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'cancelled', }); @@ -55,7 +54,7 @@ sentryTest( expect(redirectSpan?.timestamp).toEqual(redirectSpan?.start_timestamp); expect(redirectSpan).toEqual({ data: { - 'sentry.op': 'navigation.redirect', + [SENTRY_OP]: 'navigation.redirect', 'sentry.origin': 'auto.navigation.browser', 'sentry.source': 'url', [URL_FULL]: expect.any(String), 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 b835b0296c14..2a37a2ba3fd2 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,13 +1,12 @@ import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; sentryTest('creates a pageload root span with navigation.redirect childspan', async ({ getLocalTestUrl, page }) => { if (shouldSkipTracingTest()) { @@ -28,7 +27,7 @@ sentryTest('creates a pageload root span with navigation.redirect childspan', as [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); @@ -51,7 +50,7 @@ sentryTest('creates a pageload root span with navigation.redirect childspan', as expect(redirectSpan?.timestamp).toEqual(redirectSpan?.start_timestamp); expect(redirectSpan).toEqual({ data: { - 'sentry.op': 'navigation.redirect', + [SENTRY_OP]: 'navigation.redirect', 'sentry.origin': 'auto.navigation.browser', 'sentry.source': 'url', [URL_FULL]: 'http://sentry-test.io/sub-page', 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 19cb5c08d97d..216392ea1bd1 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,13 +2,12 @@ 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, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; -import { SENTRY_TRACE_LIFECYCLE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { SENTRY_TRACE_LIFECYCLE, URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { @@ -118,7 +117,7 @@ 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', }, @@ -227,7 +226,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page }) type: 'string', value: 'url', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'navigation', }, @@ -252,7 +251,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 cd80a2e3fa8e..751521901ae1 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,7 +1,7 @@ +import { SENTRY_OP } 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, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -44,14 +44,14 @@ sentryTest('should create a navigation transaction on page navigation', async ({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); expect(pageloadRequest.request).toEqual({ @@ -122,7 +122,7 @@ sentryTest('should handle pushState with full URL', async ({ getLocalTestUrl, pa [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); expect(navigationRequest.request).toEqual({ @@ -142,7 +142,7 @@ sentryTest('should handle pushState with full URL', async ({ getLocalTestUrl, pa [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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 50722ad418a8..f1f60024dd34 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,7 +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, @@ -16,6 +15,7 @@ import { SENTRY_TRACE_LIFECYCLE, URL_FULL, URL_PATH, + SENTRY_OP, } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -129,7 +129,7 @@ sentryTest( type: 'string', value: 'idleTimeout', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'pageload', }, 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 ff4cd1e1fffa..9aa04ceda37e 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -30,7 +30,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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 b444f55ee3a1..c6ee4fb7d6f2 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -28,7 +28,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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 9dd0086ba411..0ef721a7e0e1 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -29,7 +29,7 @@ sentryTest('creates a pageload transaction with url as source', async ({ getLoca [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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 25ea24e6cbfe..cc9c16119a5c 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -29,7 +29,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: expect.objectContaining({ value: 1 }), [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'url' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'pageload' }, + [SENTRY_OP]: { type: 'string', value: 'pageload' }, [SEMANTIC_ATTRIBUTE_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 74ac5aedf101..0859955822fd 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -28,7 +28,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: expect.objectContaining({ value: 1 }), [SEMANTIC_ATTRIBUTE_SENTRY_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 001e87ad31fc..2b4094957f6f 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -28,7 +28,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.pageload.browser' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: expect.objectContaining({ value: 1 }), [SEMANTIC_ATTRIBUTE_SENTRY_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 cb346c55745a..1959247c01fb 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -30,7 +30,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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 df90ed1443f6..916191a9d5f7 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -30,7 +30,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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 75789cdc6de9..f7b9cd3b4ffa 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,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -30,7 +30,7 @@ sentryTest( [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_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/http-client-span-streamed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/http-client-span-streamed/test.ts index 3072734d2b79..8a68f2f04189 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/http-client-span-streamed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/http-client-span-streamed/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../utils/helpers'; @@ -26,6 +27,6 @@ sentryTest( expect(span.name).toMatch(/^GET /); expect(span.attributes['sentry.origin']).toEqual({ type: 'string', value: 'auto.http.browser' }); - expect(span.attributes['sentry.op']).toEqual({ type: 'string', value: 'http.client' }); + expect(span.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'http.client' }); }, ); diff --git a/dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/child/subject.js b/dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/child/subject.js index 47c336e973cd..6549293e9d22 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/child/subject.js +++ b/dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/child/subject.js @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; Sentry.startSpan({ name: 'parent-span' }, () => { Sentry.startSpan({ name: 'keep-me' }, () => {}); @@ -22,7 +23,7 @@ Sentry.startSpan({ name: 'parent-span' }, () => { Sentry.startSpan({ name: 'name-passes-but-op-not-span-1', op: 'ignored-op' }, () => {}); Sentry.startSpan( // sentry.op attribute has precedence over top op argument - { name: 'name-passes-but-op-not-span-2', op: 'keep', attributes: { 'sentry.op': 'ignored-op' } }, + { name: 'name-passes-but-op-not-span-2', op: 'keep', attributes: { [SENTRY_OP]: 'ignored-op' } }, () => {}, ); diff --git a/dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/continued-trace-http-client/init.js b/dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/continued-trace-http-client/init.js index 788e05781740..d7d3d7fbb7e2 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/continued-trace-http-client/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/ignoreSpans-streamed/continued-trace-http-client/init.js @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; @@ -5,7 +6,7 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', integrations: [Sentry.browserTracingIntegration(), Sentry.spanStreamingIntegration()], - ignoreSpans: [{ attributes: { 'sentry.op': 'http.client' } }], + ignoreSpans: [{ attributes: { [SENTRY_OP]: 'http.client' } }], tracePropagationTargets: ['sentry-test-external.io'], tracesSampleRate: 0, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans-domexception-details/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans-domexception-details/test.ts index a990694b46bf..1836972b2626 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans-domexception-details/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans-domexception-details/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -24,7 +25,7 @@ sentryTest( const restrictedMeasure = measureSpans?.find(span => span.description === 'restricted-test-measure'); expect(restrictedMeasure).toBeDefined(); expect(restrictedMeasure?.data).toMatchObject({ - 'sentry.op': 'measure', + [SENTRY_OP]: 'measure', 'sentry.origin': 'auto.resource.browser.metrics', }); @@ -38,7 +39,7 @@ sentryTest( expect(normalMeasure).toBeDefined(); expect(normalMeasure?.data).toMatchObject({ 'sentry.browser.measure.detail': 'this-should-work', - 'sentry.op': 'measure', + [SENTRY_OP]: 'measure', 'sentry.origin': 'auto.resource.browser.metrics', }); @@ -46,7 +47,7 @@ sentryTest( const complexMeasure = measureSpans?.find(span => span.description === 'complex-detail-measure'); expect(complexMeasure).toBeDefined(); expect(complexMeasure?.data).toMatchObject({ - 'sentry.op': 'measure', + [SENTRY_OP]: 'measure', 'sentry.origin': 'auto.resource.browser.metrics', // The entire nested object is stringified as a single value 'sentry.browser.measure.detail.nested': JSON.stringify({ diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans/test.ts index 8d331118028e..56b464c09b11 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -29,7 +30,7 @@ sentryTest('should add browser-related spans to pageload transaction', async ({ expect(measureSpan?.data).toEqual({ 'sentry.browser.measure_happened_before_request': true, 'sentry.browser.measure_start_time': expect.any(Number), - 'sentry.op': 'measure', + [SENTRY_OP]: 'measure', 'sentry.origin': 'auto.resource.browser.metrics', }); }); 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 128f1ead9a4a..370e13f37f74 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 } 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, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -95,7 +96,7 @@ 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', + [SENTRY_OP]: 'resource.img', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'sentry-test-site.example', 'url.same_origin': false, @@ -143,7 +144,7 @@ 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', + [SENTRY_OP]: 'resource.link', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'sentry-test-site.example', 'url.same_origin': false, @@ -185,7 +186,7 @@ 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', - 'sentry.op': 'resource.script', + [SENTRY_OP]: 'resource.script', 'sentry.origin': 'auto.resource.browser.metrics', 'server.address': 'sentry-test-site.example', 'url.same_origin': false, diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-streamed-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-streamed-spans/test.ts index 185da910fced..942af4c630b7 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-streamed-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-streamed-spans/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Page } from '@playwright/test'; import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; @@ -33,7 +34,7 @@ sentryTest('captures CLS as a streamed span with source attributes', async ({ ge const clsSpan = await clsSpanPromise; const pageloadSpan = await pageloadSpanPromise; - expect(clsSpan.attributes['sentry.op']).toEqual({ type: 'string', value: 'ui.webvital.cls' }); + expect(clsSpan.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'ui.webvital.cls' }); expect(clsSpan.attributes['sentry.origin']).toEqual({ type: 'string', value: 'auto.http.browser.cls' }); expect(clsSpan.attributes['sentry.exclusive_time']).toEqual({ type: 'integer', value: 0 }); expect(clsSpan.attributes['user_agent.original']?.value).toEqual(expect.stringContaining('Chrome')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts index a882c06c1e11..bc7436693e47 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event as SentryEvent, SpanEnvelope } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -63,7 +64,7 @@ sentryTest('should capture an INP click event span after pageload', async ({ bro expect(spanEnvelopeItem).toEqual({ data: { 'sentry.exclusive_time': inpValue, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', 'sentry.source': 'custom', transaction: 'test-url', diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-navigate/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-navigate/test.ts index d1cc7cce020d..70afe1306c50 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-navigate/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-navigate/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event as SentryEvent, SpanEnvelope } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -66,7 +67,7 @@ sentryTest( expect(spanEnvelopeItem).toEqual({ data: { 'sentry.exclusive_time': inpValue, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', 'sentry.source': 'custom', transaction: 'test-url', @@ -147,7 +148,7 @@ sentryTest( expect(spanEnvelopeItem).toEqual({ data: { 'sentry.exclusive_time': inpValue, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', 'sentry.source': 'custom', transaction: 'test-url', diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts index d1dea39f0231..c7ca212977b7 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event as SentryEvent, SpanEnvelope } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -66,7 +67,7 @@ sentryTest( expect(spanEnvelopeItem).toEqual({ data: { 'sentry.exclusive_time': inpValue, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', 'sentry.source': 'custom', transaction: 'test-route', diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts index a7d614147f83..1f1a28fe00e3 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { SpanEnvelope } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -64,7 +65,7 @@ sentryTest( expect(spanEnvelopeItem).toEqual({ data: { 'sentry.exclusive_time': inpValue, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', transaction: 'test-route', 'user_agent.original': expect.stringContaining('Chrome'), diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-streamed-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-streamed-spans/test.ts index 947522d14d1c..ae564b92c26c 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-streamed-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-streamed-spans/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; import { hidePage, shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -27,7 +28,7 @@ sentryTest('captures INP click as a streamed span', async ({ getLocalTestUrl, pa const inpSpan = await inpSpanPromise; const pageloadSpan = await pageloadSpanPromise; - expect(inpSpan.attributes['sentry.op']).toEqual({ type: 'string', value: 'ui.interaction.click' }); + expect(inpSpan.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'ui.interaction.click' }); expect(inpSpan.attributes['sentry.origin']).toEqual({ type: 'string', value: 'auto.http.browser.inp' }); expect(inpSpan.attributes['user_agent.original']?.value).toEqual(expect.stringContaining('Chrome')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts index ee92b13802ec..4ce4afd10354 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import type { Event as SentryEvent, SpanEnvelope, SpanJSON } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -63,7 +64,7 @@ sentryTest('should capture an INP click event span during pageload', async ({ br expect(spanEnvelopeItem).toEqual({ data: { 'sentry.exclusive_time': inpValue, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', transaction: 'test-url', 'user_agent.original': expect.stringContaining('Chrome'), diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp-streamed-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp-streamed-spans/test.ts index 74ec5175c511..8854da1905fc 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp-streamed-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp-streamed-spans/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Route } from '@playwright/test'; import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; @@ -35,7 +36,7 @@ sentryTest('captures LCP as a streamed span with element attributes', async ({ g const lcpSpan = await lcpSpanPromise; const pageloadSpan = await pageloadSpanPromise; - expect(lcpSpan.attributes['sentry.op']).toEqual({ type: 'string', value: 'ui.webvital.lcp' }); + expect(lcpSpan.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'ui.webvital.lcp' }); expect(lcpSpan.attributes['sentry.origin']).toEqual({ type: 'string', value: 'auto.http.browser.lcp' }); expect(lcpSpan.attributes['sentry.exclusive_time']).toEqual({ type: 'integer', value: 0 }); expect(lcpSpan.attributes['user_agent.original']?.value).toEqual(expect.stringContaining('Chrome')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts index e2b3e346a214..fa019684c847 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../utils/helpers'; @@ -35,7 +36,7 @@ sentryTest('strips query params in fetch request spans', async ({ getLocalTestUr 'http.query': '?id=123;page=5', 'http.response.status_code': 200, 'http.response_content_length': 2, - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', type: 'fetch', 'server.address': 'sentry-test-site.example', @@ -79,7 +80,7 @@ sentryTest('strips hash fragment in fetch request spans', async ({ getLocalTestU 'http.fragment': '#fragment', 'http.response.status_code': 200, 'http.response_content_length': 2, - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', type: 'fetch', 'server.address': 'sentry-test-site.example', @@ -124,7 +125,7 @@ sentryTest('strips hash fragment and query params in fetch request spans', async 'http.fragment': '#fragment', 'http.response.status_code': 200, 'http.response_content_length': 2, - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', type: 'fetch', 'server.address': 'sentry-test-site.example', @@ -169,7 +170,7 @@ sentryTest( 'http.fragment': '#fragment', 'http.response.status_code': 200, 'http.response_content_length': 2, - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', type: 'fetch', 'server.address': 'sentry-test.io', diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-strip-query-and-fragment/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-strip-query-and-fragment/test.ts index 30c08c5cb61b..03838d2d8bd0 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-strip-query-and-fragment/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-strip-query-and-fragment/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../utils/helpers'; @@ -34,7 +35,7 @@ sentryTest('strips query params in XHR request spans', async ({ getLocalTestUrl, 'url.full': 'http://sentry-test-site.example/0?id=123;page=5', 'http.query': '?id=123;page=5', 'http.response.status_code': 200, - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', type: 'xhr', 'server.address': 'sentry-test-site.example', @@ -77,7 +78,7 @@ sentryTest('strips hash fragment in XHR request spans', async ({ getLocalTestUrl 'url.full': 'http://sentry-test-site.example/1#fragment', 'http.fragment': '#fragment', 'http.response.status_code': 200, - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', type: 'xhr', 'server.address': 'sentry-test-site.example', @@ -121,7 +122,7 @@ sentryTest('strips hash fragment and query params in XHR request spans', async ( 'http.query': '?id=1', 'http.fragment': '#fragment', 'http.response.status_code': 200, - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', type: 'xhr', 'server.address': 'sentry-test-site.example', @@ -165,7 +166,7 @@ sentryTest( 'http.query': '?id=1', 'http.fragment': '#fragment', 'http.response.status_code': 200, - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.browser', type: 'xhr', 'server.address': 'sentry-test.io', diff --git a/dev-packages/browser-integration-tests/utils/spanUtils.ts b/dev-packages/browser-integration-tests/utils/spanUtils.ts index 532f2ce5c526..f7fd988c9cb9 100644 --- a/dev-packages/browser-integration-tests/utils/spanUtils.ts +++ b/dev-packages/browser-integration-tests/utils/spanUtils.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Page } from '@playwright/test'; import type { SerializedStreamedSpan, StreamedSpanEnvelope } from '@sentry/core'; import { properFullEnvelopeParser } from './helpers'; @@ -125,7 +126,7 @@ export async function observeStreamedSpan( } export function getSpanOp(span: SerializedStreamedSpan): string | undefined { - return span.attributes['sentry.op']?.type === 'string' ? span.attributes['sentry.op']?.value : undefined; + return span.attributes[SENTRY_OP]?.type === 'string' ? span.attributes[SENTRY_OP]?.value : undefined; } export function getSpansFromEnvelope(envelope: StreamedSpanEnvelope): SerializedStreamedSpan[] { diff --git a/dev-packages/cloudflare-integration-tests/suites/d1/test.ts b/dev-packages/cloudflare-integration-tests/suites/d1/test.ts index 98338d910b64..4e9c5645fc79 100644 --- a/dev-packages/cloudflare-integration-tests/suites/d1/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/d1/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Envelope } from '@sentry/core'; import { expect, it } from 'vitest'; import { createRunner } from '../../runner'; @@ -35,7 +36,7 @@ it('instruments D1 prepare().all() automatically via env', async ({ signal }) => 'cloudflare.d1.duration': expect.any(Number), 'cloudflare.d1.rows_read': expect.any(Number), 'cloudflare.d1.rows_written': expect.any(Number), - 'sentry.op': 'db.query', + [SENTRY_OP]: 'db.query', 'sentry.origin': 'auto.db.cloudflare.d1', }, description: 'SELECT * FROM users WHERE id = ?', @@ -112,7 +113,7 @@ it('instruments D1 exec() automatically via env', async ({ signal }) => { 'db.system.name': 'cloudflare-d1', 'db.operation.name': 'exec', 'db.query.text': 'CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)', - 'sentry.op': 'db.query', + [SENTRY_OP]: 'db.query', 'sentry.origin': 'auto.db.cloudflare.d1', }, description: 'CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)', @@ -206,7 +207,7 @@ it('instruments D1 batch() automatically via env', async ({ signal }) => { 'db.operation.name': 'batch', 'db.query.text': 'INSERT INTO users (name) VALUES (?)\nINSERT INTO users (name) VALUES (?)', 'db.operation.batch.size': 2, - 'sentry.op': 'db.query', + [SENTRY_OP]: 'db.query', 'sentry.origin': 'auto.db.cloudflare.d1', }, description: 'D1 batch', diff --git a/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan-streamed/test.ts b/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan-streamed/test.ts index cd900f6b2a43..cf22504d7e14 100644 --- a/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan-streamed/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan-streamed/test.ts @@ -2,7 +2,6 @@ import type { Envelope, SerializedStreamedSpanContainer } from '@sentry/core'; import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, @@ -15,6 +14,7 @@ import { SENTRY_SEGMENT_ID, SENTRY_SEGMENT_NAME, SENTRY_TRACE_LIFECYCLE, + SENTRY_OP, } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { createRunner } from '../../../runner'; @@ -81,7 +81,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa expect(childSpan).toEqual({ attributes: { [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'test-child', }, @@ -165,7 +165,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa expect(parentTestSpan).toEqual({ attributes: { [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 }, @@ -197,7 +197,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa [SEMANTIC_ATTRIBUTE_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 }, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'route' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/anthropic-ai/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/anthropic-ai/test.ts index 6817843cde27..66a45c9ed701 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/anthropic-ai/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/anthropic-ai/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { GEN_AI_OPERATION_NAME_ATTRIBUTE, @@ -39,7 +40,7 @@ it('traces a basic message creation request with the anthropic SDK', async ({ si is_segment: false, attributes: { 'sentry.origin': { value: 'auto.ai.anthropic', type: 'string' }, - 'sentry.op': { value: 'gen_ai.chat', type: 'string' }, + [SENTRY_OP]: { value: 'gen_ai.chat', type: 'string' }, [GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'anthropic', type: 'string' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'chat', type: 'string' }, [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'claude-3-haiku-20240307', type: 'string' }, 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 9755b9e4dd9f..00d1b9335075 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { createRunner } from '../../../runner'; it('D1 database queries create spans with correct attributes', async ({ signal }) => { @@ -13,7 +14,7 @@ it('D1 database queries create spans with correct attributes', async ({ signal } spans: [ { data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.query', + [SENTRY_OP]: 'db.query', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', 'db.system.name': 'cloudflare-d1', 'db.operation.name': 'exec', @@ -30,7 +31,7 @@ it('D1 database queries create spans with correct attributes', async ({ signal } }, { data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.query', + [SENTRY_OP]: 'db.query', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', 'db.system.name': 'cloudflare-d1', 'db.operation.name': 'run', @@ -61,7 +62,7 @@ it('D1 database queries create spans with correct attributes', async ({ signal } spans: [ { data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.query', + [SENTRY_OP]: 'db.query', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', 'db.system.name': 'cloudflare-d1', 'db.operation.name': 'first', 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 8e185df57558..f32fac6ab951 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,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Envelope, TransactionEvent } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { expect, it } from 'vitest'; import { createRunner } from '../../../runner'; @@ -34,7 +35,7 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal op: 'db.query', origin: 'auto.db.cloudflare.durable_object.sql', data: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.query', + [SENTRY_OP]: 'db.query', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 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 25103e4e0ceb..956e86149523 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,7 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Envelope, TransactionEvent } from '@sentry/core'; import { expect, it } from 'vitest'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { createRunner } from '../../../runner'; const flushMarkerMatcher = (envelope: Envelope): void => { @@ -32,7 +33,7 @@ it('instruments sync KV operations on Durable Object storage', async ({ signal } op: 'db', origin: 'auto.db.cloudflare.durable_object', data: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', + [SENTRY_OP]: 'db', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'put', diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject/test.ts index 4e9e65f22118..3f14d7975da4 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import type { Event } from '@sentry/core'; import { createRunner } from '../../../runner'; @@ -12,7 +13,7 @@ it('traces a durable object method', async ({ signal }) => { trace: expect.objectContaining({ op: 'rpc', data: expect.objectContaining({ - 'sentry.op': 'rpc', + [SENTRY_OP]: 'rpc', 'sentry.origin': 'auto.faas.cloudflare.durable_object', }), origin: 'auto.faas.cloudflare.durable_object', diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/google-genai/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/google-genai/test.ts index 30941df9b7ea..62b5cde5c868 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/google-genai/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/google-genai/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import type { SerializedStreamedSpan } from '@sentry/core'; import { @@ -42,7 +43,7 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({ is_segment: false, attributes: { 'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' }, - 'sentry.op': { value: 'gen_ai.chat', type: 'string' }, + [SENTRY_OP]: { value: 'gen_ai.chat', type: 'string' }, [GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'google_genai', type: 'string' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'chat', type: 'string' }, [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'gemini-1.5-pro', type: 'string' }, @@ -63,7 +64,7 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({ is_segment: false, attributes: { 'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' }, - 'sentry.op': { value: 'gen_ai.generate_content', type: 'string' }, + [SENTRY_OP]: { value: 'gen_ai.generate_content', type: 'string' }, [GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'google_genai', type: 'string' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'generate_content', type: 'string' }, [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'gemini-1.5-flash', type: 'string' }, @@ -87,7 +88,7 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({ is_segment: false, attributes: { 'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' }, - 'sentry.op': { value: 'gen_ai.embeddings', type: 'string' }, + [SENTRY_OP]: { value: 'gen_ai.embeddings', type: 'string' }, [GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'google_genai', type: 'string' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'embeddings', type: 'string' }, [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'text-embedding-004', type: 'string' }, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/ignoreSpans-streamed/continued-trace-http-client/index.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/ignoreSpans-streamed/continued-trace-http-client/index.ts index eee940bc8f3a..231a86c46097 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/ignoreSpans-streamed/continued-trace-http-client/index.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/ignoreSpans-streamed/continued-trace-http-client/index.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/cloudflare'; interface Env { @@ -10,7 +11,7 @@ export default Sentry.withSentry( dsn: env.SENTRY_DSN, tracesSampleRate: 0, traceLifecycle: 'stream', - ignoreSpans: [{ attributes: { 'sentry.op': 'http.client' } }], + ignoreSpans: [{ attributes: { [SENTRY_OP]: 'http.client' } }], tracePropagationTargets: [env.SERVER_URL], }), { diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/langchain/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/langchain/test.ts index 927057035ccc..90ac9cacd4f6 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/langchain/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/langchain/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { GEN_AI_OPERATION_NAME_ATTRIBUTE, @@ -41,7 +42,7 @@ it('traces a LangChain chat model invocation', async ({ signal }) => { is_segment: false, attributes: { 'sentry.origin': { value: 'auto.ai.langchain', type: 'string' }, - 'sentry.op': { value: 'gen_ai.chat', type: 'string' }, + [SENTRY_OP]: { value: 'gen_ai.chat', type: 'string' }, [GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'openai', type: 'string' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'chat', type: 'string' }, [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'gpt-3.5-turbo', type: 'string' }, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/langgraph/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/langgraph/test.ts index aad02e48ee73..7773bb4bf533 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/langgraph/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/langgraph/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import type { SerializedStreamedSpan } from '@sentry/core'; import { @@ -44,7 +45,7 @@ it('traces langgraph compile and invoke operations', async ({ signal }) => { type: 'string', value: 'create_agent', }); - expect(createAgentSpan!.attributes['sentry.op']).toEqual({ type: 'string', value: 'gen_ai.create_agent' }); + expect(createAgentSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.create_agent' }); expect(createAgentSpan!.attributes['sentry.origin']).toEqual({ type: 'string', value: 'auto.ai.langgraph' }); expect(createAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE]).toEqual({ type: 'string', @@ -60,7 +61,7 @@ it('traces langgraph compile and invoke operations', async ({ signal }) => { type: 'string', value: 'invoke_agent', }); - expect(invokeAgentSpan!.attributes['sentry.op']).toEqual({ type: 'string', value: 'gen_ai.invoke_agent' }); + expect(invokeAgentSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.invoke_agent' }); expect(invokeAgentSpan!.attributes['sentry.origin']).toEqual({ type: 'string', value: 'auto.ai.langgraph' }); expect(invokeAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE]).toEqual({ type: 'string', diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/openai/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/openai/test.ts index 87e11a18e618..6f30566bbdde 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/openai/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/openai/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { GEN_AI_OPERATION_NAME_ATTRIBUTE, @@ -39,7 +40,7 @@ it('traces a basic chat completion request with the openai SDK', async ({ signal is_segment: false, attributes: { 'sentry.origin': { value: 'auto.ai.openai', type: 'string' }, - 'sentry.op': { value: 'gen_ai.chat', type: 'string' }, + [SENTRY_OP]: { value: 'gen_ai.chat', type: 'string' }, [GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'openai', type: 'string' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'chat', type: 'string' }, [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'gpt-3.5-turbo', type: 'string' }, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/propagation/worker-workerentrypoint-rpc/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/propagation/worker-workerentrypoint-rpc/test.ts index 9309d0f4f97b..76b60c9ac973 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/propagation/worker-workerentrypoint-rpc/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/propagation/worker-workerentrypoint-rpc/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import type { Event } from '@sentry/core'; import { createRunner } from '../../../../runner'; @@ -165,7 +166,7 @@ it('instruments inherited custom WorkerEntrypoint RPC methods and strips metadat op: 'rpc', origin: 'auto.faas.cloudflare.worker_entrypoint', data: expect.objectContaining({ - 'sentry.op': 'rpc', + [SENTRY_OP]: 'rpc', 'sentry.origin': 'auto.faas.cloudflare.worker_entrypoint', }), }), @@ -186,7 +187,7 @@ it('instruments inherited custom WorkerEntrypoint RPC methods and strips metadat op: 'rpc', origin: 'auto.faas.cloudflare.worker_entrypoint', data: expect.objectContaining({ - 'sentry.op': 'rpc', + [SENTRY_OP]: 'rpc', 'sentry.origin': 'auto.faas.cloudflare.worker_entrypoint', }), }), diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/propagation/workflow-do/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/propagation/workflow-do/test.ts index 818e92d8d677..63a7136a6eaa 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/propagation/workflow-do/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/propagation/workflow-do/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import type { Event } from '@sentry/core'; import { createRunner } from '../../../../runner'; @@ -17,7 +18,7 @@ it('traces a workflow that calls a durable object with the same trace id', async trace: expect.objectContaining({ op: 'function.step.do', data: expect.objectContaining({ - 'sentry.op': 'function.step.do', + [SENTRY_OP]: 'function.step.do', 'sentry.origin': 'auto.faas.cloudflare.workflow', }), origin: 'auto.faas.cloudflare.workflow', 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 462f4f046b78..95a87ec3c78f 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts @@ -1,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, @@ -25,7 +25,7 @@ it('Scheduled handler creates transaction with correct attributes', async ({ sig op: 'faas.cron', origin: 'auto.faas.cloudflare.scheduled', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'faas.cron', + [SENTRY_OP]: 'faas.cron', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.scheduled', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/vercelai/als_v6/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/vercelai/als_v6/test.ts index 5e615a51d204..3d30de9fd2a7 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/vercelai/als_v6/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/vercelai/als_v6/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { GEN_AI_OPERATION_NAME_ATTRIBUTE, @@ -30,7 +31,7 @@ it('captures a transaction with Vercel AI v6 spans via @sentry/cloudflare vercel status: 'ok', is_segment: false, attributes: expect.objectContaining({ - 'sentry.op': { type: 'string', value: 'gen_ai.invoke_agent' }, + [SENTRY_OP]: { type: 'string', value: 'gen_ai.invoke_agent' }, 'sentry.origin': { type: 'string', value: 'auto.vercelai.otel' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { type: 'string', value: 'invoke_agent' }, [GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: { type: 'integer', value: 10 }, @@ -48,7 +49,7 @@ it('captures a transaction with Vercel AI v6 spans via @sentry/cloudflare vercel status: 'ok', is_segment: false, attributes: expect.objectContaining({ - 'sentry.op': { type: 'string', value: 'gen_ai.generate_content' }, + [SENTRY_OP]: { type: 'string', value: 'gen_ai.generate_content' }, 'sentry.origin': { type: 'string', value: 'auto.vercelai.otel' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { type: 'string', value: 'generate_content' }, }), diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/vercelai/compat_v6/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/vercelai/compat_v6/test.ts index 0b22ff6365f7..0d58d56f0a16 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/vercelai/compat_v6/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/vercelai/compat_v6/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { GEN_AI_OPERATION_NAME_ATTRIBUTE, @@ -32,7 +33,7 @@ it('captures a transaction with Vercel AI v6 spans via @sentry/cloudflare/nodejs status: 'ok', is_segment: false, attributes: expect.objectContaining({ - 'sentry.op': { type: 'string', value: 'gen_ai.invoke_agent' }, + [SENTRY_OP]: { type: 'string', value: 'gen_ai.invoke_agent' }, 'sentry.origin': { type: 'string', value: 'auto.vercelai.otel' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { type: 'string', value: 'invoke_agent' }, [GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: { type: 'integer', value: 10 }, @@ -50,7 +51,7 @@ it('captures a transaction with Vercel AI v6 spans via @sentry/cloudflare/nodejs status: 'ok', is_segment: false, attributes: expect.objectContaining({ - 'sentry.op': { type: 'string', value: 'gen_ai.generate_content' }, + [SENTRY_OP]: { type: 'string', value: 'gen_ai.generate_content' }, 'sentry.origin': { type: 'string', value: 'auto.vercelai.otel' }, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: { type: 'string', value: 'generate_content' }, }), diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/workers-ai/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/workers-ai/test.ts index e5c835f37508..1a2a27deac18 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/workers-ai/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/workers-ai/test.ts @@ -1,4 +1,4 @@ -import { GEN_AI_PROVIDER_NAME } from '@sentry/conventions/attributes'; +import { GEN_AI_PROVIDER_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { GEN_AI_OPERATION_NAME_ATTRIBUTE, @@ -44,7 +44,7 @@ it('traces a basic Workers AI text generation request', async ({ signal }) => { origin: 'auto.ai.cloudflare.workers_ai', data: { 'sentry.origin': 'auto.ai.cloudflare.workers_ai', - 'sentry.op': 'gen_ai.chat', + [SENTRY_OP]: 'gen_ai.chat', [GEN_AI_PROVIDER_NAME]: 'cloudflare.workers_ai', [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'chat', [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: '@cf/meta/llama-3.1-8b-instruct', @@ -89,7 +89,7 @@ it('traces a streaming Workers AI text generation request', async ({ signal }) = origin: 'auto.ai.cloudflare.workers_ai', data: { 'sentry.origin': 'auto.ai.cloudflare.workers_ai', - 'sentry.op': 'gen_ai.chat', + [SENTRY_OP]: 'gen_ai.chat', [GEN_AI_PROVIDER_NAME]: 'cloudflare.workers_ai', [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'chat', [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: '@cf/meta/llama-3.1-8b-instruct', 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 1ae37f87d64b..ce36854adddc 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts @@ -1,6 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, @@ -25,7 +25,7 @@ it('Workflow steps create transactions with correct attributes', async ({ signal origin: 'auto.faas.cloudflare.workflow', status: 'ok', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.step.do', + [SENTRY_OP]: 'function.step.do', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, @@ -52,7 +52,7 @@ it('Workflow steps create transactions with correct attributes', async ({ signal origin: 'auto.faas.cloudflare.workflow', status: 'ok', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.step.do', + [SENTRY_OP]: 'function.step.do', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, diff --git a/dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts index e2238d42a17a..e81ba2624d22 100644 --- a/dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts @@ -1,7 +1,7 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('angular-17', async transactionEvent => { @@ -261,7 +261,7 @@ test.describe('TraceDirective', () => { expect.arrayContaining([ expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // custom component name passed to trace directive @@ -272,7 +272,7 @@ test.describe('TraceDirective', () => { }), expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // fallback selector name @@ -305,7 +305,7 @@ test.describe('TraceClass Decorator', () => { expect(classDecoratorSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', }, description: '', @@ -335,7 +335,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngOnInit', + 'sentry.op': 'ui.angular.ngOnInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', @@ -363,7 +363,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngAfterViewInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngAfterViewInit', + 'sentry.op': 'ui.angular.ngAfterViewInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', diff --git a/dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts index 66146b4b49ae..3e6b7b76e072 100644 --- a/dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts @@ -1,7 +1,7 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('angular-18', async transactionEvent => { @@ -260,7 +260,7 @@ test.describe('TraceDirective', () => { expect(traceDirectiveSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', @@ -292,7 +292,7 @@ test.describe('TraceClass Decorator', () => { expect(classDecoratorSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', }, description: '', @@ -322,7 +322,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngOnInit', + 'sentry.op': 'ui.angular.ngOnInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', @@ -350,7 +350,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngAfterViewInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngAfterViewInit', + 'sentry.op': 'ui.angular.ngAfterViewInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', 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 826959def7b2..8d90a371a523 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,7 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('angular-19', async transactionEvent => { @@ -261,7 +261,7 @@ test.describe('TraceDirective', () => { expect.arrayContaining([ expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // custom component name passed to trace directive @@ -272,7 +272,7 @@ test.describe('TraceDirective', () => { }), expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // fallback selector name @@ -305,7 +305,7 @@ test.describe('TraceClass Decorator', () => { expect(classDecoratorSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', }, description: '', @@ -335,7 +335,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngOnInit', + 'sentry.op': 'ui.angular.ngOnInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', @@ -363,7 +363,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngAfterViewInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngAfterViewInit', + 'sentry.op': 'ui.angular.ngAfterViewInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', diff --git a/dev-packages/e2e-tests/test-applications/angular-20/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-20/tests/performance.test.ts index 18dbd47eb540..285bc6d78801 100644 --- a/dev-packages/e2e-tests/test-applications/angular-20/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-20/tests/performance.test.ts @@ -1,7 +1,7 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('angular-20', async transactionEvent => { @@ -261,7 +261,7 @@ test.describe('TraceDirective', () => { expect.arrayContaining([ expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // custom component name passed to trace directive @@ -272,7 +272,7 @@ test.describe('TraceDirective', () => { }), expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // fallback selector name @@ -305,7 +305,7 @@ test.describe('TraceClass Decorator', () => { expect(classDecoratorSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', }, description: '', @@ -335,7 +335,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngOnInit', + 'sentry.op': 'ui.angular.ngOnInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', @@ -363,7 +363,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngAfterViewInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngAfterViewInit', + 'sentry.op': 'ui.angular.ngAfterViewInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', diff --git a/dev-packages/e2e-tests/test-applications/angular-21/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-21/tests/performance.test.ts index d2617be9c653..ad48b1292852 100644 --- a/dev-packages/e2e-tests/test-applications/angular-21/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-21/tests/performance.test.ts @@ -1,7 +1,7 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('angular-21', async transactionEvent => { @@ -261,7 +261,7 @@ test.describe('TraceDirective', () => { expect.arrayContaining([ expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // custom component name passed to trace directive @@ -272,7 +272,7 @@ test.describe('TraceDirective', () => { }), expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // fallback selector name @@ -305,7 +305,7 @@ test.describe('TraceClass Decorator', () => { expect(classDecoratorSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', }, description: '', @@ -335,7 +335,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngOnInit', + 'sentry.op': 'ui.angular.ngOnInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', @@ -363,7 +363,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngAfterViewInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngAfterViewInit', + 'sentry.op': 'ui.angular.ngAfterViewInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', diff --git a/dev-packages/e2e-tests/test-applications/angular-22/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-22/tests/performance.test.ts index 4eca907379e4..2d016ca2a9d7 100644 --- a/dev-packages/e2e-tests/test-applications/angular-22/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-22/tests/performance.test.ts @@ -1,7 +1,7 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('angular-22', async transactionEvent => { @@ -261,7 +261,7 @@ test.describe('TraceDirective', () => { expect.arrayContaining([ expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // custom component name passed to trace directive @@ -272,7 +272,7 @@ test.describe('TraceDirective', () => { }), expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', }, description: '', // fallback selector name @@ -305,7 +305,7 @@ test.describe('TraceClass Decorator', () => { expect(classDecoratorSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', + 'sentry.op': 'ui.angular.init', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', }, description: '', @@ -335,7 +335,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngOnInit', + 'sentry.op': 'ui.angular.ngOnInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', @@ -363,7 +363,7 @@ test.describe('TraceMethod Decorator', () => { expect(ngAfterViewInitSpan).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngAfterViewInit', + 'sentry.op': 'ui.angular.ngAfterViewInit', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', }, description: '', diff --git a/dev-packages/e2e-tests/test-applications/nitro-3/tests/cache.test.ts b/dev-packages/e2e-tests/test-applications/nitro-3/tests/cache.test.ts index feda6b3ea3fe..0bea1441f92f 100644 --- a/dev-packages/e2e-tests/test-applications/nitro-3/tests/cache.test.ts +++ b/dev-packages/e2e-tests/test-applications/nitro-3/tests/cache.test.ts @@ -1,6 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nitro'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nitro'; test.describe('Cache Instrumentation', () => { const SEMANTIC_ATTRIBUTE_CACHE_KEY = 'cache.key'; @@ -19,7 +19,7 @@ test.describe('Cache Instrumentation', () => { const transaction = await transactionPromise; const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; const allCacheSpans = transaction.spans?.filter( @@ -40,7 +40,7 @@ test.describe('Cache Instrumentation', () => { ); expect(cacheMissSpan).toBeDefined(); expect(cacheMissSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: false, 'db.operation.name': 'getItem', @@ -55,7 +55,7 @@ test.describe('Cache Instrumentation', () => { ); expect(cacheHitSpan).toBeDefined(); expect(cacheHitSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'getItem', @@ -72,7 +72,7 @@ test.describe('Cache Instrumentation', () => { ); expect(cacheSetSpan).toBeDefined(); expect(cacheSetSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', 'db.operation.name': 'setItem', }); @@ -120,12 +120,8 @@ test.describe('Cache Instrumentation', () => { ); expect(allCacheSpans?.length).toBeGreaterThan(0); - const allGetItemSpans = allCacheSpans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.get_item', - ); - const allSetItemSpans = allCacheSpans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.set_item', - ); + const allGetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.get_item'); + const allSetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.set_item'); expect(allGetItemSpans?.length).toBeGreaterThan(0); expect(allSetItemSpans?.length).toBeGreaterThan(0); diff --git a/dev-packages/e2e-tests/test-applications/nitro-3/tests/storage-aliases.test.ts b/dev-packages/e2e-tests/test-applications/nitro-3/tests/storage-aliases.test.ts index 173e6c0b82d5..6554d2e10ad8 100644 --- a/dev-packages/e2e-tests/test-applications/nitro-3/tests/storage-aliases.test.ts +++ b/dev-packages/e2e-tests/test-applications/nitro-3/tests/storage-aliases.test.ts @@ -1,6 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nitro'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nitro'; test.describe('Storage Instrumentation - Aliases', () => { const prefixKey = (key: string) => `cache:${key}`; @@ -19,7 +19,7 @@ test.describe('Storage Instrumentation - Aliases', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test set (alias for setItem) @@ -28,7 +28,7 @@ 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.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), 'db.operation.name': 'setItem', @@ -42,7 +42,7 @@ 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_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -57,7 +57,7 @@ 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.has_item', + 'sentry.op': 'cache.has_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -72,7 +72,7 @@ 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_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp1'), 'db.operation.name': 'removeItem', @@ -83,7 +83,7 @@ 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_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp2'), 'db.operation.name': 'removeItem', diff --git a/dev-packages/e2e-tests/test-applications/nitro-3/tests/storage.test.ts b/dev-packages/e2e-tests/test-applications/nitro-3/tests/storage.test.ts index e4a959219c10..8a2e6c35087b 100644 --- a/dev-packages/e2e-tests/test-applications/nitro-3/tests/storage.test.ts +++ b/dev-packages/e2e-tests/test-applications/nitro-3/tests/storage.test.ts @@ -1,6 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nitro'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nitro'; test.describe('Storage Instrumentation', () => { const prefixKey = (key: string) => `cache:${key}`; @@ -19,7 +19,7 @@ test.describe('Storage Instrumentation', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test setItem spans @@ -28,7 +28,7 @@ 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.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), 'db.operation.name': 'setItem', @@ -44,7 +44,7 @@ test.describe('Storage Instrumentation', () => { ); expect(setItemRawSpan).toBeDefined(); expect(setItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.set_item_raw', + 'sentry.op': 'cache.set_item_raw', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), 'db.operation.name': 'setItemRaw', @@ -57,7 +57,7 @@ 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.has_item', + 'sentry.op': 'cache.has_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -71,7 +71,7 @@ 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_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -88,7 +88,7 @@ test.describe('Storage Instrumentation', () => { ); expect(getItemRawSpan).toBeDefined(); expect(getItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item_raw', + 'sentry.op': 'cache.get_item_raw', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -100,7 +100,7 @@ test.describe('Storage Instrumentation', () => { const getKeysSpans = findSpansByOp('cache.get_keys'); expect(getKeysSpans.length).toBeGreaterThanOrEqual(1); expect(getKeysSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_keys', + 'sentry.op': 'cache.get_keys', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', 'db.operation.name': 'getKeys', 'db.system.name': expect.any(String), @@ -114,7 +114,7 @@ test.describe('Storage Instrumentation', () => { ); expect(removeItemSpan).toBeDefined(); expect(removeItemSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.remove_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('batch:1'), 'db.operation.name': 'removeItem', @@ -125,7 +125,7 @@ test.describe('Storage Instrumentation', () => { const clearSpans = findSpansByOp('cache.clear'); expect(clearSpans.length).toBeGreaterThanOrEqual(1); expect(clearSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.clear', + 'sentry.op': 'cache.clear', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nitro', 'db.operation.name': 'clear', 'db.system.name': expect.any(String), diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.server.test.ts index df8032551228..00933f11a93e 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.server.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('nuxt-3-dynamic-import', transactionEvent => { @@ -14,7 +14,7 @@ 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', + 'sentry.op': 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.http', }), }), diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.server.test.ts index 260af81f11a4..95ae9495a89e 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.server.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('nuxt-3-min', transactionEvent => { @@ -14,7 +14,7 @@ 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', + 'sentry.op': 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.http', }), }), diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.server.test.ts index cc4b6cd36567..38a72ae5b207 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.server.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('nuxt-3-top-level-import', transactionEvent => { @@ -14,7 +14,7 @@ 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', + 'sentry.op': 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.http', }), }), diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/cache.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/cache.test.ts index a1697136ef01..77a9ce3e57e8 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/cache.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/cache.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Cache Instrumentation', () => { const SEMANTIC_ATTRIBUTE_CACHE_KEY = 'cache.key'; @@ -20,7 +20,7 @@ test.describe('Cache Instrumentation', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test that we have cache operations from cachedFunction and cachedEventHandler @@ -42,7 +42,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheMissSpan) { expect(cacheMissSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: false, 'db.operation.name': 'getItem', @@ -59,7 +59,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheHitSpan) { expect(cacheHitSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'getItem', @@ -78,7 +78,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheSetSpan) { expect(cacheSetSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'setItem', 'db.collection.name': expect.stringMatching(/^(cache)?$/), @@ -133,14 +133,10 @@ test.describe('Cache Instrumentation', () => { expect(allCacheSpans?.length).toBeGreaterThan(0); // Get all getItem operations - const allGetItemSpans = allCacheSpans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.get_item', - ); + const allGetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.get_item'); // Get all setItem operations - const allSetItemSpans = allCacheSpans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.set_item', - ); + const allSetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.set_item'); // We should have both get and set operations expect(allGetItemSpans?.length).toBeGreaterThan(0); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/storage-aliases.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/storage-aliases.test.ts index a721df04b40c..43c4c31f336b 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/storage-aliases.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/storage-aliases.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Storage Instrumentation - Aliases', () => { const prefixKey = (key: string) => `test-storage:${key}`; @@ -19,7 +19,7 @@ test.describe('Storage Instrumentation - Aliases', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test set (alias for setItem) @@ -28,7 +28,7 @@ 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.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), 'db.operation.name': 'setItem', @@ -43,7 +43,7 @@ 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_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -59,7 +59,7 @@ 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.has_item', + 'sentry.op': 'cache.has_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -75,7 +75,7 @@ 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_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp1'), 'db.operation.name': 'removeItem', @@ -87,7 +87,7 @@ 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_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp2'), 'db.operation.name': 'removeItem', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/storage.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/storage.test.ts index 2c451be51135..04aca71b6882 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/storage.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/storage.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Storage Instrumentation', () => { const prefixKey = (key: string) => `test-storage:${key}`; @@ -19,7 +19,7 @@ test.describe('Storage Instrumentation', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test setItem spans @@ -28,7 +28,7 @@ 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.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), 'db.operation.name': 'setItem', @@ -48,7 +48,7 @@ test.describe('Storage Instrumentation', () => { expect(setItemRawSpan).toBeDefined(); expect(setItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.set_item_raw', + 'sentry.op': 'cache.set_item_raw', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), 'db.operation.name': 'setItemRaw', @@ -62,7 +62,7 @@ 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.has_item', + 'sentry.op': 'cache.has_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -77,7 +77,7 @@ 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_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -95,7 +95,7 @@ test.describe('Storage Instrumentation', () => { ); expect(getItemRawSpan).toBeDefined(); expect(getItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item_raw', + 'sentry.op': 'cache.get_item_raw', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -108,7 +108,7 @@ test.describe('Storage Instrumentation', () => { const getKeysSpans = findSpansByOp('cache.get_keys'); expect(getKeysSpans.length).toBeGreaterThanOrEqual(1); expect(getKeysSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_keys', + 'sentry.op': 'cache.get_keys', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'getKeys', 'db.collection.name': 'test-storage', @@ -123,7 +123,7 @@ test.describe('Storage Instrumentation', () => { ); expect(removeItemSpan).toBeDefined(); expect(removeItemSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.remove_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('batch:1'), 'db.operation.name': 'removeItem', @@ -135,7 +135,7 @@ test.describe('Storage Instrumentation', () => { const clearSpans = findSpansByOp('cache.clear'); expect(clearSpans.length).toBeGreaterThanOrEqual(1); expect(clearSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.clear', + 'sentry.op': 'cache.clear', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'clear', 'db.collection.name': 'test-storage', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.server.test.ts index e7b6a5ddfc09..0ddb4d545b1e 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.server.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('nuxt-3', transactionEvent => { @@ -14,7 +14,7 @@ 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', + 'sentry.op': 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.http', }), }), diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/cache.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/cache.test.ts index 1295de002145..c9556a771785 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/cache.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/cache.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Cache Instrumentation', () => { const SEMANTIC_ATTRIBUTE_CACHE_KEY = 'cache.key'; @@ -20,7 +20,7 @@ test.describe('Cache Instrumentation', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test that we have cache operations from cachedFunction and cachedEventHandler @@ -42,7 +42,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheMissSpan) { expect(cacheMissSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: false, 'db.operation.name': 'getItem', @@ -59,7 +59,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheHitSpan) { expect(cacheHitSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'getItem', @@ -78,7 +78,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheSetSpan) { expect(cacheSetSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'setItem', 'db.collection.name': expect.stringMatching(/^(cache)?$/), @@ -133,14 +133,10 @@ test.describe('Cache Instrumentation', () => { expect(allCacheSpans?.length).toBeGreaterThan(0); // Get all getItem operations - const allGetItemSpans = allCacheSpans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.get_item', - ); + const allGetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.get_item'); // Get all setItem operations - const allSetItemSpans = allCacheSpans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.set_item', - ); + const allSetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.set_item'); // We should have both get and set operations expect(allGetItemSpans?.length).toBeGreaterThan(0); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/storage-aliases.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/storage-aliases.test.ts index 1e2fc1eb16b1..38744f11411b 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/storage-aliases.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/storage-aliases.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Storage Instrumentation - Aliases', () => { const prefixKey = (key: string) => `test-storage:${key}`; @@ -19,7 +19,7 @@ test.describe('Storage Instrumentation - Aliases', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test set (alias for setItem) @@ -28,7 +28,7 @@ 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.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), 'db.operation.name': 'setItem', @@ -43,7 +43,7 @@ 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_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -59,7 +59,7 @@ 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.has_item', + 'sentry.op': 'cache.has_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -75,7 +75,7 @@ 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_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp1'), 'db.operation.name': 'removeItem', @@ -87,7 +87,7 @@ 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_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp2'), 'db.operation.name': 'removeItem', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/storage.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/storage.test.ts index c171c9b6956f..773ab3947a7a 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/storage.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/storage.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Storage Instrumentation', () => { const prefixKey = (key: string) => `test-storage:${key}`; @@ -19,7 +19,7 @@ test.describe('Storage Instrumentation', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test setItem spans @@ -28,7 +28,7 @@ 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.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), 'db.operation.name': 'setItem', @@ -45,7 +45,7 @@ test.describe('Storage Instrumentation', () => { ); expect(setItemRawSpan).toBeDefined(); expect(setItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.set_item_raw', + 'sentry.op': 'cache.set_item_raw', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), 'db.operation.name': 'setItemRaw', @@ -59,7 +59,7 @@ 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.has_item', + 'sentry.op': 'cache.has_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -74,7 +74,7 @@ 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_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -92,7 +92,7 @@ test.describe('Storage Instrumentation', () => { ); expect(getItemRawSpan).toBeDefined(); expect(getItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item_raw', + 'sentry.op': 'cache.get_item_raw', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -105,7 +105,7 @@ test.describe('Storage Instrumentation', () => { const getKeysSpans = findSpansByOp('cache.get_keys'); expect(getKeysSpans.length).toBeGreaterThanOrEqual(1); expect(getKeysSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_keys', + 'sentry.op': 'cache.get_keys', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'getKeys', 'db.collection.name': 'test-storage', @@ -120,7 +120,7 @@ test.describe('Storage Instrumentation', () => { ); expect(removeItemSpan).toBeDefined(); expect(removeItemSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.remove_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('batch:1'), 'db.operation.name': 'removeItem', @@ -132,7 +132,7 @@ test.describe('Storage Instrumentation', () => { const clearSpans = findSpansByOp('cache.clear'); expect(clearSpans.length).toBeGreaterThanOrEqual(1); expect(clearSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.clear', + 'sentry.op': 'cache.clear', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'clear', 'db.collection.name': 'test-storage', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.server.test.ts index 91ccc021ceda..352b340568fb 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.server.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('nuxt-4', transactionEvent => { @@ -14,7 +14,7 @@ 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', + 'sentry.op': 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.http', }), }), diff --git a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/cache.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/cache.test.ts index 7a660b88d714..c95d01e9323f 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/cache.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/cache.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Cache Instrumentation', () => { const SEMANTIC_ATTRIBUTE_CACHE_KEY = 'cache.key'; @@ -20,7 +20,7 @@ test.describe('Cache Instrumentation', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test that we have cache operations from cachedFunction and cachedEventHandler @@ -42,7 +42,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheMissSpan) { expect(cacheMissSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: false, 'db.operation.name': 'getItem', @@ -59,7 +59,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheHitSpan) { expect(cacheHitSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, 'db.operation.name': 'getItem', @@ -78,7 +78,7 @@ test.describe('Cache Instrumentation', () => { ); if (cacheSetSpan) { expect(cacheSetSpan.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'setItem', 'db.collection.name': expect.stringMatching(/^(cache)?$/), @@ -133,14 +133,10 @@ test.describe('Cache Instrumentation', () => { expect(allCacheSpans?.length).toBeGreaterThan(0); // Get all getItem operations - const allGetItemSpans = allCacheSpans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.get_item', - ); + const allGetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.get_item'); // Get all setItem operations - const allSetItemSpans = allCacheSpans?.filter( - span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'cache.set_item', - ); + const allSetItemSpans = allCacheSpans?.filter(span => span.data?.['sentry.op'] === 'cache.set_item'); // We should have both get and set operations expect(allGetItemSpans?.length).toBeGreaterThan(0); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/storage-aliases.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/storage-aliases.test.ts index c6ff331a2780..265b6c750681 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/storage-aliases.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/storage-aliases.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Storage Instrumentation - Aliases', () => { const prefixKey = (key: string) => `test-storage:${key}`; @@ -19,7 +19,7 @@ test.describe('Storage Instrumentation - Aliases', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test set (alias for setItem) @@ -28,7 +28,7 @@ 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.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), 'db.operation.name': 'setItem', @@ -43,7 +43,7 @@ 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_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -59,7 +59,7 @@ 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.has_item', + 'sentry.op': 'cache.has_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:user'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -75,7 +75,7 @@ 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_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp1'), 'db.operation.name': 'removeItem', @@ -87,7 +87,7 @@ 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_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('alias:temp2'), 'db.operation.name': 'removeItem', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/storage.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/storage.test.ts index b0d9af9142da..01e3c9074c33 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/storage.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/storage.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test.describe('Storage Instrumentation', () => { const prefixKey = (key: string) => `test-storage:${key}`; @@ -19,7 +19,7 @@ test.describe('Storage Instrumentation', () => { // Helper to find spans by operation const findSpansByOp = (op: string) => { - return transaction.spans?.filter(span => span.data?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === op) || []; + return transaction.spans?.filter(span => span.data?.['sentry.op'] === op) || []; }; // Test setItem spans @@ -28,7 +28,7 @@ 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.set_item', + 'sentry.op': 'cache.set_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), 'db.operation.name': 'setItem', @@ -45,7 +45,7 @@ test.describe('Storage Instrumentation', () => { ); expect(setItemRawSpan).toBeDefined(); expect(setItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.set_item_raw', + 'sentry.op': 'cache.set_item_raw', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), 'db.operation.name': 'setItemRaw', @@ -59,7 +59,7 @@ 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.has_item', + 'sentry.op': 'cache.has_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -74,7 +74,7 @@ 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_item', + 'sentry.op': 'cache.get_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('user:123'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -92,7 +92,7 @@ test.describe('Storage Instrumentation', () => { ); expect(getItemRawSpan).toBeDefined(); expect(getItemRawSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_item_raw', + 'sentry.op': 'cache.get_item_raw', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('raw:data'), [SEMANTIC_ATTRIBUTE_CACHE_HIT]: true, @@ -105,7 +105,7 @@ test.describe('Storage Instrumentation', () => { const getKeysSpans = findSpansByOp('cache.get_keys'); expect(getKeysSpans.length).toBeGreaterThanOrEqual(1); expect(getKeysSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.get_keys', + 'sentry.op': 'cache.get_keys', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'getKeys', 'db.collection.name': 'test-storage', @@ -120,7 +120,7 @@ test.describe('Storage Instrumentation', () => { ); expect(removeItemSpan).toBeDefined(); expect(removeItemSpan?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.remove_item', + 'sentry.op': 'cache.remove_item', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: prefixKey('batch:1'), 'db.operation.name': 'removeItem', @@ -132,7 +132,7 @@ test.describe('Storage Instrumentation', () => { const clearSpans = findSpansByOp('cache.clear'); expect(clearSpans.length).toBeGreaterThanOrEqual(1); expect(clearSpans[0]?.data).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'cache.clear', + 'sentry.op': 'cache.clear', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', 'db.operation.name': 'clear', 'db.collection.name': 'test-storage', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.server.test.ts index ebd367d96031..160a0fdffba4 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.server.test.ts @@ -1,6 +1,6 @@ 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'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/nuxt'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('nuxt-5', transactionEvent => { @@ -14,7 +14,7 @@ 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', + 'sentry.op': 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.http', }), }), diff --git a/dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/tests/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/tests/performance.server.test.ts index 1722970cba76..eda36e7c5b86 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/tests/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/tests/performance.server.test.ts @@ -1,10 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/solidstart'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart-dynamic-import', transactionEvent => { @@ -20,7 +16,7 @@ test('sends a server action transaction on pageload', async ({ page }) => { expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + 'sentry.op': 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, @@ -45,7 +41,7 @@ test('sends a server action transaction on client navigation', async ({ page }) expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + 'sentry.op': 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, diff --git a/dev-packages/e2e-tests/test-applications/solidstart-spa/tests/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-spa/tests/performance.server.test.ts index 9406c4d977bb..2ca3c5320b4c 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-spa/tests/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-spa/tests/performance.server.test.ts @@ -1,10 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/solidstart'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart-spa', transactionEvent => { @@ -20,7 +16,7 @@ test('sends a server action transaction on pageload', async ({ page }) => { expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + 'sentry.op': 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, @@ -45,7 +41,7 @@ test('sends a server action transaction on client navigation', async ({ page }) expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + 'sentry.op': 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, diff --git a/dev-packages/e2e-tests/test-applications/solidstart-top-level-import/tests/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-top-level-import/tests/performance.server.test.ts index 018e3bdcedc7..3348b1c87198 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-top-level-import/tests/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-top-level-import/tests/performance.server.test.ts @@ -1,10 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/solidstart'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart-top-level-import', transactionEvent => { @@ -20,7 +16,7 @@ test('sends a server action transaction on pageload', async ({ page }) => { expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + 'sentry.op': 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, @@ -45,7 +41,7 @@ test('sends a server action transaction on client navigation', async ({ page }) expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + 'sentry.op': 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, diff --git a/dev-packages/e2e-tests/test-applications/solidstart/tests/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/solidstart/tests/performance.server.test.ts index a86f5b5af68c..83a92afb181c 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart/tests/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart/tests/performance.server.test.ts @@ -1,10 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/solidstart'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart', transactionEvent => { @@ -20,7 +16,7 @@ test('sends a server action transaction on pageload', async ({ page }) => { expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + 'sentry.op': 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, @@ -45,7 +41,7 @@ test('sends a server action transaction on client navigation', async ({ page }) expect.objectContaining({ description: 'getPrefecture', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + 'sentry.op': 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-kit-tracing/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-kit-tracing/tests/tracing.server.test.ts index 9c2668a7c6c8..67dfcd8fcf64 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-kit-tracing/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-kit-tracing/tests/tracing.server.test.ts @@ -1,6 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/sveltekit'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/sveltekit'; test('server pageload request span has nested request span for sub request', async ({ page }) => { const serverTxnEventPromise = waitForTransaction('sveltekit-2-kit-tracing', txnEvent => { @@ -21,7 +21,7 @@ test('server pageload request span has nested request span for sub request', asy op: 'http.server', origin: 'auto.http.sveltekit', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + 'sentry.op': 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', 'http.method': 'GET', 'http.route': '/server-load-fetch', @@ -38,7 +38,7 @@ test('server pageload request span has nested request span for sub request', asy // initial resolve span: expect.objectContaining({ data: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.sveltekit.resolve', + 'sentry.op': 'function.sveltekit.resolve', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', 'http.route': '/server-load-fetch', }), diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-3/tests/tracing.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-3/tests/tracing.server.test.ts index f3ad6d3a7e03..b44ea0e3b4a0 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-3/tests/tracing.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-3/tests/tracing.server.test.ts @@ -1,6 +1,6 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/sveltekit'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/sveltekit'; test('server pageload request span has nested request span for sub request', async ({ page }) => { const serverTxnEventPromise = waitForTransaction('sveltekit-3', txnEvent => { @@ -21,7 +21,7 @@ test('server pageload request span has nested request span for sub request', asy op: 'http.server', origin: 'auto.http.sveltekit', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + 'sentry.op': 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', 'http.method': 'GET', 'http.route': '/server-load-fetch', @@ -38,7 +38,7 @@ test('server pageload request span has nested request span for sub request', asy // initial resolve span: expect.objectContaining({ data: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.sveltekit.resolve', + 'sentry.op': 'function.sveltekit.resolve', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', 'http.route': '/server-load-fetch', }), diff --git a/dev-packages/node-integration-tests/suites/aws-serverless/aws-integration-streamed/test.ts b/dev-packages/node-integration-tests/suites/aws-serverless/aws-integration-streamed/test.ts index a5e4ea13011a..981dc134d380 100644 --- a/dev-packages/node-integration-tests/suites/aws-serverless/aws-integration-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/aws-serverless/aws-integration-streamed/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { SerializedStreamedSpanContainer } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; @@ -55,7 +56,7 @@ function assertAwsServiceSpans(spanCcontainer: SerializedStreamedSpanContainer): status: 'ok', attributes: expect.objectContaining({ 'sentry.origin': { value: ORIGIN, type: 'string' }, - 'sentry.op': { value: 'rpc', type: 'string' }, + [SENTRY_OP]: { value: 'rpc', type: 'string' }, 'rpc.system': { value: 'aws-api', type: 'string' }, 'rpc.method': { value: 'PutObject', type: 'string' }, 'rpc.service': { value: 'S3', type: 'string' }, diff --git a/dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/test.ts b/dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/test.ts index 22d84e5ffb3a..454b208cd9f3 100644 --- a/dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/test.ts +++ b/dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; @@ -50,7 +51,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void { status: 'ok', data: expect.objectContaining({ 'sentry.origin': ORIGIN, - 'sentry.op': 'rpc', + [SENTRY_OP]: 'rpc', 'rpc.system': 'aws-api', 'rpc.method': 'PutObject', 'rpc.service': 'S3', @@ -84,7 +85,7 @@ function assertAwsServiceSpans(transaction: TransactionEvent): void { op: 'db', origin: ORIGIN, data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'rpc.method': 'PutItem', 'rpc.service': 'DynamoDB', 'db.system': 'dynamodb', diff --git a/dev-packages/node-integration-tests/suites/express/tracing/tracesSampler/instrument.mjs b/dev-packages/node-integration-tests/suites/express/tracing/tracesSampler/instrument.mjs index 43f87a639195..bcdd02020b9d 100644 --- a/dev-packages/node-integration-tests/suites/express/tracing/tracesSampler/instrument.mjs +++ b/dev-packages/node-integration-tests/suites/express/tracing/tracesSampler/instrument.mjs @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -11,7 +12,7 @@ Sentry.init({ // so we infer the name from the unparameterized route instead return ( samplingContext.name === 'GET /test/123' && - samplingContext.attributes['sentry.op'] === 'http.server' && + samplingContext.attributes[SENTRY_OP] === 'http.server' && samplingContext.attributes['http.method'] === 'GET' ); }, 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 281832912756..c8a9fcaefefc 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,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/node'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/node'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createCjsTests } from '../../utils/runner'; @@ -26,7 +27,7 @@ describe('fs instrumentation', () => { data: { fs_error: expect.stringMatching('ENOENT: no such file or directory,'), path_argument: expect.stringMatching('/fixtures/some-file-that-doesnt-exist.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -52,7 +53,7 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('/fixtures/some-file.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -62,7 +63,7 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('/fixtures/some-file-promises.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -72,7 +73,7 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('/fixtures/some-file-promisify.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -99,7 +100,7 @@ describe('fs instrumentation', () => { data: { src_argument: expect.stringMatching('/fixtures/some-file.txt'), dest_argument: expect.stringMatching('/fixtures/some-file.txt.copy'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -110,7 +111,7 @@ describe('fs instrumentation', () => { data: { src_argument: expect.stringMatching('/fixtures/some-file-promises.txt'), dest_argument: expect.stringMatching('/fixtures/some-file-promises.txt.copy'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -121,7 +122,7 @@ describe('fs instrumentation', () => { data: { src_argument: expect.stringMatching('/fixtures/some-file-promisify.txt'), dest_argument: expect.stringMatching('/fixtures/some-file-promisify.txt.copy'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -148,7 +149,7 @@ describe('fs instrumentation', () => { data: { existing_path_argument: expect.stringMatching('/fixtures/some-file.txt'), new_path_argument: expect.stringMatching('/fixtures/some-file.txt.link'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -159,7 +160,7 @@ 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', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -170,7 +171,7 @@ describe('fs instrumentation', () => { data: { existing_path_argument: expect.stringMatching('/fixtures/some-file-promisify.txt'), new_path_argument: expect.stringMatching('/fixtures/some-file-promisify.txt.link'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -196,7 +197,7 @@ describe('fs instrumentation', () => { status: 'ok', data: { prefix_argument: expect.stringMatching('/foo-'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -206,7 +207,7 @@ describe('fs instrumentation', () => { status: 'ok', data: { prefix_argument: expect.stringMatching('/foo-'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -216,7 +217,7 @@ describe('fs instrumentation', () => { status: 'ok', data: { prefix_argument: expect.stringMatching('/foo-'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -243,7 +244,7 @@ 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', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -254,7 +255,7 @@ describe('fs instrumentation', () => { data: { target_argument: expect.stringMatching('/fixtures/some-file-promisify.txt'), path_argument: expect.stringMatching('/fixtures/some-file-promisify.txt.symlink'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -265,7 +266,7 @@ describe('fs instrumentation', () => { data: { target_argument: expect.stringMatching('/fixtures/some-file-promisify.txt'), path_argument: expect.stringMatching('/fixtures/some-file-promisify.txt.symlink'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -291,7 +292,7 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('/fixtures/some-file.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -301,7 +302,7 @@ describe('fs instrumentation', () => { status: 'ok', data: { path_argument: expect.stringMatching('/fixtures/some-file-promisify.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -338,7 +339,7 @@ describe('fs instrumentation', () => { // `path_argument` is recorded, but `fs_error` is NOT, since `recordErrorMessagesAsSpanAttributes` is off data: { path_argument: expect.stringMatching('/fixtures/some-file-that-doesnt-exist.txt'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -375,7 +376,7 @@ describe('fs instrumentation', () => { // `fs_error` is recorded, but `path_argument` is NOT, since `recordFilePaths` is off data: { fs_error: expect.stringMatching('ENOENT: no such file or directory,'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs', }, }), @@ -401,7 +402,7 @@ describe('fs instrumentation', () => { status: 'ok', // Neither `path_argument` nor `fs_error` are recorded data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file', + [SENTRY_OP]: 'file', [SEMANTIC_ATTRIBUTE_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 83d8ec942c08..32f35190dcb6 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,7 +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, @@ -14,6 +13,7 @@ import { SENTRY_SDK_NAME, SENTRY_SDK_VERSION, SENTRY_TRACE_LIFECYCLE, + SENTRY_OP, } from '@sentry/conventions/attributes'; import { expect, test } from 'vitest'; import { createRunner } from '../../../../utils/runner'; @@ -58,7 +58,7 @@ test('sends a streamed span envelope with correct spans for a manually started s expect(childSpan).toEqual({ attributes: { [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'test-child', }, @@ -144,7 +144,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' }, - [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: 'sentry.javascript.node' }, [SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, diff --git a/dev-packages/node-integration-tests/suites/tracing/amqplib/test.ts b/dev-packages/node-integration-tests/suites/tracing/amqplib/test.ts index de30dd3f6bd7..d716377f9afe 100644 --- a/dev-packages/node-integration-tests/suites/tracing/amqplib/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/amqplib/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; @@ -42,7 +43,7 @@ const expectedProducerSpan = (routingKey: string) => } : {}), 'otel.kind': 'PRODUCER', - 'sentry.op': 'message', + [SENTRY_OP]: 'message', 'sentry.origin': PUBLISHER_ORIGIN, }), status: 'ok', @@ -67,7 +68,7 @@ const EXPECTED_MESSAGE_SPAN_CONSUMER = expect.objectContaining({ } : {}), 'otel.kind': 'CONSUMER', - 'sentry.op': 'message', + [SENTRY_OP]: 'message', 'sentry.origin': CONSUMER_ORIGIN, }), status: 'ok', @@ -164,7 +165,7 @@ describeWithDockerCompose('amqplib auto-instrumentation', { workingDirectory: [_ data: expect.objectContaining({ 'messaging.system': 'rabbitmq', 'otel.kind': 'CONSUMER', - 'sentry.op': 'message', + [SENTRY_OP]: 'message', 'sentry.origin': CONSUMER_ORIGIN, }), }), diff --git a/dev-packages/node-integration-tests/suites/tracing/anthropic/test.ts b/dev-packages/node-integration-tests/suites/tracing/anthropic/test.ts index 5546aa8abd66..b36133da090e 100644 --- a/dev-packages/node-integration-tests/suites/tracing/anthropic/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/anthropic/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES_ATTRIBUTE, @@ -125,12 +126,12 @@ describe('Anthropic integration', () => { span.attributes[GEN_AI_RESPONSE_ID_ATTRIBUTE] === undefined, ); expect(tokenCountingSpan).toBeDefined(); - expect(tokenCountingSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(tokenCountingSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); const modelsSpan = container.items.find(span => span.name === 'models claude-3-haiku-20240307'); expect(modelsSpan).toBeDefined(); expect(modelsSpan!.status).toBe('ok'); - expect(modelsSpan!.attributes['sentry.op'].value).toBe('gen_ai.models'); + expect(modelsSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.models'); const streamingSpan = container.items.find( span => span.attributes[GEN_AI_RESPONSE_ID_ATTRIBUTE]?.value === 'msg_stream123', @@ -182,7 +183,7 @@ describe('Anthropic integration', () => { expect(completionSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE].value).toBe(10); expect(completionSpan!.attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE].value).toBe(15); expect(completionSpan!.attributes[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE].value).toBe(25); - expect(completionSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(completionSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(completionSpan!.attributes['sentry.origin'].value).toBe( isOrchestrionEnabled() ? 'auto.ai.orchestrion.anthropic' : 'auto.ai.anthropic', ); @@ -203,12 +204,12 @@ describe('Anthropic integration', () => { expect(tokenCountingSpan).toBeDefined(); expect(tokenCountingSpan!.name).toBe('chat claude-3-haiku-20240307'); expect(tokenCountingSpan!.status).toBe('ok'); - expect(tokenCountingSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(tokenCountingSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); const modelsSpan = container.items.find(span => span.name === 'models claude-3-haiku-20240307'); expect(modelsSpan).toBeDefined(); expect(modelsSpan!.status).toBe('ok'); - expect(modelsSpan!.attributes['sentry.op'].value).toBe('gen_ai.models'); + expect(modelsSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.models'); // TODO: messages.stream() should produce its own distinct gen_ai span, but it // currently does not (pre-existing bug). Once fixed, add an additional indexed span assertion. @@ -248,14 +249,14 @@ describe('Anthropic integration', () => { expect(completionSpan).toBeDefined(); expect(completionSpan!.name).toBe('chat claude-3-haiku-20240307'); expect(completionSpan!.status).toBe('ok'); - expect(completionSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(completionSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(completionSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]).toBeDefined(); expect(completionSpan!.attributes[GEN_AI_RESPONSE_TEXT_ATTRIBUTE]).toBeDefined(); const errorSpan = container.items.find(span => span.name === 'chat error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); const tokenCountingSpan = container.items.find( span => span.attributes[GEN_AI_RESPONSE_TEXT_ATTRIBUTE]?.value === '15', @@ -263,14 +264,14 @@ describe('Anthropic integration', () => { expect(tokenCountingSpan).toBeDefined(); expect(tokenCountingSpan!.name).toBe('chat claude-3-haiku-20240307'); expect(tokenCountingSpan!.status).toBe('ok'); - expect(tokenCountingSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(tokenCountingSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(tokenCountingSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); const modelsSpan = container.items.find(span => span.name === 'models claude-3-haiku-20240307'); expect(modelsSpan).toBeDefined(); expect(modelsSpan!.status).toBe('ok'); expect(modelsSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('models'); - expect(modelsSpan!.attributes['sentry.op'].value).toBe('gen_ai.models'); + expect(modelsSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.models'); expect(modelsSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(modelsSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-haiku-20240307'); expect(modelsSpan!.attributes[GEN_AI_RESPONSE_ID_ATTRIBUTE].value).toBe('claude-3-haiku-20240307'); @@ -423,7 +424,7 @@ describe('Anthropic integration', () => { span => span.attributes[GEN_AI_RESPONSE_ID_ATTRIBUTE]?.value === 'msg_nested', ); expect(nestedSpan).toBeDefined(); - expect(nestedSpan.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(nestedSpan.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); // The helper's own internal `create` delegation must be deduped: exactly one span // for the streamed response, not a duplicate child span. @@ -458,7 +459,7 @@ describe('Anthropic integration', () => { // [0] messages.create with tools — available tools + tool calls recorded with PII expect(firstSpan!.name).toBe('chat claude-3-haiku-20240307'); expect(firstSpan!.status).toBe('ok'); - expect(firstSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(firstSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(firstSpan!.attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE].value).toBe(EXPECTED_TOOLS_JSON); expect(firstSpan!.attributes[GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE].value).toBe(EXPECTED_TOOL_CALLS_JSON); }, @@ -486,7 +487,7 @@ describe('Anthropic integration', () => { for (const span of container.items) { expect(span.name).toBe('chat claude-3-haiku-20240307'); expect(span.status).toBe('ok'); - expect(span.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(span.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(span.attributes[GEN_AI_RESPONSE_STREAMING_ATTRIBUTE].value).toBe(true); expect(span.attributes[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE].value).toBe('["tool_use"]'); expect(span.attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE].value).toBe(EXPECTED_TOOLS_JSON); @@ -583,13 +584,13 @@ describe('Anthropic integration', () => { expect(invalidFormatSpan).toBeDefined(); expect(invalidFormatSpan!.status).toBe('error'); expect(invalidFormatSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('invalid-format'); - expect(invalidFormatSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(invalidFormatSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); const modelErrorSpan = container.items.find(span => span.name === 'models nonexistent-model'); expect(modelErrorSpan).toBeDefined(); expect(modelErrorSpan!.status).toBe('error'); expect(modelErrorSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('nonexistent-model'); - expect(modelErrorSpan!.attributes['sentry.op'].value).toBe('gen_ai.models'); + expect(modelErrorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.models'); const toolSuccessSpan = container.items.find(span => span.name === 'chat claude-3-haiku-20240307'); expect(toolSuccessSpan).toBeDefined(); @@ -630,7 +631,7 @@ describe('Anthropic integration', () => { expect(truncatedSpan!.name).toBe('chat claude-3-haiku-20240307'); expect(truncatedSpan!.status).toBe('ok'); expect(truncatedSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); - expect(truncatedSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(truncatedSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(truncatedSpan!.attributes['sentry.origin'].value).toBe('auto.ai.anthropic'); expect(truncatedSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(truncatedSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-haiku-20240307'); @@ -643,7 +644,7 @@ describe('Anthropic integration', () => { expect(smallMessageSpan!.name).toBe('chat claude-3-haiku-20240307'); expect(smallMessageSpan!.status).toBe('ok'); expect(smallMessageSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); - expect(smallMessageSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(smallMessageSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(smallMessageSpan!.attributes['sentry.origin'].value).toBe('auto.ai.anthropic'); expect(smallMessageSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(smallMessageSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe( @@ -696,7 +697,7 @@ describe('Anthropic integration', () => { expect(firstSpan!.status).toBe('ok'); expect(firstSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe(expectedMediaMessages); expect(firstSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); - expect(firstSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(firstSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(firstSpan!.attributes['sentry.origin'].value).toBe('auto.ai.anthropic'); expect(firstSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(firstSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-haiku-20240307'); diff --git a/dev-packages/node-integration-tests/suites/tracing/dataloader/test.ts b/dev-packages/node-integration-tests/suites/tracing/dataloader/test.ts index dfad54dc5516..257c75d737d6 100644 --- a/dev-packages/node-integration-tests/suites/tracing/dataloader/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/dataloader/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -28,7 +29,7 @@ describe('dataloader auto-instrumentation', () => { expect(loadSpan?.origin).toBe(ORIGIN); expect(loadSpan?.status).toBe('ok'); expect(loadSpan?.data?.['sentry.origin']).toBe(ORIGIN); - expect(loadSpan?.data?.['sentry.op']).toBe(CACHE_GET_OP); + expect(loadSpan?.data?.[SENTRY_OP]).toBe(CACHE_GET_OP); expect(loadSpan?.data?.['cache.key']).toEqual(['user-1']); // A direct operation is a client call; the deferred `batch` below gets no kind expect(loadSpan?.data?.['otel.kind']).toBe('CLIENT'); @@ -65,7 +66,7 @@ describe('dataloader auto-instrumentation', () => { expect(loadManySpan?.origin).toBe(ORIGIN); expect(loadManySpan?.status).toBe('ok'); expect(loadManySpan?.data?.['sentry.origin']).toBe(ORIGIN); - expect(loadManySpan?.data?.['sentry.op']).toBe(CACHE_GET_OP); + expect(loadManySpan?.data?.[SENTRY_OP]).toBe(CACHE_GET_OP); expect(loadManySpan?.data?.['cache.key']).toEqual(['user-1', 'user-2']); }, }) @@ -83,7 +84,7 @@ describe('dataloader auto-instrumentation', () => { expect(span?.status).toBe('ok'); expect(span?.op).toBeUndefined(); expect(span?.data?.['sentry.origin']).toBe(ORIGIN); - expect(span?.data?.['sentry.op']).toBeUndefined(); + expect(span?.data?.[SENTRY_OP]).toBeUndefined(); } }, }) 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 83ca2d6bab3e..6ea983fae1d5 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,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -16,7 +17,7 @@ Sentry.startSpan( attributes: { 'http.method': 'GET', 'http.route': '/route', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_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 6ed42d22f757..7acc2c6c6b2d 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,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -16,7 +17,7 @@ Sentry.startSpan( attributes: { 'http.method': 'GET', 'http.route': '/route', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', }, }, diff --git a/dev-packages/node-integration-tests/suites/tracing/fastify/test.ts b/dev-packages/node-integration-tests/suites/tracing/fastify/test.ts index d2e1157e8294..4b94e7acd903 100644 --- a/dev-packages/node-integration-tests/suites/tracing/fastify/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/fastify/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -21,7 +22,7 @@ describe('fastify auto-instrumentation', () => { origin: 'auto.http.otel.fastify', data: expect.objectContaining({ 'fastify.type': 'hook', - 'sentry.op': 'hook.fastify', + [SENTRY_OP]: 'hook.fastify', 'sentry.origin': 'auto.http.otel.fastify', }), }), @@ -29,7 +30,7 @@ describe('fastify auto-instrumentation', () => { op: 'request_handler.fastify', origin: 'auto.http.otel.fastify', data: expect.objectContaining({ - 'sentry.op': 'request_handler.fastify', + [SENTRY_OP]: 'request_handler.fastify', 'sentry.origin': 'auto.http.otel.fastify', }), }), diff --git a/dev-packages/node-integration-tests/suites/tracing/google-genai/test.ts b/dev-packages/node-integration-tests/suites/tracing/google-genai/test.ts index 3332ff1d862c..a6ed76bf85ad 100644 --- a/dev-packages/node-integration-tests/suites/tracing/google-genai/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/google-genai/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_EMBEDDINGS_INPUT_ATTRIBUTE, @@ -48,7 +49,7 @@ describe('Google GenAI integration', () => { const chatSpan = container.items.find(span => span.name === 'chat gemini-1.5-pro'); expect(chatSpan).toBeDefined(); expect(chatSpan!.status).toBe('ok'); - expect(chatSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(chatSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(chatSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); expect(chatSpan!.attributes['sentry.origin'].value).toBe(EXPECTED_ORIGIN); expect(chatSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('google_genai'); @@ -60,7 +61,7 @@ describe('Google GenAI integration', () => { const generateContentSpan = container.items.find(span => span.name === 'generate_content gemini-1.5-flash'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(generateContentSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('generate_content'); expect(generateContentSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('google_genai'); expect(generateContentSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('gemini-1.5-flash'); @@ -74,7 +75,7 @@ describe('Google GenAI integration', () => { const errorSpan = container.items.find(span => span.name === 'generate_content error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(errorSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('generate_content'); expect(errorSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('google_genai'); expect(errorSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('error-model'); @@ -102,7 +103,7 @@ describe('Google GenAI integration', () => { const chatSpan = container.items.find(span => span.name === 'chat gemini-1.5-pro'); expect(chatSpan).toBeDefined(); expect(chatSpan!.status).toBe('ok'); - expect(chatSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(chatSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(chatSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); expect(chatSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('google_genai'); expect(chatSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('gemini-1.5-pro'); @@ -115,7 +116,7 @@ describe('Google GenAI integration', () => { const generateContentSpan = container.items.find(span => span.name === 'generate_content gemini-1.5-flash'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(generateContentSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('generate_content'); expect(generateContentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]).toBeDefined(); expect(generateContentSpan!.attributes[GEN_AI_RESPONSE_TEXT_ATTRIBUTE]).toBeDefined(); @@ -126,7 +127,7 @@ describe('Google GenAI integration', () => { const errorSpan = container.items.find(span => span.name === 'generate_content error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(errorSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('generate_content'); expect(errorSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]).toBeDefined(); }, @@ -277,13 +278,13 @@ describe('Google GenAI integration', () => { const blockedSpan = container.items.find(span => span.name === 'generate_content blocked-model'); expect(blockedSpan).toBeDefined(); expect(blockedSpan!.status).toBe('error'); - expect(blockedSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(blockedSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(blockedSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('generate_content'); const errorSpan = container.items.find(span => span.name === 'generate_content error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(errorSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('generate_content'); }, }) @@ -440,7 +441,7 @@ describe('Google GenAI integration', () => { ); expect(successfulSpans).toHaveLength(2); for (const span of successfulSpans) { - expect(span.attributes['sentry.op'].value).toBe('gen_ai.embeddings'); + expect(span.attributes[SENTRY_OP].value).toBe('gen_ai.embeddings'); expect(span.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('embeddings'); expect(span.attributes['sentry.origin'].value).toBe(EXPECTED_ORIGIN); expect(span.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('google_genai'); @@ -451,7 +452,7 @@ describe('Google GenAI integration', () => { const errorSpan = container.items.find(span => span.name === 'embeddings error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe('gen_ai.embeddings'); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.embeddings'); expect(errorSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('embeddings'); }, }) diff --git a/dev-packages/node-integration-tests/suites/tracing/hapi/test.ts b/dev-packages/node-integration-tests/suites/tracing/hapi/test.ts index 989257032531..9a6f76c5449b 100644 --- a/dev-packages/node-integration-tests/suites/tracing/hapi/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/hapi/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -22,7 +23,7 @@ describe('hapi auto-instrumentation', () => { 'http.method': 'GET', 'hapi.type': 'router', 'sentry.origin': origin, - 'sentry.op': 'router.hapi', + [SENTRY_OP]: 'router.hapi', }), description: 'GET /', op: 'router.hapi', @@ -64,7 +65,7 @@ describe('hapi auto-instrumentation', () => { 'http.route': '/plugin-route', 'hapi.type': 'plugin', 'hapi.plugin.name': 'testPlugin', - 'sentry.op': 'plugin.hapi', + [SENTRY_OP]: 'plugin.hapi', 'sentry.origin': origin, }), }), @@ -75,7 +76,7 @@ describe('hapi auto-instrumentation', () => { data: expect.objectContaining({ 'hapi.type': 'server.ext', 'server.ext.type': 'onPreResponse', - 'sentry.op': 'server.ext.hapi', + [SENTRY_OP]: 'server.ext.hapi', 'sentry.origin': origin, }), }), diff --git a/dev-packages/node-integration-tests/suites/tracing/http-client-span-streamed/test.ts b/dev-packages/node-integration-tests/suites/tracing/http-client-span-streamed/test.ts index eee1e85933f6..b42b5c7d9d31 100644 --- a/dev-packages/node-integration-tests/suites/tracing/http-client-span-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/http-client-span-streamed/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -12,8 +13,8 @@ describe('http.client span with streaming enabled', () => { .expect({ span: span => { const httpClientSpan = span.items.find(item => - item.attributes['sentry.op'] - ? item.attributes['sentry.op'].type === 'string' && item.attributes['sentry.op'].value === 'http.client' + item.attributes[SENTRY_OP] + ? item.attributes[SENTRY_OP].type === 'string' && item.attributes[SENTRY_OP].value === 'http.client' : false, ); diff --git a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-basic-streamed/test.ts b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-basic-streamed/test.ts index 1e92515d8e30..120602edf5a5 100644 --- a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-basic-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-basic-streamed/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { createTestServer } from '@sentry-internal/test-utils'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createCjsTests } from '../../../../utils/runner'; @@ -23,7 +24,7 @@ describe('streamed outgoing fetch spans', () => { span: container => { const httpClientSpan = container.items.find( item => - item.attributes['sentry.op']?.type === 'string' && item.attributes['sentry.op'].value === 'http.client', + item.attributes[SENTRY_OP]?.type === 'string' && item.attributes[SENTRY_OP].value === 'http.client', ); expect(httpClientSpan).toBeDefined(); diff --git a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-strip-query/test.ts b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-strip-query/test.ts index 0ab411783aa2..2e087e41096d 100644 --- a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-strip-query/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-strip-query/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { createTestServer } from '@sentry-internal/test-utils'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createCjsTests } from '../../../../utils/runner'; @@ -40,7 +41,7 @@ describe('outgoing fetch spans - strip query', () => { 'otel.kind': 'CLIENT', 'server.port': expect.any(Number), 'user_agent.original': 'node', - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.otel.node_fetch', 'server.address': 'localhost', }, diff --git a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/http-strip-query/test.ts b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/http-strip-query/test.ts index 6153a01c7e7f..7dc4136ead91 100644 --- a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/http-strip-query/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/http-strip-query/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { createTestServer } from '@sentry-internal/test-utils'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createCjsTests } from '../../../../utils/runner'; @@ -42,7 +43,7 @@ describe('outgoing http spans - strip query', () => { 'net.peer.port': expect.any(Number), 'net.transport': 'ip_tcp', 'otel.kind': 'CLIENT', - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'sentry.origin': 'auto.http.client', }, description: `GET ${SERVER_URL}/api/v0/users`, diff --git a/dev-packages/node-integration-tests/suites/tracing/httpIntegration-streamed/test.ts b/dev-packages/node-integration-tests/suites/tracing/httpIntegration-streamed/test.ts index 6e692993c9d0..b48473f130ad 100644 --- a/dev-packages/node-integration-tests/suites/tracing/httpIntegration-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/httpIntegration-streamed/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -13,7 +14,7 @@ describe('httpIntegration-streamed', () => { span: container => { const serverSpan = container.items.find( item => - item.attributes['sentry.op']?.type === 'string' && item.attributes['sentry.op'].value === 'http.server', + item.attributes[SENTRY_OP]?.type === 'string' && item.attributes[SENTRY_OP].value === 'http.server', ); expect(serverSpan).toBeDefined(); diff --git a/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts b/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts index 69740b8bdaf4..d089235eeb1c 100644 --- a/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts @@ -1,5 +1,5 @@ import { createTestServer } from '@sentry-internal/test-utils'; -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect, test } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests, createRunner } from '../../../utils/runner'; @@ -126,7 +126,7 @@ describe('httpIntegration', () => { 'net.peer.port': expect.any(Number), 'net.transport': 'ip_tcp', 'otel.kind': 'SERVER', - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', 'sentry.origin': 'auto.http.otel.http', 'sentry.sample_rate': 1, 'sentry.source': 'route', @@ -170,7 +170,7 @@ describe('httpIntegration', () => { 'net.peer.port': expect.any(Number), 'net.transport': 'ip_tcp', 'otel.kind': 'SERVER', - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', 'sentry.origin': 'auto.http.otel.http', 'sentry.sample_rate': 1, 'sentry.source': 'route', @@ -207,7 +207,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -223,7 +223,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -239,7 +239,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -265,7 +265,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -281,7 +281,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -297,7 +297,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -322,7 +322,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -338,7 +338,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -354,7 +354,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -380,7 +380,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -396,7 +396,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, @@ -412,7 +412,7 @@ describe('httpIntegration', () => { trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', }, }, }, diff --git a/dev-packages/node-integration-tests/suites/tracing/ignoreSpans-streamed/children/server.mjs b/dev-packages/node-integration-tests/suites/tracing/ignoreSpans-streamed/children/server.mjs index e8af8b8c92c6..ac2cab2aba78 100644 --- a/dev-packages/node-integration-tests/suites/tracing/ignoreSpans-streamed/children/server.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/ignoreSpans-streamed/children/server.mjs @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import express from 'express'; import cors from 'cors'; import * as Sentry from '@sentry/node'; @@ -34,7 +35,7 @@ app.get('/test/express', (_req, res) => { Sentry.startSpan({ name: 'name-passes-but-op-not-span-1', op: 'ignored-op' }, () => {}); Sentry.startSpan( // sentry.op attribute has precedence over top op argument - { name: 'name-passes-but-op-not-span-2', op: 'keep', attributes: { 'sentry.op': 'ignored-op' } }, + { name: 'name-passes-but-op-not-span-2', op: 'keep', attributes: { [SENTRY_OP]: 'ignored-op' } }, () => {}, ); res.send({ response: 'response 1' }); 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 60ef7a9f1d95..7a73ef978368 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.express'); const corsMiddlewareSpan = getSpan('corsMiddleware', 'middleware.express'); const requestHandlerSpan = getSpan('/test/express', 'request_handler.express'); diff --git a/dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts b/dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts index 61fe42a02738..0e55da00c5e8 100644 --- a/dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -16,7 +17,7 @@ describeWithDockerCompose( op: 'db.redis', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + [SENTRY_OP]: 'db.redis', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'set dc-test-key ?', @@ -48,7 +49,7 @@ describeWithDockerCompose( op: 'db.redis', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + [SENTRY_OP]: 'db.redis', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'get dc-test-key', @@ -81,7 +82,7 @@ describeWithDockerCompose( op: 'db.redis', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + [SENTRY_OP]: 'db.redis', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'mget ? ? ?', diff --git a/dev-packages/node-integration-tests/suites/tracing/kafkajs/test.ts b/dev-packages/node-integration-tests/suites/tracing/kafkajs/test.ts index 799c73560c17..b6c6f96e4885 100644 --- a/dev-packages/node-integration-tests/suites/tracing/kafkajs/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/kafkajs/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { afterAll, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; @@ -59,7 +60,7 @@ describeWithDockerCompose('kafkajs', { workingDirectory: [__dirname] }, () => { 'messaging.system': 'kafka', 'messaging.destination.name': 'test-topic', 'otel.kind': 'PRODUCER', - 'sentry.op': 'message', + [SENTRY_OP]: 'message', 'sentry.origin': producerOrigin, }), }), @@ -73,7 +74,7 @@ describeWithDockerCompose('kafkajs', { workingDirectory: [__dirname] }, () => { 'messaging.system': 'kafka', 'messaging.destination.name': 'test-topic', 'otel.kind': 'CONSUMER', - 'sentry.op': 'message', + [SENTRY_OP]: 'message', 'sentry.origin': consumerOrigin, }), }), @@ -99,7 +100,7 @@ describeWithDockerCompose('kafkajs', { workingDirectory: [__dirname] }, () => { 'messaging.system': 'kafka', 'messaging.destination.name': 'invalid topic name', 'otel.kind': 'PRODUCER', - 'sentry.op': 'message', + [SENTRY_OP]: 'message', 'sentry.origin': producerOrigin, 'error.type': 'KafkaJSNonRetriableError', }), diff --git a/dev-packages/node-integration-tests/suites/tracing/knex/mysql2/test.ts b/dev-packages/node-integration-tests/suites/tracing/knex/mysql2/test.ts index f4d4b5d430cb..12195b6d09d7 100644 --- a/dev-packages/node-integration-tests/suites/tracing/knex/mysql2/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/knex/mysql2/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../../utils'; import { createEsmAndCjsTests, describeWithDockerCompose } from '../../../../utils/runner'; @@ -20,7 +21,7 @@ describeWithDockerCompose('knex auto instrumentation', { workingDirectory: [__di 'db.name': 'tests', 'db.user': 'root', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'net.peer.name': 'localhost', 'net.peer.port': 3307, }), @@ -36,7 +37,7 @@ describeWithDockerCompose('knex auto instrumentation', { workingDirectory: [__di 'db.name': 'tests', 'db.user': 'root', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'net.peer.name': 'localhost', 'net.peer.port': 3307, }), @@ -55,7 +56,7 @@ describeWithDockerCompose('knex auto instrumentation', { workingDirectory: [__di 'db.statement': 'select * from `User`', 'db.user': 'root', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), status: 'ok', description: 'select * from `User`', diff --git a/dev-packages/node-integration-tests/suites/tracing/knex/pg/test.ts b/dev-packages/node-integration-tests/suites/tracing/knex/pg/test.ts index bc63c52637ec..5a6422b18c00 100644 --- a/dev-packages/node-integration-tests/suites/tracing/knex/pg/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/knex/pg/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../../utils'; import { createEsmAndCjsTests, describeWithDockerCompose } from '../../../../utils/runner'; @@ -19,7 +20,7 @@ describe('knex auto instrumentation', () => { 'db.system': 'postgresql', 'db.name': 'tests', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'net.peer.name': 'localhost', 'net.peer.port': 5445, }), @@ -34,7 +35,7 @@ describe('knex auto instrumentation', () => { 'db.system': 'postgresql', 'db.name': 'tests', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'net.peer.name': 'localhost', 'net.peer.port': 5445, }), @@ -53,7 +54,7 @@ describe('knex auto instrumentation', () => { 'db.name': 'tests', 'db.statement': 'select * from "User"', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), status: 'ok', description: 'select * from "User"', @@ -69,7 +70,7 @@ describe('knex auto instrumentation', () => { 'db.name': 'tests', 'db.statement': 'select * from "DoesNotExist"', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), status: 'internal_error', description: 'select * from "DoesNotExist"', diff --git a/dev-packages/node-integration-tests/suites/tracing/koa/test.ts b/dev-packages/node-integration-tests/suites/tracing/koa/test.ts index e3754e233565..4b58273d3186 100644 --- a/dev-packages/node-integration-tests/suites/tracing/koa/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/koa/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -40,7 +41,7 @@ describe('koa auto-instrumentation', () => { 'http.route': '/', 'koa.type': 'router', 'koa.name': '/', - 'sentry.op': 'router.koa', + [SENTRY_OP]: 'router.koa', 'sentry.origin': origin, }), }), @@ -53,7 +54,7 @@ describe('koa auto-instrumentation', () => { 'koa.type': 'middleware', 'koa.name': 'simpleMiddleware', 'code.function.name': 'simpleMiddleware', - 'sentry.op': 'middleware.koa', + [SENTRY_OP]: 'middleware.koa', 'sentry.origin': origin, }), }), @@ -79,7 +80,7 @@ describe('koa auto-instrumentation', () => { 'http.route': '/test-param/:id', 'koa.type': 'router', 'koa.name': '/test-param/:id', - 'sentry.op': 'router.koa', + [SENTRY_OP]: 'router.koa', 'sentry.origin': origin, }), }), diff --git a/dev-packages/node-integration-tests/suites/tracing/langchain/test.ts b/dev-packages/node-integration-tests/suites/tracing/langchain/test.ts index ed342ce9d1a2..aceb617cbeb8 100644 --- a/dev-packages/node-integration-tests/suites/tracing/langchain/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/langchain/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_EMBEDDINGS_INPUT_ATTRIBUTE, @@ -47,7 +48,7 @@ describe('LangChain integration', () => { const sonnetSpan = container.items.find(span => span.name === 'chat claude-3-5-sonnet-20241022'); expect(sonnetSpan).toBeDefined(); expect(sonnetSpan!.status).toBe('ok'); - expect(sonnetSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(sonnetSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(sonnetSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(sonnetSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); expect(sonnetSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); @@ -64,7 +65,7 @@ describe('LangChain integration', () => { const opusSpan = container.items.find(span => span.name === 'chat claude-3-opus-20240229'); expect(opusSpan).toBeDefined(); expect(opusSpan!.status).toBe('ok'); - expect(opusSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(opusSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(opusSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(opusSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(opusSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-opus-20240229'); @@ -78,7 +79,7 @@ describe('LangChain integration', () => { const errorSpan = container.items.find(span => span.name === 'chat error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(errorSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(errorSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(errorSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('error-model'); @@ -99,7 +100,7 @@ describe('LangChain integration', () => { // both patch the same prototype, producing 6 spans instead of 3. expect(container.items).toHaveLength(3); for (const span of container.items) { - expect(span.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(span.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); } }, }) @@ -125,7 +126,7 @@ describe('LangChain integration', () => { const sonnetSpan = container.items.find(span => span.name === 'chat claude-3-5-sonnet-20241022'); expect(sonnetSpan).toBeDefined(); expect(sonnetSpan!.status).toBe('ok'); - expect(sonnetSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(sonnetSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(sonnetSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(sonnetSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(sonnetSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-5-sonnet-20241022'); @@ -180,7 +181,7 @@ describe('LangChain integration', () => { // [0] chat with tool_use stop reason expect(firstSpan!.name).toBe('chat claude-3-5-sonnet-20241022'); expect(firstSpan!.status).toBe('ok'); - expect(firstSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(firstSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(firstSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(firstSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(firstSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-5-sonnet-20241022'); @@ -296,7 +297,7 @@ describe('LangChain integration', () => { // [0] chat with extracted system instructions expect(firstSpan!.name).toBe('chat claude-3-5-sonnet-20241022'); - expect(firstSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(firstSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(firstSpan!.attributes[GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE].value).toBe( JSON.stringify([{ type: 'text', content: 'You are a helpful assistant' }]), ); @@ -325,24 +326,24 @@ describe('LangChain integration', () => { const formatPromptSpan = container.items.find(span => span.name === 'chain format_prompt'); expect(formatPromptSpan).toBeDefined(); - expect(formatPromptSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(formatPromptSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(formatPromptSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(formatPromptSpan!.attributes['langchain.chain.name'].value).toBe('format_prompt'); const chatSpan = container.items.find(span => span.name === 'chat claude-3-5-sonnet-20241022'); expect(chatSpan).toBeDefined(); - expect(chatSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(chatSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(chatSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); const parseOutputSpan = container.items.find(span => span.name === 'chain parse_output'); expect(parseOutputSpan).toBeDefined(); - expect(parseOutputSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(parseOutputSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(parseOutputSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(parseOutputSpan!.attributes['langchain.chain.name'].value).toBe('parse_output'); const unknownChainSpan = container.items.find(span => span.name === 'chain unknown_chain'); expect(unknownChainSpan).toBeDefined(); - expect(unknownChainSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(unknownChainSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); }, }) .start() @@ -373,7 +374,7 @@ describe('LangChain integration', () => { ); expect(successfulSpans).toHaveLength(2); for (const span of successfulSpans) { - expect(span.attributes['sentry.op'].value).toBe(GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE); + expect(span.attributes[SENTRY_OP].value).toBe(GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE); expect(span.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(span.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('embeddings'); expect(span.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('openai'); @@ -384,7 +385,7 @@ describe('LangChain integration', () => { const errorSpan = container.items.find(span => span.name === 'embeddings error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe(GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe(GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE); expect(errorSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('openai'); }, }) @@ -401,7 +402,7 @@ describe('LangChain integration', () => { // The scenario makes 3 embedding calls (2 successful + 1 error). expect(container.items).toHaveLength(3); for (const span of container.items) { - expect(span.attributes['sentry.op'].value).toBe(GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE); + expect(span.attributes[SENTRY_OP].value).toBe(GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE); } }, }) diff --git a/dev-packages/node-integration-tests/suites/tracing/langchain/v1/test.ts b/dev-packages/node-integration-tests/suites/tracing/langchain/v1/test.ts index b555e48229e4..adfaa6f2b446 100644 --- a/dev-packages/node-integration-tests/suites/tracing/langchain/v1/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/langchain/v1/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES_ATTRIBUTE, @@ -50,7 +51,7 @@ conditionalTest({ min: 20 })('LangChain integration (v1)', () => { const sonnetSpan = container.items.find(span => span.name === 'chat claude-3-5-sonnet-20241022'); expect(sonnetSpan).toBeDefined(); expect(sonnetSpan!.status).toBe('ok'); - expect(sonnetSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(sonnetSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(sonnetSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(sonnetSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); expect(sonnetSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); @@ -67,7 +68,7 @@ conditionalTest({ min: 20 })('LangChain integration (v1)', () => { const opusSpan = container.items.find(span => span.name === 'chat claude-3-opus-20240229'); expect(opusSpan).toBeDefined(); expect(opusSpan!.status).toBe('ok'); - expect(opusSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(opusSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(opusSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(opusSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(opusSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-opus-20240229'); @@ -81,7 +82,7 @@ conditionalTest({ min: 20 })('LangChain integration (v1)', () => { const errorSpan = container.items.find(span => span.name === 'chat error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(errorSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(errorSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(errorSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('error-model'); @@ -121,7 +122,7 @@ conditionalTest({ min: 20 })('LangChain integration (v1)', () => { const sonnetSpan = container.items.find(span => span.name === 'chat claude-3-5-sonnet-20241022'); expect(sonnetSpan).toBeDefined(); expect(sonnetSpan!.status).toBe('ok'); - expect(sonnetSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(sonnetSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(sonnetSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(sonnetSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(sonnetSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-5-sonnet-20241022'); @@ -188,7 +189,7 @@ conditionalTest({ min: 20 })('LangChain integration (v1)', () => { // [0] chat with tool_use stop reason expect(firstSpan!.name).toBe('chat claude-3-5-sonnet-20241022'); expect(firstSpan!.status).toBe('ok'); - expect(firstSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(firstSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(firstSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(firstSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('anthropic'); expect(firstSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('claude-3-5-sonnet-20241022'); @@ -338,7 +339,7 @@ conditionalTest({ min: 20 })('LangChain integration (v1)', () => { const gpt4oSpan = container.items.find(span => span.name === 'chat gpt-4o'); expect(gpt4oSpan).toBeDefined(); expect(gpt4oSpan!.status).toBe('ok'); - expect(gpt4oSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(gpt4oSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(gpt4oSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(gpt4oSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('chat'); expect(gpt4oSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('openai'); @@ -355,7 +356,7 @@ conditionalTest({ min: 20 })('LangChain integration (v1)', () => { const gpt35Span = container.items.find(span => span.name === 'chat gpt-3.5-turbo'); expect(gpt35Span).toBeDefined(); expect(gpt35Span!.status).toBe('ok'); - expect(gpt35Span!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(gpt35Span!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(gpt35Span!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(gpt35Span!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('openai'); expect(gpt35Span!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('gpt-3.5-turbo'); @@ -369,7 +370,7 @@ conditionalTest({ min: 20 })('LangChain integration (v1)', () => { const errorSpan = container.items.find(span => span.name === 'chat error-model'); expect(errorSpan).toBeDefined(); expect(errorSpan!.status).toBe('error'); - expect(errorSpan!.attributes['sentry.op'].value).toBe('gen_ai.chat'); + expect(errorSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.chat'); expect(errorSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langchain'); expect(errorSpan!.attributes[GEN_AI_SYSTEM_ATTRIBUTE].value).toBe('openai'); expect(errorSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('error-model'); 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 817aef2923ca..4f02e56eb5ee 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,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_AGENT_NAME_ATTRIBUTE, @@ -42,7 +43,7 @@ describe('LangGraph integration', () => { const createAgentSpan = container.items.find(span => span.name === 'create_agent weather_assistant'); expect(createAgentSpan).toBeDefined(); expect(createAgentSpan!.status).toBe('ok'); - expect(createAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.create_agent'); + expect(createAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.create_agent'); expect(createAgentSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langgraph'); expect(createAgentSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('create_agent'); expect(createAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE].value).toBe('weather_assistant'); @@ -51,7 +52,7 @@ describe('LangGraph integration', () => { expect(invokeAgentSpans).toHaveLength(2); for (const span of invokeAgentSpans) { expect(span.status).toBe('ok'); - expect(span.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(span.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(span.attributes['sentry.origin'].value).toBe('auto.ai.langgraph'); expect(span.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('invoke_agent'); expect(span.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE].value).toBe('weather_assistant'); @@ -75,7 +76,7 @@ describe('LangGraph integration', () => { const createAgentSpan = container.items.find(span => span.name === 'create_agent weather_assistant'); expect(createAgentSpan).toBeDefined(); expect(createAgentSpan!.status).toBe('ok'); - expect(createAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.create_agent'); + expect(createAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.create_agent'); const weatherTodaySpan = container.items.find(span => getStringAttributeValue(span.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]?.value)?.includes( @@ -85,7 +86,7 @@ describe('LangGraph integration', () => { expect(weatherTodaySpan).toBeDefined(); expect(weatherTodaySpan!.name).toBe('invoke_agent weather_assistant'); expect(weatherTodaySpan!.status).toBe('ok'); - expect(weatherTodaySpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(weatherTodaySpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(weatherTodaySpan!.attributes['sentry.origin'].value).toBe('auto.ai.langgraph'); const weatherDetailsSpan = container.items.find(span => @@ -96,7 +97,7 @@ describe('LangGraph integration', () => { expect(weatherDetailsSpan).toBeDefined(); expect(weatherDetailsSpan!.name).toBe('invoke_agent weather_assistant'); expect(weatherDetailsSpan!.status).toBe('ok'); - expect(weatherDetailsSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(weatherDetailsSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); }, }) .start() @@ -122,13 +123,13 @@ describe('LangGraph integration', () => { const toolAgentSpan = container.items.find(span => span.name === 'create_agent tool_agent'); expect(toolAgentSpan).toBeDefined(); expect(toolAgentSpan!.status).toBe('ok'); - expect(toolAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.create_agent'); + expect(toolAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.create_agent'); expect(toolAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE].value).toBe('tool_agent'); const toolAgentInvokeSpan = container.items.find(span => span.name === 'invoke_agent tool_agent'); expect(toolAgentInvokeSpan).toBeDefined(); expect(toolAgentInvokeSpan!.status).toBe('ok'); - expect(toolAgentInvokeSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(toolAgentInvokeSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(toolAgentInvokeSpan!.attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE].value).toContain( 'get_weather', ); @@ -146,13 +147,13 @@ describe('LangGraph integration', () => { const toolCallingAgentSpan = container.items.find(span => span.name === 'create_agent tool_calling_agent'); expect(toolCallingAgentSpan).toBeDefined(); expect(toolCallingAgentSpan!.status).toBe('ok'); - expect(toolCallingAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.create_agent'); + expect(toolCallingAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.create_agent'); expect(toolCallingAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE].value).toBe('tool_calling_agent'); const toolCallingInvokeSpan = container.items.find(span => span.name === 'invoke_agent tool_calling_agent'); expect(toolCallingInvokeSpan).toBeDefined(); expect(toolCallingInvokeSpan!.status).toBe('ok'); - expect(toolCallingInvokeSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(toolCallingInvokeSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(toolCallingInvokeSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toContain('San Francisco'); expect(toolCallingInvokeSpan!.attributes[GEN_AI_RESPONSE_MODEL_ATTRIBUTE].value).toBe('gpt-4-0613'); expect(toolCallingInvokeSpan!.attributes[GEN_AI_RESPONSE_TEXT_ATTRIBUTE].value).toMatch(/"role":"tool"/); @@ -181,7 +182,7 @@ describe('LangGraph integration', () => { const createAgentSpan = container.items.find(span => span.name === 'create_agent thread_test_agent'); expect(createAgentSpan).toBeDefined(); expect(createAgentSpan!.status).toBe('ok'); - expect(createAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.create_agent'); + expect(createAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.create_agent'); const firstThreadSpan = container.items.find( span => span.attributes[GEN_AI_CONVERSATION_ID_ATTRIBUTE]?.value === 'thread_abc123_session_1', @@ -189,7 +190,7 @@ describe('LangGraph integration', () => { expect(firstThreadSpan).toBeDefined(); expect(firstThreadSpan!.name).toBe('invoke_agent thread_test_agent'); expect(firstThreadSpan!.status).toBe('ok'); - expect(firstThreadSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(firstThreadSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); const secondThreadSpan = container.items.find( span => span.attributes[GEN_AI_CONVERSATION_ID_ATTRIBUTE]?.value === 'thread_xyz789_session_2', @@ -259,7 +260,7 @@ describe('LangGraph integration', () => { const createAgentSpan = container.items.find(span => span.name === 'create_agent resume_agent'); expect(createAgentSpan).toBeDefined(); expect(createAgentSpan!.status).toBe('ok'); - expect(createAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.create_agent'); + expect(createAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.create_agent'); expect(createAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE].value).toBe('resume_agent'); const invokeAgentSpan = container.items.find( @@ -268,7 +269,7 @@ describe('LangGraph integration', () => { expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.name).toBe('invoke_agent resume_agent'); expect(invokeAgentSpan!.status).toBe('ok'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes['sentry.origin'].value).toBe('auto.ai.langgraph'); expect(invokeAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE].value).toBe('resume_agent'); expect(invokeAgentSpan!.attributes[GEN_AI_PIPELINE_NAME_ATTRIBUTE].value).toBe('resume_agent'); @@ -382,7 +383,7 @@ describe('LangGraph integration', () => { expect.objectContaining({ data: expect.objectContaining({ [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'invoke_agent', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.invoke_agent', + [SENTRY_OP]: 'gen_ai.invoke_agent', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.langgraph', [GEN_AI_AGENT_NAME_ATTRIBUTE]: 'helpful_assistant', [GEN_AI_PIPELINE_NAME_ATTRIBUTE]: 'helpful_assistant', diff --git a/dev-packages/node-integration-tests/suites/tracing/lru-memoizer/test.ts b/dev-packages/node-integration-tests/suites/tracing/lru-memoizer/test.ts index 56f8961ea9aa..e4715a78f9a9 100644 --- a/dev-packages/node-integration-tests/suites/tracing/lru-memoizer/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/lru-memoizer/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; import { createCjsTests } from '../../../utils/runner/createEsmAndCjsTests'; @@ -22,7 +23,7 @@ describe('lru-memoizer', () => { trace: expect.objectContaining({ op: 'run', data: expect.objectContaining({ - 'sentry.op': 'run', + [SENTRY_OP]: 'run', 'sentry.origin': 'manual', 'memoized.context_preserved': true, }), diff --git a/dev-packages/node-integration-tests/suites/tracing/mongodb-v4/test.ts b/dev-packages/node-integration-tests/suites/tracing/mongodb-v4/test.ts index 28f5d5abb64b..ebc6ff2df600 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mongodb-v4/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mongodb-v4/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { MongoMemoryServer } from 'mongodb-memory-server-global'; import { afterAll, beforeAll, describe, expect } from 'vitest'; @@ -27,7 +28,7 @@ describe('MongoDB v4 auto-instrumentation', () => { expect.objectContaining({ data: expect.objectContaining({ 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': 'movies', diff --git a/dev-packages/node-integration-tests/suites/tracing/mongodb-v5/test.ts b/dev-packages/node-integration-tests/suites/tracing/mongodb-v5/test.ts index 6b0c67965da9..6e5fdddbb5f8 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mongodb-v5/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mongodb-v5/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { MongoMemoryServer } from 'mongodb-memory-server-global'; import { afterAll, beforeAll, describe, expect } from 'vitest'; @@ -27,7 +28,7 @@ describe('MongoDB v5 auto-instrumentation', () => { expect.objectContaining({ data: expect.objectContaining({ 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': 'movies', diff --git a/dev-packages/node-integration-tests/suites/tracing/mongodb-v6/test.ts b/dev-packages/node-integration-tests/suites/tracing/mongodb-v6/test.ts index 9ad2263efc0f..81fe7aa96820 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mongodb-v6/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mongodb-v6/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { MongoMemoryServer } from 'mongodb-memory-server-global'; import { afterAll, beforeAll, describe, expect } from 'vitest'; @@ -30,7 +31,7 @@ describe('MongoDB v6 auto-instrumentation', () => { expect.objectContaining({ data: expect.objectContaining({ 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': 'movies', diff --git a/dev-packages/node-integration-tests/suites/tracing/mongodb-v7/test.ts b/dev-packages/node-integration-tests/suites/tracing/mongodb-v7/test.ts index f6c47b9a4f67..ef5f64d4b87a 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mongodb-v7/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mongodb-v7/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { MongoMemoryServer } from 'mongodb-memory-server-global'; import { afterAll, beforeAll, expect } from 'vitest'; @@ -31,7 +32,7 @@ conditionalTest({ min: 20 })('MongoDB v7 auto-instrumentation', () => { expect.objectContaining({ data: expect.objectContaining({ 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': 'movies', diff --git a/dev-packages/node-integration-tests/suites/tracing/mongodb/test.ts b/dev-packages/node-integration-tests/suites/tracing/mongodb/test.ts index 5c88a8de18da..a25a649f44de 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mongodb/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mongodb/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { MongoMemoryServer } from 'mongodb-memory-server-global'; import { afterAll, beforeAll, describe, expect } from 'vitest'; @@ -24,7 +25,7 @@ describe('MongoDB auto-instrumentation', () => { const SPAN_FIND_MATCHER = expect.objectContaining({ data: { 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': 'movies', @@ -43,7 +44,7 @@ describe('MongoDB auto-instrumentation', () => { const SPAN_INSERT_MATCHER = expect.objectContaining({ data: { 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': 'movies', @@ -62,7 +63,7 @@ describe('MongoDB auto-instrumentation', () => { const SPAN_ISMASTER_MATCHER = expect.objectContaining({ data: { 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': '$cmd', @@ -83,7 +84,7 @@ describe('MongoDB auto-instrumentation', () => { const SPAN_UPDATE_MATCHER = expect.objectContaining({ data: { 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': 'movies', @@ -103,7 +104,7 @@ describe('MongoDB auto-instrumentation', () => { const SPAN_FIND_ERROR_MATCHER = expect.objectContaining({ data: expect.objectContaining({ 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.operation': 'find', 'db.statement': '{"$thisOperatorDoesNotExist":"?"}', @@ -118,7 +119,7 @@ describe('MongoDB auto-instrumentation', () => { const SPAN_ENDSESSIONS_MATCHER = expect.objectContaining({ data: { 'sentry.origin': origin, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mongodb', 'db.name': 'admin', 'db.mongodb.collection': '$cmd', 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 9cd0d93fca64..c58e1292585a 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mysql/test.ts @@ -3,9 +3,9 @@ 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 { isOrchestrionEnabled } from '../../../utils'; -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 @@ -196,9 +196,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); @@ -231,7 +229,7 @@ describe('mysql auto instrumentation', () => { type: 'string', value: 'production', }, - 'sentry.op': { + [SENTRY_OP]: { type: 'string', value: 'db', }, 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 0895e6dffd19..b4df3da1c42a 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,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES_ATTRIBUTE, @@ -94,7 +95,7 @@ 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', }); @@ -146,7 +147,7 @@ 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', }); @@ -209,7 +210,7 @@ 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', }); @@ -265,7 +266,7 @@ 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', }); @@ -342,7 +343,7 @@ 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', }); @@ -410,7 +411,7 @@ 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', }); @@ -485,7 +486,7 @@ 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', }); @@ -553,7 +554,7 @@ 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', }); 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 3f102d360e40..d5921c308b87 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,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_CONVERSATION_ID_ATTRIBUTE, @@ -48,7 +49,7 @@ 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', }); @@ -103,7 +104,7 @@ 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', }); @@ -153,7 +154,7 @@ 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', }); @@ -180,7 +181,7 @@ 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', }); @@ -243,7 +244,7 @@ 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', }); @@ -315,7 +316,7 @@ 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', }); @@ -348,7 +349,7 @@ 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', }); @@ -419,7 +420,7 @@ 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', }); @@ -481,7 +482,7 @@ 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', }); @@ -516,7 +517,7 @@ 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', }); @@ -595,7 +596,7 @@ 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', }); @@ -687,7 +688,7 @@ 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', }); @@ -834,7 +835,7 @@ 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', }); @@ -879,7 +880,7 @@ 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', }); @@ -908,7 +909,7 @@ 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', }); @@ -965,7 +966,7 @@ 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', }); @@ -1016,7 +1017,7 @@ 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', }); @@ -1049,7 +1050,7 @@ 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', }); @@ -1106,7 +1107,7 @@ describe('OpenAI integration', () => { trace_id: expect.any(String), data: { [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', + [SENTRY_OP]: 'gen_ai.chat', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: isOrchestrionEnabled() ? 'auto.ai.orchestrion.openai' : 'auto.ai.openai', @@ -1150,7 +1151,7 @@ describe('OpenAI integration', () => { trace_id: expect.any(String), data: { [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', + [SENTRY_OP]: 'gen_ai.chat', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: isOrchestrionEnabled() ? 'auto.ai.orchestrion.openai' : 'auto.ai.openai', @@ -1204,7 +1205,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(truncatedMessageSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(truncatedMessageSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); @@ -1243,7 +1244,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'chat', }); - expect(smallMessageSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(smallMessageSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); @@ -1302,7 +1303,7 @@ describe('OpenAI integration', () => { expect(firstSpan!.name).toBe('chat gpt-3.5-turbo'); expect(firstSpan!.status).toBe('ok'); expect(firstSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE]).toEqual({ type: 'string', value: 'chat' }); - expect(firstSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toEqual({ + expect(firstSpan!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat', }); @@ -1349,7 +1350,7 @@ 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', }); @@ -1378,7 +1379,7 @@ 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', }); @@ -1401,12 +1402,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_ATTRIBUTE] === 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', }); @@ -1421,7 +1422,7 @@ 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', }); @@ -1473,7 +1474,7 @@ describe('OpenAI integration', () => { expect(span!.attributes['gen_ai.system']).toEqual({ type: 'string', value: 'openai' }); expect(span!.attributes['gen_ai.request.model']).toEqual({ type: 'string', value: 'gpt-4' }); expect(span!.attributes['gen_ai.operation.name']).toEqual({ type: 'string', value: 'chat' }); - expect(span!.attributes['sentry.op']).toEqual({ type: 'string', value: 'gen_ai.chat' }); + expect(span!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat' }); } }, }) @@ -1505,7 +1506,7 @@ describe('OpenAI integration', () => { }); expect(span!.attributes['gen_ai.system']).toEqual({ type: 'string', value: 'openai' }); expect(span!.attributes['gen_ai.request.model']).toEqual({ type: 'string', value: 'gpt-4' }); - expect(span!.attributes['sentry.op']).toEqual({ type: 'string', value: 'gen_ai.chat' }); + expect(span!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat' }); } }, }) @@ -1537,7 +1538,7 @@ describe('OpenAI integration', () => { }); expect(span!.attributes['gen_ai.system']).toEqual({ type: 'string', value: 'openai' }); expect(span!.attributes['gen_ai.request.model']).toEqual({ type: 'string', value: 'gpt-4' }); - expect(span!.attributes['sentry.op']).toEqual({ type: 'string', value: 'gen_ai.chat' }); + expect(span!.attributes[SENTRY_OP]).toEqual({ type: 'string', value: 'gen_ai.chat' }); } }, }) 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 0530d1575845..9d79e7110ea7 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,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_EMBEDDINGS_INPUT_ATTRIBUTE, @@ -51,7 +52,7 @@ 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', }); @@ -106,7 +107,7 @@ 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', }); @@ -156,7 +157,7 @@ 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', }); @@ -183,7 +184,7 @@ 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', }); @@ -246,7 +247,7 @@ 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', }); @@ -318,7 +319,7 @@ 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', }); @@ -361,7 +362,7 @@ 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', }); @@ -432,7 +433,7 @@ 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', }); @@ -494,7 +495,7 @@ 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', }); @@ -529,7 +530,7 @@ 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', }); @@ -608,7 +609,7 @@ 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', }); @@ -700,7 +701,7 @@ 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', }); @@ -822,7 +823,7 @@ 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', }); @@ -867,7 +868,7 @@ 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', }); @@ -896,7 +897,7 @@ 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', }); @@ -963,7 +964,7 @@ 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', }); @@ -1014,7 +1015,7 @@ 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', }); @@ -1047,7 +1048,7 @@ 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', }); @@ -1114,7 +1115,7 @@ describe('OpenAI integration (V6)', () => { trace_id: expect.any(String), data: { [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', + [SENTRY_OP]: 'gen_ai.chat', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: isOrchestrionEnabled() ? 'auto.ai.orchestrion.openai' : 'auto.ai.openai', @@ -1169,7 +1170,7 @@ describe('OpenAI integration (V6)', () => { trace_id: expect.any(String), data: { [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', + [SENTRY_OP]: 'gen_ai.chat', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: isOrchestrionEnabled() ? 'auto.ai.orchestrion.openai' : '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 a0d7686e912b..82d46e8d1980 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, isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -44,7 +43,7 @@ const COMMON_DB_ATTRIBUTES = { type: 'string', value: 'production', }, - 'sentry.op': { + [SENTRY_OP]: { type: 'string', value: 'db', }, @@ -152,7 +151,7 @@ const CREATE_NATIVE_USER_TABLE_STATEMENT = 'CREATE TABLE "NativeUser" ("id" SERIAL NOT NULL,"createdAt" TIMESTAMP(3) 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/postgres/test.ts b/dev-packages/node-integration-tests/suites/tracing/postgres/test.ts index fdb1cf710501..6e5bc08ee309 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgres/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/postgres/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { conditionalTest, isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -22,7 +23,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.system': 'postgresql', 'db.name': 'tests', 'sentry.origin': 'manual', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'pg.connect', op: 'db', @@ -34,7 +35,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'INSERT INTO "User" ("email", "name") VALUES ($1, $2)', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'INSERT INTO "User" ("email", "name") VALUES ($1, $2)', op: 'db', @@ -47,7 +48,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT * FROM "User"', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT * FROM "User"', op: 'db', @@ -61,7 +62,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.statement': 'SELECT * FROM "User" WHERE "email" = $1', 'db.postgresql.plan': 'select-user-by-email', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT * FROM "User" WHERE "email" = $1', op: 'db', @@ -74,7 +75,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT * FROM "does_not_exist_table"', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT * FROM "does_not_exist_table"', op: 'db', @@ -108,7 +109,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'INSERT INTO "User" ("email", "name") VALUES ($1, $2)', 'sentry.origin': 'auto.db.otel.postgres', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'INSERT INTO "User" ("email", "name") VALUES ($1, $2)', op: 'db', @@ -121,7 +122,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT * FROM "User"', 'sentry.origin': 'auto.db.otel.postgres', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT * FROM "User"', op: 'db', @@ -149,7 +150,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.system': 'postgresql', 'db.name': 'tests', 'db.connection_string': 'postgresql://localhost:5494/tests', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'pg-pool.connect', op: 'db', @@ -163,7 +164,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT 1 AS foo', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT 1 AS foo', op: 'db', @@ -192,7 +193,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ data: expect.objectContaining({ 'db.system': 'postgresql', 'db.name': 'tests', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'pg.connect', op: 'db', @@ -224,7 +225,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT 1 AS connect_then', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT 1 AS connect_then', op: 'db', @@ -261,7 +262,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT 2 AS parented', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT 2 AS parented', op: 'db', @@ -287,7 +288,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.system': 'postgresql', 'db.name': 'tests', 'sentry.origin': 'manual', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'pg.connect', op: 'db', @@ -299,7 +300,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)', op: 'db', @@ -312,7 +313,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT * FROM "NativeUser"', 'sentry.origin': QUERY_ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT * FROM "NativeUser"', op: 'db', @@ -352,7 +353,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.system': 'postgresql', 'db.name': 'tests', 'sentry.origin': 'manual', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'pg.connect', op: 'db', @@ -364,7 +365,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'INSERT INTO "User" ("email", "name") VALUES ($1, $2)', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'INSERT INTO "User" ("email", "name") VALUES ($1, $2)', op: 'db', @@ -378,7 +379,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.statement': 'SELECT * FROM "User" WHERE "email" = $1', 'db.postgresql.plan': 'select-user-by-email', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT * FROM "User" WHERE "email" = $1', op: 'db', @@ -390,7 +391,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.system': 'postgresql', 'db.statement': 'SELECT * FROM "does_not_exist_table"', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT * FROM "does_not_exist_table"', op: 'db', @@ -424,7 +425,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.system': 'postgresql', 'db.name': 'tests', 'db.connection_string': 'postgresql://localhost:5494/tests', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'pg-pool.connect', op: 'db', @@ -437,7 +438,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT 1 AS foo', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT 1 AS foo', op: 'db', @@ -466,7 +467,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ transaction: 'Test Transaction', spans: expect.arrayContaining([ expect.objectContaining({ - data: expect.objectContaining({ 'db.system': 'postgresql', 'db.name': 'tests', 'sentry.op': 'db' }), + data: expect.objectContaining({ 'db.system': 'postgresql', 'db.name': 'tests', [SENTRY_OP]: 'db' }), description: 'pg.connect', op: 'db', // A failed connect has no canonical status message, so serializes @@ -517,7 +518,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.system': 'postgresql', 'db.statement': 'SELECT 2 AS parented', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT 2 AS parented', op: 'db', @@ -564,7 +565,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'INSERT INTO "User" ("email", "name") VALUES ($1, $2)', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'INSERT INTO "User" ("email", "name") VALUES ($1, $2)', op: 'db', @@ -577,7 +578,7 @@ describeWithDockerCompose('postgres auto instrumentation', { workingDirectory: [ 'db.name': 'tests', 'db.statement': 'SELECT * FROM "User"', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', }), description: 'SELECT * FROM "User"', op: 'db', diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs/test.ts b/dev-packages/node-integration-tests/suites/tracing/postgresjs/test.ts index f0da918c9b89..80a4fa0cbb01 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -23,7 +24,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.operation.name': 'CREATE TABLE', 'db.query.text': 'CREATE TABLE "User" ("id" SERIAL NOT NULL,"createdAt" TIMESTAMP(?) NOT NULL DEFAULT CURRENT_TIMESTAMP,"email" TEXT NOT NULL,"name" TEXT,CONSTRAINT "User_pkey" PRIMARY KEY ("id"))', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -46,7 +47,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.operation.name': 'INSERT', 'db.query.text': 'INSERT INTO "User" ("email", "name") VALUES ($1, ?)', 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'server.address': 'localhost', 'server.port': 5444, }), @@ -66,7 +67,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'UPDATE', 'db.query.text': 'UPDATE "User" SET "name" = ? WHERE "email" = $1', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -87,7 +88,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'SELECT', 'db.query.text': 'SELECT * FROM "User" WHERE "email" = $1', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -111,7 +112,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'SELECT', 'db.query.text': 'SELECT * FROM "User" WHERE "email" = $1 AND "name" = $2', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -132,7 +133,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'SELECT', 'db.query.text': 'SELECT * from generate_series(?,?) as x', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -153,7 +154,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'DROP TABLE', 'db.query.text': 'DROP TABLE "User"', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -176,7 +177,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.response.status_code': '42P01', 'error.type': 'PostgresError', 'db.query.text': 'SELECT * FROM "User" WHERE "email" = $1', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -250,7 +251,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.query.text': 'CREATE TABLE "User" ("id" SERIAL NOT NULL,"createdAt" TIMESTAMP(?) NOT NULL DEFAULT CURRENT_TIMESTAMP,"email" TEXT NOT NULL,"name" TEXT,CONSTRAINT "User_pkey" PRIMARY KEY ("id"))', 'custom.requestHook': 'called', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -268,7 +269,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.operation.name': 'INSERT', 'db.query.text': 'INSERT INTO "User" ("email", "name") VALUES ($1, ?)', 'custom.requestHook': 'called', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -285,7 +286,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.operation.name': 'SELECT', 'db.query.text': 'SELECT * FROM "User" WHERE "email" = $1', 'custom.requestHook': 'called', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -302,7 +303,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.operation.name': 'DROP TABLE', 'db.query.text': 'DROP TABLE "User"', 'custom.requestHook': 'called', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -346,7 +347,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.operation.name': 'CREATE TABLE', 'db.query.text': 'CREATE TABLE "User" ("id" SERIAL NOT NULL,"createdAt" TIMESTAMP(?) NOT NULL DEFAULT CURRENT_TIMESTAMP,"email" TEXT NOT NULL,"name" TEXT,CONSTRAINT "User_pkey" PRIMARY KEY ("id"))', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -363,7 +364,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'INSERT', 'db.query.text': 'INSERT INTO "User" ("email", "name") VALUES ($1, ?)', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -379,7 +380,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'SELECT', 'db.query.text': 'SELECT * FROM "User" WHERE "email" = $1', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -395,7 +396,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'DELETE', 'db.query.text': 'DELETE FROM "User" WHERE "email" = $1', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -425,7 +426,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'CREATE TABLE', 'db.query.text': 'CREATE TABLE "User" ("id" SERIAL NOT NULL, "email" TEXT NOT NULL, PRIMARY KEY ("id"))', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -442,7 +443,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'INSERT', 'db.query.text': 'INSERT INTO "User" ("email") VALUES ($1)', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -458,7 +459,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'SELECT', 'db.query.text': 'SELECT * FROM "User" WHERE "email" = $1', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, @@ -474,7 +475,7 @@ describeWithDockerCompose('postgresjs auto instrumentation', { workingDirectory: 'db.system.name': 'postgres', 'db.operation.name': 'DROP TABLE', 'db.query.text': 'DROP TABLE "User"', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': ORIGIN, 'server.address': 'localhost', 'server.port': 5444, diff --git a/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v5/test.ts b/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v5/test.ts index 94afb45905d4..d1a9d74c5ced 100644 --- a/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v5/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v5/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { TransactionEvent } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -77,7 +78,7 @@ function expectPrismaV5Spans(transaction: TransactionEvent): void { 'db.statement': expect.stringContaining('INSERT INTO'), 'db.system': 'postgresql', 'otel.kind': 'CLIENT', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': 'auto.db.otel.prisma', }, op: 'db', @@ -89,7 +90,7 @@ function expectPrismaV5Spans(transaction: TransactionEvent): void { 'db.statement': expect.stringContaining('SELECT'), 'db.system': 'postgresql', 'otel.kind': 'CLIENT', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': 'auto.db.otel.prisma', }, op: 'db', @@ -101,7 +102,7 @@ function expectPrismaV5Spans(transaction: TransactionEvent): void { 'db.statement': expect.stringContaining('DELETE'), 'db.system': 'postgresql', 'otel.kind': 'CLIENT', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': 'auto.db.otel.prisma', }, op: 'db', diff --git a/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v6/test.ts b/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v6/test.ts index 4516c5627508..0ea8c7fce823 100644 --- a/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v6/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v6/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { SpanJSON } from '@sentry/core'; import { afterAll, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -85,7 +86,7 @@ describeWithDockerCompose('Prisma ORM v6 Tests', { workingDirectory: [__dirname] expectPrismaSpanToIncludeSpanWith({ data: { - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.query.text': 'SELECT "public"."User"."id", "public"."User"."createdAt", "public"."User"."email", "public"."User"."name" FROM "public"."User" WHERE 1=1 OFFSET $1', 'db.system': 'postgresql', @@ -97,7 +98,7 @@ describeWithDockerCompose('Prisma ORM v6 Tests', { workingDirectory: [__dirname] expectPrismaSpanToIncludeSpanWith({ data: { - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.query.text': 'DELETE FROM "public"."User" WHERE "public"."User"."email"::text LIKE $1', 'db.system': 'postgresql', 'otel.kind': 'CLIENT', diff --git a/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v7/test.ts b/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v7/test.ts index 2947fda3c045..0af7f648c686 100644 --- a/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v7/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/prisma-orm-v7/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, expect } from 'vitest'; import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -64,7 +65,7 @@ conditionalTest({ min: 20 })('Prisma ORM v7 Tests', () => { // The SDK should rewrite the span name to the actual SQL text (same as v5/v6 // `prisma:engine:db_query`), so we find it via op/origin rather than description. const dbQuerySpan = prismaSpans.find( - span => span.data?.['sentry.op'] === 'db' && span.data?.['db.query.text'], + span => span.data?.[SENTRY_OP] === 'db' && span.data?.['db.query.text'], ); expect(dbQuerySpan).toBeDefined(); expect(dbQuerySpan?.data?.['db.system.name']).toBe('postgresql'); diff --git a/dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts b/dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts index a29edf9287cf..d4f4697e2140 100644 --- a/dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -18,7 +19,7 @@ describeWithDockerCompose('redis cache auto instrumentation', { workingDirectory op: 'db', origin: redisOrigin, data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'redis', 'net.peer.name': 'localhost', 'net.peer.port': 6383, @@ -30,7 +31,7 @@ describeWithDockerCompose('redis cache auto instrumentation', { workingDirectory op: 'db', origin: redisOrigin, data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'redis', 'net.peer.name': 'localhost', 'net.peer.port': 6383, diff --git a/dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts b/dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts index 5f5336d2185b..7199b55cb5bc 100644 --- a/dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -16,7 +17,7 @@ describeWithDockerCompose( op: 'db.redis', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + [SENTRY_OP]: 'db.redis', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'SET dc-test-key ?', @@ -50,7 +51,7 @@ describeWithDockerCompose( op: 'db.redis', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + [SENTRY_OP]: 'db.redis', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'GET dc-test-key', @@ -87,7 +88,7 @@ describeWithDockerCompose( op: 'db.redis', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + [SENTRY_OP]: 'db.redis', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'MGET ? ? ?', 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 20c41136d4d5..4c470d7c47e2 100644 --- a/dev-packages/node-integration-tests/suites/tracing/redis/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/redis/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -20,7 +21,7 @@ describeWithDockerCompose('redis auto instrumentation', { workingDirectory: [__d op: 'db', origin, data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': origin, 'db.system': 'redis', 'net.peer.name': 'localhost', @@ -33,7 +34,7 @@ describeWithDockerCompose('redis auto instrumentation', { workingDirectory: [__d op: 'db', origin, data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': origin, 'db.system': 'redis', 'net.peer.name': 'localhost', @@ -48,7 +49,7 @@ describeWithDockerCompose('redis auto instrumentation', { workingDirectory: [__d status: 'internal_error', origin, data: expect.objectContaining({ - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.origin': origin, 'db.system': 'redis', 'net.peer.name': 'localhost', diff --git a/dev-packages/node-integration-tests/suites/tracing/tedious/test.ts b/dev-packages/node-integration-tests/suites/tracing/tedious/test.ts index 420a92a6caa7..0df41f834975 100644 --- a/dev-packages/node-integration-tests/suites/tracing/tedious/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/tedious/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterAll, expect } from 'vitest'; import { isOrchestrionEnabled } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests, describeWithDockerCompose } from '../../../utils/runner'; @@ -15,7 +16,7 @@ describeWithDockerCompose('tedious auto instrumentation', { workingDirectory: [_ origin: ORIGIN, data: expect.objectContaining({ 'sentry.origin': ORIGIN, - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'db.system': 'mssql', 'db.name': 'master', 'db.user': 'sa', 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 f28559c4b9e9..7025b2141655 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,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES_ATTRIBUTE, @@ -56,7 +57,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -71,7 +72,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -85,7 +86,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -99,7 +100,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -113,7 +114,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -127,7 +128,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_NAME_ATTRIBUTE]: attr('getWeather'), [GEN_AI_TOOL_TYPE_ATTRIBUTE]: attr('function'), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_OP]: attr('gen_ai.execute_tool'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -152,7 +153,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -171,7 +172,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -189,7 +190,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -209,7 +210,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -226,7 +227,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -242,7 +243,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_OUTPUT_ATTRIBUTE]: expect.objectContaining({ value: expect.any(String) }), [GEN_AI_TOOL_TYPE_ATTRIBUTE]: attr('function'), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_OP]: attr('gen_ai.execute_tool'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -256,7 +257,7 @@ describe('Vercel AI integration (streaming v4)', () => { status: 'error', attributes: expect.objectContaining({ [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -269,7 +270,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), }), }), @@ -281,7 +282,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_NAME_ATTRIBUTE]: attr('getWeather'), [GEN_AI_TOOL_TYPE_ATTRIBUTE]: attr('function'), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_OP]: attr('gen_ai.execute_tool'), [SEMANTIC_ATTRIBUTE_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 2e8ccc0c1602..ed0492a26994 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,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES_ATTRIBUTE, @@ -50,7 +51,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -65,7 +66,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -79,7 +80,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -93,7 +94,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -107,7 +108,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -121,7 +122,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_NAME_ATTRIBUTE]: attr('getWeather'), [GEN_AI_TOOL_TYPE_ATTRIBUTE]: attr('function'), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_OP]: attr('gen_ai.execute_tool'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -146,7 +147,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -165,7 +166,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -183,7 +184,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(20), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(30), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -203,7 +204,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -220,7 +221,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -236,7 +237,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_OUTPUT_ATTRIBUTE]: expect.objectContaining({ value: expect.any(String) }), [GEN_AI_TOOL_TYPE_ATTRIBUTE]: attr('function'), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_OP]: attr('gen_ai.execute_tool'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -249,7 +250,7 @@ describe('Vercel AI integration (streaming, v6)', () => { name: 'invoke_agent', attributes: expect.objectContaining({ [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.invoke_agent'), + [SENTRY_OP]: attr('gen_ai.invoke_agent'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -262,7 +263,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: attr(25), [GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: attr(40), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.generate_content'), + [SENTRY_OP]: attr('gen_ai.generate_content'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), @@ -274,7 +275,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_NAME_ATTRIBUTE]: attr('getWeather'), [GEN_AI_TOOL_TYPE_ATTRIBUTE]: attr('function'), [GEN_AI_OPERATION_NAME_ATTRIBUTE]: attr('execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'), + [SENTRY_OP]: attr('gen_ai.execute_tool'), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), }), }), diff --git a/dev-packages/node-integration-tests/suites/tracing/vercelai/test.ts b/dev-packages/node-integration-tests/suites/tracing/vercelai/test.ts index b759495545cc..3e5a9180319e 100644 --- a/dev-packages/node-integration-tests/suites/tracing/vercelai/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/vercelai/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Event } from '@sentry/node'; import { afterAll, describe, expect } from 'vitest'; import { @@ -49,7 +50,7 @@ describe('Vercel AI integration (v4)', () => { expect(firstInvokeAgentSpan).toBeDefined(); expect(firstInvokeAgentSpan!.name).toBe('invoke_agent'); expect(firstInvokeAgentSpan!.status).toBe('ok'); - expect(firstInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(firstInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(firstInvokeAgentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateText'); expect(firstInvokeAgentSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('mock-model-id'); expect(firstInvokeAgentSpan!.attributes[GEN_AI_RESPONSE_MODEL_ATTRIBUTE].value).toBe('mock-model-id'); @@ -68,7 +69,7 @@ describe('Vercel AI integration (v4)', () => { expect(firstGenerateContentSpan).toBeDefined(); expect(firstGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(firstGenerateContentSpan!.status).toBe('ok'); - expect(firstGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(firstGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(firstGenerateContentSpan!.attributes['vercel.ai.operationId'].value).toBe( 'ai.generateText.doGenerate', ); @@ -85,7 +86,7 @@ describe('Vercel AI integration (v4)', () => { expect(secondInvokeAgentSpan).toBeDefined(); expect(secondInvokeAgentSpan!.name).toBe('invoke_agent'); expect(secondInvokeAgentSpan!.status).toBe('ok'); - expect(secondInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(secondInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(secondInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe( '[{"role":"user","content":"Where is the second span?"}]', ); @@ -103,7 +104,7 @@ describe('Vercel AI integration (v4)', () => { expect(secondGenerateContentSpan).toBeDefined(); expect(secondGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(secondGenerateContentSpan!.status).toBe('ok'); - expect(secondGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(secondGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(secondGenerateContentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]).toBeDefined(); expect(secondGenerateContentSpan!.attributes[GEN_AI_OUTPUT_MESSAGES_ATTRIBUTE].value).toContain( 'Second span here!', @@ -116,7 +117,7 @@ describe('Vercel AI integration (v4)', () => { expect(toolInvokeAgentSpan).toBeDefined(); expect(toolInvokeAgentSpan!.name).toBe('invoke_agent'); expect(toolInvokeAgentSpan!.status).toBe('ok'); - expect(toolInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(toolInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(toolInvokeAgentSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE].value).toBe(15); expect(toolInvokeAgentSpan!.attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE].value).toBe(25); expect(toolInvokeAgentSpan!.attributes[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE].value).toBe(40); @@ -129,14 +130,14 @@ describe('Vercel AI integration (v4)', () => { expect(toolGenerateContentSpan).toBeDefined(); expect(toolGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(toolGenerateContentSpan!.status).toBe('ok'); - expect(toolGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(toolGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(toolGenerateContentSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE].value).toBe(15); const toolExecutionSpan = container.items.find(span => span.name === 'execute_tool getWeather'); expect(toolExecutionSpan).toBeDefined(); expect(toolExecutionSpan!.name).toBe('execute_tool getWeather'); expect(toolExecutionSpan!.status).toBe('ok'); - expect(toolExecutionSpan!.attributes['sentry.op'].value).toBe('gen_ai.execute_tool'); + expect(toolExecutionSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.execute_tool'); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE].value).toBe('getWeather'); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ID_ATTRIBUTE].value).toBe('call-1'); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_TYPE_ATTRIBUTE].value).toBe('function'); @@ -163,7 +164,7 @@ describe('Vercel AI integration (v4)', () => { expect(firstInvokeAgentSpan).toBeDefined(); expect(firstInvokeAgentSpan!.name).toBe('invoke_agent'); expect(firstInvokeAgentSpan!.status).toBe('ok'); - expect(firstInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(firstInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(firstInvokeAgentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateText'); expect(firstInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe( '[{"role":"user","content":"Where is the first span?"}]', @@ -182,7 +183,7 @@ describe('Vercel AI integration (v4)', () => { expect(firstGenerateContentSpan).toBeDefined(); expect(firstGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(firstGenerateContentSpan!.status).toBe('ok'); - expect(firstGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(firstGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(firstGenerateContentSpan!.attributes['vercel.ai.operationId'].value).toBe( 'ai.generateText.doGenerate', ); @@ -200,7 +201,7 @@ describe('Vercel AI integration (v4)', () => { expect(secondInvokeAgentSpan).toBeDefined(); expect(secondInvokeAgentSpan!.name).toBe('invoke_agent'); expect(secondInvokeAgentSpan!.status).toBe('ok'); - expect(secondInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(secondInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(secondInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe( '[{"role":"user","content":"Where is the second span?"}]', ); @@ -215,7 +216,7 @@ describe('Vercel AI integration (v4)', () => { expect(secondGenerateContentSpan).toBeDefined(); expect(secondGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(secondGenerateContentSpan!.status).toBe('ok'); - expect(secondGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(secondGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); const toolInvokeAgentSpan = container.items.find( span => @@ -226,7 +227,7 @@ describe('Vercel AI integration (v4)', () => { expect(toolInvokeAgentSpan).toBeDefined(); expect(toolInvokeAgentSpan!.name).toBe('invoke_agent'); expect(toolInvokeAgentSpan!.status).toBe('ok'); - expect(toolInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(toolInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(toolInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe( '[{"role":"user","content":"What is the weather in San Francisco?"}]', ); @@ -242,7 +243,7 @@ describe('Vercel AI integration (v4)', () => { expect(toolGenerateContentSpan).toBeDefined(); expect(toolGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(toolGenerateContentSpan!.status).toBe('ok'); - expect(toolGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(toolGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(toolGenerateContentSpan!.attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE].value).toContain( 'getWeather', ); @@ -252,7 +253,7 @@ describe('Vercel AI integration (v4)', () => { expect(toolExecutionSpan).toBeDefined(); expect(toolExecutionSpan!.name).toBe('execute_tool getWeather'); expect(toolExecutionSpan!.status).toBe('ok'); - expect(toolExecutionSpan!.attributes['sentry.op'].value).toBe('gen_ai.execute_tool'); + expect(toolExecutionSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.execute_tool'); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE].value).toBe('getWeather'); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE].value).toBe( 'Get the current weather for a location', @@ -289,21 +290,21 @@ describe('Vercel AI integration (v4)', () => { expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.name).toBe('invoke_agent'); expect(invokeAgentSpan!.status).toBe('error'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateText'); const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.name).toBe('generate_content mock-model-id'); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(generateContentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateText.doGenerate'); const toolSpan = container.items.find(span => span.name === 'execute_tool getWeather'); expect(toolSpan).toBeDefined(); expect(toolSpan!.name).toBe('execute_tool getWeather'); expect(toolSpan!.status).toBe('error'); - expect(toolSpan!.attributes['sentry.op'].value).toBe('gen_ai.execute_tool'); + expect(toolSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.execute_tool'); expect(toolSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin); expect(toolSpan!.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE].value).toBe('getWeather'); }, @@ -362,20 +363,20 @@ describe('Vercel AI integration (v4)', () => { expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.name).toBe('invoke_agent'); expect(invokeAgentSpan!.status).toBe('error'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateText'); const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.name).toBe('generate_content mock-model-id'); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); const toolSpan = container.items.find(span => span.name === 'execute_tool getWeather'); expect(toolSpan).toBeDefined(); expect(toolSpan!.name).toBe('execute_tool getWeather'); expect(toolSpan!.status).toBe('error'); - expect(toolSpan!.attributes['sentry.op'].value).toBe('gen_ai.execute_tool'); + expect(toolSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.execute_tool'); expect(toolSpan!.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE].value).toBe('getWeather'); }, }) @@ -429,7 +430,7 @@ describe('Vercel AI integration (v4)', () => { expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.name).toBe('invoke_agent'); expect(invokeAgentSpan!.status).toBe('ok'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes['sentry.origin'].value).toBe('auto.vercelai.otel'); expect(invokeAgentSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('invoke_agent'); @@ -437,7 +438,7 @@ describe('Vercel AI integration (v4)', () => { expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.name).toBe('generateText.doGenerate'); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(generateContentSpan!.attributes['sentry.origin'].value).toBe('auto.vercelai.otel'); expect(generateContentSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE].value).toBe('generate_content'); }, @@ -462,7 +463,7 @@ describe('Vercel AI integration (v4)', () => { const invokeAgentSpan = container.items.find(span => span.name === 'invoke_agent'); expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.name).toBe('invoke_agent'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes[GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE].value).toBe( JSON.stringify([{ type: 'text', content: 'You are a helpful assistant' }]), ); @@ -470,7 +471,7 @@ describe('Vercel AI integration (v4)', () => { const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.name).toBe('generate_content mock-model-id'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); }, }) .start() @@ -500,7 +501,7 @@ describe('Vercel AI integration (v4)', () => { ); expect(truncatedInvokeAgentSpan).toBeDefined(); expect(truncatedInvokeAgentSpan!.name).toBe('invoke_agent'); - expect(truncatedInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(truncatedInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(truncatedInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE].value).toBe( 3, ); @@ -517,7 +518,7 @@ describe('Vercel AI integration (v4)', () => { ); expect(smallMessageInvokeAgentSpan).toBeDefined(); expect(smallMessageInvokeAgentSpan!.name).toBe('invoke_agent'); - expect(smallMessageInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(smallMessageInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect( smallMessageInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE].value, ).toBe(3); @@ -545,7 +546,7 @@ describe('Vercel AI integration (v4)', () => { expect(embedSpan).toBeDefined(); expect(embedSpan!.name).toBe('embeddings mock-model-id'); expect(embedSpan!.status).toBe('ok'); - expect(embedSpan!.attributes['sentry.op'].value).toBe('gen_ai.embeddings'); + expect(embedSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.embeddings'); expect(embedSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('mock-model-id'); expect(embedSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE].value).toBe(10); @@ -555,7 +556,7 @@ describe('Vercel AI integration (v4)', () => { expect(embedManySpan).toBeDefined(); expect(embedManySpan!.name).toBe('embeddings mock-model-id'); expect(embedManySpan!.status).toBe('ok'); - expect(embedManySpan!.attributes['sentry.op'].value).toBe('gen_ai.embeddings'); + expect(embedManySpan!.attributes[SENTRY_OP].value).toBe('gen_ai.embeddings'); expect(embedManySpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE].value).toBe(20); }, }) @@ -577,7 +578,7 @@ describe('Vercel AI integration (v4)', () => { expect(embedSpan).toBeDefined(); expect(embedSpan!.name).toBe('embeddings mock-model-id'); expect(embedSpan!.status).toBe('ok'); - expect(embedSpan!.attributes['sentry.op'].value).toBe('gen_ai.embeddings'); + expect(embedSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.embeddings'); expect(embedSpan!.attributes[GEN_AI_EMBEDDINGS_INPUT_ATTRIBUTE].value).toBe('Embedding test!'); const embedManySpan = container.items.find( @@ -586,7 +587,7 @@ describe('Vercel AI integration (v4)', () => { expect(embedManySpan).toBeDefined(); expect(embedManySpan!.name).toBe('embeddings mock-model-id'); expect(embedManySpan!.status).toBe('ok'); - expect(embedManySpan!.attributes['sentry.op'].value).toBe('gen_ai.embeddings'); + expect(embedManySpan!.attributes[SENTRY_OP].value).toBe('gen_ai.embeddings'); expect(embedManySpan!.attributes[GEN_AI_EMBEDDINGS_INPUT_ATTRIBUTE].value).toBe( '["First input","Second input"]', ); @@ -607,13 +608,13 @@ describe('Vercel AI integration (v4)', () => { const invokeAgentSpan = container.items.find(span => span.name === 'invoke_agent'); expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.name).toBe('invoke_agent'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes['gen_ai.conversation.id'].value).toBe('conv-a'); const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.name).toBe('generate_content mock-model-id'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(generateContentSpan!.attributes['gen_ai.conversation.id'].value).toBe('conv-a'); }, }) @@ -647,7 +648,7 @@ describe('Vercel AI integration (v4)', () => { ); expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.name).toBe('invoke_agent'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe( JSON.stringify([ { role: 'user', content: longContent }, @@ -660,7 +661,7 @@ describe('Vercel AI integration (v4)', () => { const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.name).toBe('generate_content mock-model-id'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); }, }) .start() @@ -680,7 +681,7 @@ describe('Vercel AI integration (v4)', () => { const invokeAgentSpan = container.items.find(span => span.name === 'invoke_agent'); expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.status).toBe('ok'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin); expect(invokeAgentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.streamText'); expect(invokeAgentSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('mock-model-id'); @@ -694,7 +695,7 @@ describe('Vercel AI integration (v4)', () => { const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(generateContentSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin); expect(generateContentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.streamText.doStream'); }, @@ -716,7 +717,7 @@ describe('Vercel AI integration (v4)', () => { const invokeAgentSpan = container.items.find(span => span.name === 'invoke_agent'); expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.status).toBe('ok'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateObject'); expect(invokeAgentSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin); expect(invokeAgentSpan!.attributes['gen_ai.operation.name'].value).toBe('invoke_agent'); @@ -734,7 +735,7 @@ describe('Vercel AI integration (v4)', () => { const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(generateContentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateObject.doGenerate'); expect(generateContentSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin); expect(generateContentSpan!.attributes['gen_ai.operation.name'].value).toBe('generate_content'); diff --git a/dev-packages/node-integration-tests/suites/tracing/vercelai/v5/test.ts b/dev-packages/node-integration-tests/suites/tracing/vercelai/v5/test.ts index 87ca0c5861f3..4abf323c847f 100644 --- a/dev-packages/node-integration-tests/suites/tracing/vercelai/v5/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/vercelai/v5/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Event } from '@sentry/node'; import { afterAll, describe, expect } from 'vitest'; import { @@ -48,7 +49,7 @@ describe('Vercel AI integration (v5)', () => { expect(firstInvokeAgentSpan).toBeDefined(); expect(firstInvokeAgentSpan!.name).toBe('invoke_agent'); expect(firstInvokeAgentSpan!.status).toBe('ok'); - expect(firstInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(firstInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(firstInvokeAgentSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin); expect(firstInvokeAgentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateText'); expect(firstInvokeAgentSpan!.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE].value).toBe('mock-model-id'); @@ -68,7 +69,7 @@ describe('Vercel AI integration (v5)', () => { expect(firstGenerateContentSpan).toBeDefined(); expect(firstGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(firstGenerateContentSpan!.status).toBe('ok'); - expect(firstGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(firstGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(firstGenerateContentSpan!.attributes['vercel.ai.operationId'].value).toBe( 'ai.generateText.doGenerate', ); @@ -85,7 +86,7 @@ describe('Vercel AI integration (v5)', () => { expect(secondInvokeAgentSpan).toBeDefined(); expect(secondInvokeAgentSpan!.name).toBe('invoke_agent'); expect(secondInvokeAgentSpan!.status).toBe('ok'); - expect(secondInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(secondInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(secondInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe( '[{"role":"user","content":"Where is the second span?"}]', ); @@ -103,7 +104,7 @@ describe('Vercel AI integration (v5)', () => { expect(secondGenerateContentSpan).toBeDefined(); expect(secondGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(secondGenerateContentSpan!.status).toBe('ok'); - expect(secondGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(secondGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); const toolInvokeAgentSpan = container.items.find( span => @@ -126,7 +127,7 @@ describe('Vercel AI integration (v5)', () => { expect(toolExecutionSpan).toBeDefined(); expect(toolExecutionSpan!.name).toBe('execute_tool getWeather'); expect(toolExecutionSpan!.status).toBe('ok'); - expect(toolExecutionSpan!.attributes['sentry.op'].value).toBe('gen_ai.execute_tool'); + expect(toolExecutionSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.execute_tool'); expect(toolExecutionSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE].value).toBe('getWeather'); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ID_ATTRIBUTE].value).toBe('call-1'); @@ -164,7 +165,7 @@ describe('Vercel AI integration (v5)', () => { expect(firstInvokeAgentSpan).toBeDefined(); expect(firstInvokeAgentSpan!.name).toBe('invoke_agent'); expect(firstInvokeAgentSpan!.status).toBe('ok'); - expect(firstInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(firstInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(firstInvokeAgentSpan!.attributes['vercel.ai.operationId'].value).toBe('ai.generateText'); expect(firstInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe( '[{"role":"user","content":"Where is the first span?"}]', @@ -183,7 +184,7 @@ describe('Vercel AI integration (v5)', () => { expect(firstGenerateContentSpan).toBeDefined(); expect(firstGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(firstGenerateContentSpan!.status).toBe('ok'); - expect(firstGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(firstGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(firstGenerateContentSpan!.attributes['vercel.ai.operationId'].value).toBe( 'ai.generateText.doGenerate', ); @@ -201,7 +202,7 @@ describe('Vercel AI integration (v5)', () => { expect(secondInvokeAgentSpan).toBeDefined(); expect(secondInvokeAgentSpan!.name).toBe('invoke_agent'); expect(secondInvokeAgentSpan!.status).toBe('ok'); - expect(secondInvokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(secondInvokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); expect(secondInvokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE].value).toBe( '[{"role":"user","content":"Where is the second span?"}]', ); @@ -216,7 +217,7 @@ describe('Vercel AI integration (v5)', () => { expect(secondGenerateContentSpan).toBeDefined(); expect(secondGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(secondGenerateContentSpan!.status).toBe('ok'); - expect(secondGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(secondGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); const toolInvokeAgentSpan = container.items.find( span => @@ -239,7 +240,7 @@ describe('Vercel AI integration (v5)', () => { expect(toolGenerateContentSpan).toBeDefined(); expect(toolGenerateContentSpan!.name).toBe('generate_content mock-model-id'); expect(toolGenerateContentSpan!.status).toBe('ok'); - expect(toolGenerateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(toolGenerateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); expect(toolGenerateContentSpan!.attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE]).toBeDefined(); expect(toolGenerateContentSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE].value).toBe(15); @@ -247,7 +248,7 @@ describe('Vercel AI integration (v5)', () => { expect(toolExecutionSpan).toBeDefined(); expect(toolExecutionSpan!.name).toBe('execute_tool getWeather'); expect(toolExecutionSpan!.status).toBe('ok'); - expect(toolExecutionSpan!.attributes['sentry.op'].value).toBe('gen_ai.execute_tool'); + expect(toolExecutionSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.execute_tool'); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE].value).toBe('getWeather'); expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE].value).toBe( 'Get the current weather for a location', @@ -291,19 +292,19 @@ describe('Vercel AI integration (v5)', () => { const invokeAgentSpan = container.items.find(span => span.name === 'invoke_agent'); expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.name).toBe('invoke_agent'); - expect(invokeAgentSpan!.attributes['sentry.op'].value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.invoke_agent'); const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.name).toBe('generate_content mock-model-id'); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op'].value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.generate_content'); const toolSpan = container.items.find(span => span.name === 'execute_tool getWeather'); expect(toolSpan).toBeDefined(); expect(toolSpan!.name).toBe('execute_tool getWeather'); expect(toolSpan!.status).toBe('error'); - expect(toolSpan!.attributes['sentry.op'].value).toBe('gen_ai.execute_tool'); + expect(toolSpan!.attributes[SENTRY_OP].value).toBe('gen_ai.execute_tool'); expect(toolSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin); expect(toolSpan!.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE].value).toBe('getWeather'); }, diff --git a/dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts b/dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts index 6963de59bcc6..7f7dccbe96ea 100644 --- a/dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { NODE_VERSION, type Event } from '@sentry/node'; import { afterAll, describe, expect } from 'vitest'; import { @@ -59,7 +60,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); expect(container.items).toHaveLength(7); const firstInvokeAgentSpan = container.items.find( @@ -71,7 +72,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(firstInvokeAgentSpan).toBeDefined(); expect(firstInvokeAgentSpan.name).toBe('invoke_agent'); expect(firstInvokeAgentSpan.status).toBe('ok'); - expect(firstInvokeAgentSpan.attributes['sentry.op']?.value).toBe('gen_ai.invoke_agent'); + expect(firstInvokeAgentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); expect(firstInvokeAgentSpan.attributes['vercel.ai.operationId']?.value).toBe('ai.generateText'); expect(firstInvokeAgentSpan.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]?.value).toBe( '[{"role":"user","content":"Where is the first span?"}]', @@ -90,7 +91,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(firstGenerateContentSpan).toBeDefined(); expect(firstGenerateContentSpan.name).toBe('generate_content mock-model-id'); expect(firstGenerateContentSpan.status).toBe('ok'); - expect(firstGenerateContentSpan.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(firstGenerateContentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); expect(firstGenerateContentSpan.attributes['vercel.ai.operationId']?.value).toBe( 'ai.generateText.doGenerate', ); @@ -108,7 +109,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(secondInvokeAgentSpan).toBeDefined(); expect(secondInvokeAgentSpan.name).toBe('invoke_agent'); expect(secondInvokeAgentSpan.status).toBe('ok'); - expect(secondInvokeAgentSpan.attributes['sentry.op']?.value).toBe('gen_ai.invoke_agent'); + expect(secondInvokeAgentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); const secondGenerateContentSpan = container.items.find( span => @@ -120,7 +121,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(secondGenerateContentSpan).toBeDefined(); expect(secondGenerateContentSpan.name).toBe('generate_content mock-model-id'); expect(secondGenerateContentSpan.status).toBe('ok'); - expect(secondGenerateContentSpan.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(secondGenerateContentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); const toolInvokeAgentSpan = container.items.find( span => @@ -143,7 +144,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(toolGenerateContentSpan).toBeDefined(); expect(toolGenerateContentSpan.name).toBe('generate_content mock-model-id'); expect(toolGenerateContentSpan.status).toBe('ok'); - expect(toolGenerateContentSpan.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(toolGenerateContentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); expect(toolGenerateContentSpan.attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE]).toBeDefined(); expect(toolGenerateContentSpan.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]?.value).toBe(15); @@ -151,7 +152,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(toolExecutionSpan).toBeDefined(); expect(toolExecutionSpan.name).toBe('execute_tool getWeather'); expect(toolExecutionSpan.status).toBe('ok'); - expect(toolExecutionSpan.attributes['sentry.op']?.value).toBe('gen_ai.execute_tool'); + expect(toolExecutionSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.execute_tool'); expect(toolExecutionSpan.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE]?.value).toBe('getWeather'); expect(toolExecutionSpan.attributes[GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE]?.value).toBe( 'Get the current weather for a location', @@ -183,7 +184,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); expect(container.items).toHaveLength(7); const firstInvokeAgentSpan = container.items.find( @@ -196,7 +197,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(firstInvokeAgentSpan).toBeDefined(); expect(firstInvokeAgentSpan.name).toBe('invoke_agent'); expect(firstInvokeAgentSpan.status).toBe('ok'); - expect(firstInvokeAgentSpan.attributes['sentry.op']?.value).toBe('gen_ai.invoke_agent'); + expect(firstInvokeAgentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); expect(firstInvokeAgentSpan.attributes['vercel.ai.operationId']?.value).toBe('ai.generateText'); expect(firstInvokeAgentSpan.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE]?.value).toBe('mock-model-id'); expect(firstInvokeAgentSpan.attributes[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]?.value).toBe('mock-model-id'); @@ -215,7 +216,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(firstGenerateContentSpan).toBeDefined(); expect(firstGenerateContentSpan.name).toBe('generate_content mock-model-id'); expect(firstGenerateContentSpan.status).toBe('ok'); - expect(firstGenerateContentSpan.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(firstGenerateContentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); expect(firstGenerateContentSpan.attributes['vercel.ai.operationId']?.value).toBe( 'ai.generateText.doGenerate', ); @@ -233,7 +234,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(secondInvokeAgentSpan).toBeDefined(); expect(secondInvokeAgentSpan.name).toBe('invoke_agent'); expect(secondInvokeAgentSpan.status).toBe('ok'); - expect(secondInvokeAgentSpan.attributes['sentry.op']?.value).toBe('gen_ai.invoke_agent'); + expect(secondInvokeAgentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); expect(secondInvokeAgentSpan.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]?.value).toBe( '[{"role":"user","content":"Where is the second span?"}]', ); @@ -250,7 +251,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(secondGenerateContentSpan).toBeDefined(); expect(secondGenerateContentSpan.name).toBe('generate_content mock-model-id'); expect(secondGenerateContentSpan.status).toBe('ok'); - expect(secondGenerateContentSpan.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(secondGenerateContentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); expect(secondGenerateContentSpan.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]).toBeDefined(); expect(secondGenerateContentSpan.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]?.value as string).toContain( 'Where is the second span?', @@ -280,7 +281,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(toolExecutionSpan).toBeDefined(); expect(toolExecutionSpan.name).toBe('execute_tool getWeather'); expect(toolExecutionSpan.status).toBe('ok'); - expect(toolExecutionSpan.attributes['sentry.op']?.value).toBe('gen_ai.execute_tool'); + expect(toolExecutionSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.execute_tool'); expect(toolExecutionSpan.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE]?.value).toBe('getWeather'); expect(toolExecutionSpan.attributes[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]?.value).toBe('call-1'); expect(toolExecutionSpan.attributes[GEN_AI_TOOL_TYPE_ATTRIBUTE]?.value).toBe('function'); @@ -316,25 +317,25 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); expect(container.items).toHaveLength(3); const invokeAgentSpan = container.items.find(span => span.name === 'invoke_agent')!; expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan.name).toBe('invoke_agent'); - expect(invokeAgentSpan.attributes['sentry.op']?.value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id')!; expect(generateContentSpan).toBeDefined(); expect(generateContentSpan.name).toBe('generate_content mock-model-id'); expect(generateContentSpan.status).toBe('ok'); - expect(generateContentSpan.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(generateContentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); const toolSpan = container.items.find(span => span.name === 'execute_tool getWeather')!; expect(toolSpan).toBeDefined(); expect(toolSpan.name).toBe('execute_tool getWeather'); expect(toolSpan.status).toBe('error'); - expect(toolSpan.attributes['sentry.op']?.value).toBe('gen_ai.execute_tool'); + expect(toolSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.execute_tool'); expect(toolSpan.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE]?.value).toBe('getWeather'); }, }) @@ -381,21 +382,21 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); expect(container.items).toHaveLength(7); const invokeAgentSpans = container.items.filter( - span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.invoke_agent', ); expect(invokeAgentSpans).toHaveLength(3); const generateContentSpans = container.items.filter( - span => span.attributes['sentry.op']?.value === 'gen_ai.generate_content', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.generate_content', ); expect(generateContentSpans).toHaveLength(3); const toolSpan = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.execute_tool', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.execute_tool', ); expect(toolSpan).toBeDefined(); }, @@ -423,14 +424,14 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); expect(container.items).toHaveLength(4); const invokeAgentSpan = container.items.find(span => span.name === 'invoke_agent weather_agent')!; expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan.name).toBe('invoke_agent weather_agent'); expect(invokeAgentSpan.status).toBe('ok'); - expect(invokeAgentSpan.attributes['sentry.op']?.value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE]?.value).toBe('mock-model-id'); const toolCallsGenerateContentSpan = container.items.find( @@ -439,7 +440,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(toolCallsGenerateContentSpan).toBeDefined(); expect(toolCallsGenerateContentSpan.name).toBe('generate_content mock-model-id'); expect(toolCallsGenerateContentSpan.status).toBe('ok'); - expect(toolCallsGenerateContentSpan.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(toolCallsGenerateContentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); expect(toolCallsGenerateContentSpan.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]?.value).toBe(10); expect(toolCallsGenerateContentSpan.attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]?.value).toBe(20); @@ -447,7 +448,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(toolSpan).toBeDefined(); expect(toolSpan.name).toBe('execute_tool getWeather'); expect(toolSpan.status).toBe('ok'); - expect(toolSpan.attributes['sentry.op']?.value).toBe('gen_ai.execute_tool'); + expect(toolSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.execute_tool'); expect(toolSpan.attributes[GEN_AI_TOOL_NAME_ATTRIBUTE]?.value).toBe('getWeather'); expect(toolSpan.attributes[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]?.value).toBe('call-1'); expect(toolSpan.attributes[GEN_AI_TOOL_TYPE_ATTRIBUTE]?.value).toBe('function'); @@ -458,7 +459,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(finalGenerateContentSpan).toBeDefined(); expect(finalGenerateContentSpan.name).toBe('generate_content mock-model-id'); expect(finalGenerateContentSpan.status).toBe('ok'); - expect(finalGenerateContentSpan.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(finalGenerateContentSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); expect(finalGenerateContentSpan.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]?.value).toBe(15); expect(finalGenerateContentSpan.attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]?.value).toBe(25); }, @@ -486,13 +487,13 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); const invokeAgents = container.items.filter( - span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.invoke_agent', ); const generateContents = container.items.filter( - span => span.attributes['sentry.op']?.value === 'gen_ai.generate_content', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.generate_content', ); // Two concurrent operations -> two invoke_agent + two generate_content spans. @@ -536,10 +537,10 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe .expect({ span: container => { const invokeAgents = container.items.filter( - span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.invoke_agent', ); const generateContents = container.items.filter( - span => span.attributes['sentry.op']?.value === 'gen_ai.generate_content', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.generate_content', ); // Two concurrent operations -> two invoke_agent + two generate_content spans. @@ -581,16 +582,16 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); const invokeAgent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.invoke_agent', )!; expect(invokeAgent).toBeDefined(); expect(invokeAgent.attributes['vercel.ai.operationId']?.value).toBe('ai.streamText'); const generateContent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.generate_content', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.generate_content', )!; expect(generateContent).toBeDefined(); expect(generateContent.parent_span_id).toBe(invokeAgent.span_id); @@ -639,7 +640,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe .expect({ span: container => { const invokeAgent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.invoke_agent', )!; expect(invokeAgent).toBeDefined(); expect(invokeAgent.status).toBe('ok'); @@ -650,7 +651,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(invokeAgent.attributes[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]?.value).toBe(70); const generateContents = container.items.filter( - span => span.attributes['sentry.op']?.value === 'gen_ai.generate_content', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.generate_content', ); expect(generateContents).toHaveLength(2); generateContents.forEach(span => expect(span.parent_span_id).toBe(invokeAgent.span_id)); @@ -705,7 +706,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe .expect({ span: container => { const invokeAgent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.invoke_agent', )!; expect(invokeAgent).toBeDefined(); expect(invokeAgent.status).toBe('ok'); @@ -713,7 +714,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(invokeAgent.attributes[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]?.value).toBe(30); const generateContent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.generate_content', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.generate_content', )!; expect(generateContent).toBeDefined(); expect(generateContent.parent_span_id).toBe(invokeAgent.span_id); @@ -750,18 +751,18 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); // The model throws, so the operation rejects. The spans must still be *finished* (and // therefore present in the transaction) with an error status — not left open. const invokeAgent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.invoke_agent', )!; expect(invokeAgent).toBeDefined(); expect(invokeAgent.status).toBe('error'); const generateContent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.generate_content', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.generate_content', )!; expect(generateContent).toBeDefined(); expect(generateContent.status).toBe('error'); @@ -790,10 +791,10 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); const generateContent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.generate_content', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.generate_content', )!; expect(generateContent).toBeDefined(); @@ -805,7 +806,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(generateContent.attributes[GEN_AI_CONVERSATION_ID_ATTRIBUTE]?.value).toBe('resp_abc123'); const invokeAgent = container.items.find( - span => span.attributes['sentry.op']?.value === 'gen_ai.invoke_agent', + span => span.attributes[SENTRY_OP]?.value === 'gen_ai.invoke_agent', )!; expect(invokeAgent).toBeDefined(); @@ -847,7 +848,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); const embedSpan = container.items.find( @@ -856,7 +857,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(embedSpan).toBeDefined(); expect(embedSpan.name).toBe('embeddings mock-model-id'); expect(embedSpan.status).toBe('ok'); - expect(embedSpan.attributes['sentry.op']?.value).toBe('gen_ai.embeddings'); + expect(embedSpan.attributes[SENTRY_OP]?.value).toBe('gen_ai.embeddings'); expect(embedSpan.attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE]?.value).toBe('mock-model-id'); expect(embedSpan.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]?.value).toBe(10); @@ -867,7 +868,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe expect(embedManySpan).toBeDefined(); expect(embedManySpan!.name).toBe('embeddings mock-model-id'); expect(embedManySpan!.status).toBe('ok'); - expect(embedManySpan!.attributes['sentry.op']?.value).toBe('gen_ai.embeddings'); + expect(embedManySpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.embeddings'); expect(embedManySpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]?.value).toBe(20); } else { expect(embedManySpan).toBeUndefined(); @@ -901,13 +902,13 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe span: container => { // Every emitted gen_ai span carries the version-appropriate origin. container.items - .filter(s => String(s.attributes['sentry.op']?.value ?? '').startsWith('gen_ai.')) + .filter(s => String(s.attributes[SENTRY_OP]?.value ?? '').startsWith('gen_ai.')) .forEach(s => expect(s.attributes['sentry.origin']?.value).toBe(expectedOrigin)); const invokeAgentSpan = container.items.find(span => span.name === 'invoke_agent'); expect(invokeAgentSpan).toBeDefined(); expect(invokeAgentSpan!.status).toBe('ok'); - expect(invokeAgentSpan!.attributes['sentry.op']?.value).toBe('gen_ai.invoke_agent'); + expect(invokeAgentSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); expect(invokeAgentSpan!.attributes['vercel.ai.operationId']?.value).toBe('ai.generateObject'); expect(invokeAgentSpan!.attributes[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]?.value).toBe('mock-model-id'); expect(invokeAgentSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]?.value).toBe(15); @@ -917,7 +918,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe const generateContentSpan = container.items.find(span => span.name === 'generate_content mock-model-id'); expect(generateContentSpan).toBeDefined(); expect(generateContentSpan!.status).toBe('ok'); - expect(generateContentSpan!.attributes['sentry.op']?.value).toBe('gen_ai.generate_content'); + expect(generateContentSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.generate_content'); expect(generateContentSpan!.attributes['vercel.ai.operationId']?.value).toBe( 'ai.generateObject.doGenerate', ); diff --git a/dev-packages/test-utils/package.json b/dev-packages/test-utils/package.json index 4ec1db540b0f..c3b002574be2 100644 --- a/dev-packages/test-utils/package.json +++ b/dev-packages/test-utils/package.json @@ -43,6 +43,7 @@ "@playwright/test": "~1.56.0" }, "dependencies": { + "@sentry/conventions": "0.16.0", "express": "^4.21.2", "ws": "^8.20.1" }, diff --git a/dev-packages/test-utils/src/event-proxy-server.ts b/dev-packages/test-utils/src/event-proxy-server.ts index 16f080d10b77..a2940e4814cb 100644 --- a/dev-packages/test-utils/src/event-proxy-server.ts +++ b/dev-packages/test-utils/src/event-proxy-server.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; /* eslint-disable max-lines */ import type { Envelope, @@ -617,7 +618,7 @@ export function waitForStreamedSpans( * ``` */ export function getSpanOp(span: SerializedStreamedSpan): string | undefined { - return span.attributes['sentry.op']?.type === 'string' ? span.attributes['sentry.op'].value : undefined; + return span.attributes[SENTRY_OP]?.type === 'string' ? span.attributes[SENTRY_OP].value : undefined; } const TEMP_FILE_PREFIX = 'event-proxy-server-'; diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index cb157ec9007e..bbc16281ad38 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -109,7 +109,6 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, diff --git a/packages/aws-serverless/src/index.ts b/packages/aws-serverless/src/index.ts index 33de0e664080..2052b60057be 100644 --- a/packages/aws-serverless/src/index.ts +++ b/packages/aws-serverless/src/index.ts @@ -90,7 +90,6 @@ export { getAutoPerformanceIntegrations, cron, parameterize, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/browser-utils/src/metrics/inp.ts b/packages/browser-utils/src/metrics/inp.ts index 158d4b4212c2..579c30891772 100644 --- a/packages/browser-utils/src/metrics/inp.ts +++ b/packages/browser-utils/src/metrics/inp.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '@sentry/core'; import { browserPerformanceTimeOrigin, @@ -8,7 +9,6 @@ import { SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, } from '@sentry/core'; @@ -134,7 +134,7 @@ export const _onInp: InstrumentationHandlerCallback = ({ metric }) => { const name = cachedInteractionContext?.elementName || htmlTreeAsString(entry.target); const attributes: SpanAttributes = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser.inp', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `ui.interaction.${interactionType}`, + [SENTRY_OP]: `ui.interaction.${interactionType}`, [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: entry.duration, }; diff --git a/packages/browser-utils/src/metrics/webVitalSpans.ts b/packages/browser-utils/src/metrics/webVitalSpans.ts index e5e6af09355f..2f6cf9300f25 100644 --- a/packages/browser-utils/src/metrics/webVitalSpans.ts +++ b/packages/browser-utils/src/metrics/webVitalSpans.ts @@ -6,7 +6,6 @@ import { getCurrentScope, getRootSpan, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToStreamedSpanJSON, startInactiveSpan, @@ -22,7 +21,7 @@ import { isValidLcpMetric } from './lcp'; import type { WebVitalReportEvent } from './utils'; import { getBrowserPerformanceAPI, listenForWebVitalReportEvents, msToSec, supportsWebVital } from './utils'; import type { PerformanceEventTiming } from './instrument'; -import { SENTRY_SEGMENT_NAME, SENTRY_TRANSACTION } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME, SENTRY_TRANSACTION, SENTRY_OP } from '@sentry/conventions/attributes'; // Locally-defined interfaces to avoid leaking bare global type references into the // generated .d.ts. The `declare global` augmentations in web-vitals/types.ts make these @@ -77,7 +76,7 @@ export function _emitWebVitalSpan(options: WebVitalSpanOptions): void { const attributes: SpanAttributes = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: 0, [`browser.web_vital.${metricName}.value`]: value, // oxlint-disable-next-line typescript-eslint/no-deprecated @@ -88,7 +87,7 @@ export function _emitWebVitalSpan(options: WebVitalSpanOptions): void { ...passedAttributes, }; - if (parentSpan && spanToStreamedSpanJSON(parentSpan).attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'pageload') { + if (parentSpan && spanToStreamedSpanJSON(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/test/browser/browserMetrics.test.ts b/packages/browser-utils/test/browser/browserMetrics.test.ts index 8acb93833c2a..9cb5b929d58f 100644 --- a/packages/browser-utils/test/browser/browserMetrics.test.ts +++ b/packages/browser-utils/test/browser/browserMetrics.test.ts @@ -1,9 +1,9 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '@sentry/core'; import { getClient, getCurrentScope, getIsolationScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentrySpan, setCurrentClient, @@ -190,7 +190,7 @@ describe('_addMeasureSpans', () => { op: 'measure', origin: 'auto.resource.browser.metrics', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'measure', + [SENTRY_OP]: 'measure', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', }, }), @@ -462,7 +462,7 @@ describe('_addResourceSpans', () => { op: 'resource.css', origin: 'auto.resource.browser.metrics', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.css', + [SENTRY_OP]: 'resource.css', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', ['http.decoded_response_content_length']: entry.decodedBodySize, ['http.response_content_length']: entry.encodedBodySize, @@ -644,7 +644,7 @@ describe('_addResourceSpans', () => { expect(spanToJSON(spans[0]!)).toEqual( expect.objectContaining({ data: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.css', + [SENTRY_OP]: 'resource.css', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', ['http.decoded_response_content_length']: entry.decodedBodySize, ['http.response_content_length']: entry.encodedBodySize, @@ -682,7 +682,7 @@ describe('_addResourceSpans', () => { expect(spanToJSON(spans[0]!)).toEqual( expect.objectContaining({ data: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.css', + [SENTRY_OP]: 'resource.css', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'example.com', 'url.same_origin': true, @@ -735,7 +735,7 @@ describe('_addResourceSpans', () => { expect(spanToJSON(spans[0]!)).toEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'resource.css', + [SENTRY_OP]: 'resource.css', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'example.com', 'url.same_origin': true, @@ -873,7 +873,7 @@ describe('_addNavigationSpans', () => { expect.arrayContaining([ expect.objectContaining({ data: { - 'sentry.op': 'browser.domContentLoadedEvent', + [SENTRY_OP]: 'browser.domContentLoadedEvent', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', @@ -884,7 +884,7 @@ describe('_addNavigationSpans', () => { }), expect.objectContaining({ data: { - 'sentry.op': 'browser.loadEvent', + [SENTRY_OP]: 'browser.loadEvent', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', @@ -895,7 +895,7 @@ describe('_addNavigationSpans', () => { }), expect.objectContaining({ data: { - 'sentry.op': 'browser.connect', + [SENTRY_OP]: 'browser.connect', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', @@ -906,7 +906,7 @@ describe('_addNavigationSpans', () => { }), expect.objectContaining({ data: { - 'sentry.op': 'browser.TLS/SSL', + [SENTRY_OP]: 'browser.TLS/SSL', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', @@ -917,7 +917,7 @@ describe('_addNavigationSpans', () => { }), expect.objectContaining({ data: { - 'sentry.op': 'browser.cache', + [SENTRY_OP]: 'browser.cache', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', @@ -928,7 +928,7 @@ describe('_addNavigationSpans', () => { }), expect.objectContaining({ data: { - 'sentry.op': 'browser.DNS', + [SENTRY_OP]: 'browser.DNS', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', @@ -939,7 +939,7 @@ describe('_addNavigationSpans', () => { }), expect.objectContaining({ data: { - 'sentry.op': 'browser.request', + [SENTRY_OP]: 'browser.request', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', @@ -950,7 +950,7 @@ describe('_addNavigationSpans', () => { }), expect.objectContaining({ data: { - 'sentry.op': 'browser.response', + [SENTRY_OP]: 'browser.response', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', @@ -962,7 +962,7 @@ describe('_addNavigationSpans', () => { expect.objectContaining({ data: { 'http.redirect_count': 2, - 'sentry.op': 'browser.redirect', + [SENTRY_OP]: 'browser.redirect', 'sentry.origin': 'auto.ui.browser.metrics', }, description: 'https://santry.com/test', diff --git a/packages/browser-utils/test/metrics/inpt.test.ts b/packages/browser-utils/test/metrics/inpt.test.ts index f53fa40bf6da..c856d8ab943d 100644 --- a/packages/browser-utils/test/metrics/inpt.test.ts +++ b/packages/browser-utils/test/metrics/inpt.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterEach } from 'node:test'; import { describe, expect, it, vi } from 'vitest'; import { _onInp, _trackINP } from '../../src/metrics/inp'; @@ -79,7 +80,7 @@ describe('_onInp', () => { expect(startStandaloneWebVitalSpanSpy).toHaveBeenCalledWith({ attributes: { 'sentry.exclusive_time': 10, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', }, name: '', @@ -105,7 +106,7 @@ describe('_onInp', () => { expect(startStandaloneWebVitalSpanSpy).toHaveBeenCalledWith({ attributes: { 'sentry.exclusive_time': 10, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', }, name: '', @@ -136,7 +137,7 @@ describe('_onInp', () => { expect(startStandaloneWebVitalSpanSpy).toHaveBeenCalledWith({ attributes: { 'sentry.exclusive_time': 150, - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.origin': 'auto.http.browser.inp', }, name: '', // Should fall back to when element cannot be determined diff --git a/packages/browser-utils/test/metrics/webVitalSpans.test.ts b/packages/browser-utils/test/metrics/webVitalSpans.test.ts index 7995fb411c3a..bcdd51defeee 100644 --- a/packages/browser-utils/test/metrics/webVitalSpans.test.ts +++ b/packages/browser-utils/test/metrics/webVitalSpans.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { htmlTreeAsString } from '../../src/htmlTreeAsString'; @@ -76,7 +77,7 @@ describe('_emitWebVitalSpan', () => { name: 'Test Vital', attributes: { 'sentry.origin': 'auto.http.browser.lcp', - 'sentry.op': 'ui.webvital.lcp', + [SENTRY_OP]: 'ui.webvital.lcp', 'sentry.exclusive_time': 0, 'browser.web_vital.lcp.value': 100, 'sentry.transaction': 'test-transaction', @@ -97,7 +98,7 @@ describe('_emitWebVitalSpan', () => { it('includes pageload span id when parentSpan is a pageload span', () => { const mockPageloadSpan = createMockPageloadSpan('abc123'); vi.mocked(SentryCore.spanToStreamedSpanJSON).mockReturnValue({ - attributes: { 'sentry.op': 'pageload' }, + attributes: { [SENTRY_OP]: 'pageload' }, } as any); _emitWebVitalSpan({ @@ -123,7 +124,7 @@ describe('_emitWebVitalSpan', () => { it('does not include pageload span id when parentSpan is not a pageload span', () => { const mockNonPageloadSpan = createMockPageloadSpan('xyz789'); vi.mocked(SentryCore.spanToStreamedSpanJSON).mockReturnValue({ - attributes: { 'sentry.op': 'ui.interaction.click' }, + attributes: { [SENTRY_OP]: 'ui.interaction.click' }, } as any); _emitWebVitalSpan({ @@ -218,7 +219,7 @@ describe('_sendLcpSpan', () => { vi.mocked(htmlTreeAsString).mockImplementation((node: any) => `<${node?.tagName || 'div'}>`); vi.mocked(SentryCore.startInactiveSpan).mockReturnValue(mockSpan as any); vi.mocked(SentryCore.spanToStreamedSpanJSON).mockReturnValue({ - attributes: { 'sentry.op': 'pageload' }, + attributes: { [SENTRY_OP]: 'pageload' }, } as any); }); @@ -246,7 +247,7 @@ describe('_sendLcpSpan', () => { name: '', attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.browser.lcp', - 'sentry.op': 'ui.webvital.lcp', + [SENTRY_OP]: 'ui.webvital.lcp', 'sentry.exclusive_time': 0, 'sentry.pageload.span_id': 'pageload-123', 'browser.web_vital.lcp.element': '', @@ -305,7 +306,7 @@ describe('_sendClsSpan', () => { vi.mocked(htmlTreeAsString).mockImplementation((node: any) => `<${node?.tagName || 'div'}>`); vi.mocked(SentryCore.startInactiveSpan).mockReturnValue(mockSpan as any); vi.mocked(SentryCore.spanToStreamedSpanJSON).mockReturnValue({ - attributes: { 'sentry.op': 'pageload' }, + attributes: { [SENTRY_OP]: 'pageload' }, } as any); }); @@ -344,7 +345,7 @@ describe('_sendClsSpan', () => { name: '
', attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.browser.cls', - 'sentry.op': 'ui.webvital.cls', + [SENTRY_OP]: 'ui.webvital.cls', 'sentry.pageload.span_id': 'pageload-789', 'browser.web_vital.cls.source.1': '
', 'browser.web_vital.cls.source.2': '', @@ -414,7 +415,7 @@ describe('_sendInpSpan', () => { startTime: 1.5, attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.browser.inp', - 'sentry.op': 'ui.interaction.click', + [SENTRY_OP]: 'ui.interaction.click', 'sentry.exclusive_time': 120, 'sentry.transaction': 'test-route', 'sentry.segment.name': 'test-route', @@ -442,7 +443,7 @@ describe('_sendInpSpan', () => { expect(SentryCore.startInactiveSpan).toHaveBeenCalledWith( expect.objectContaining({ attributes: expect.objectContaining({ - 'sentry.op': 'ui.interaction.press', + [SENTRY_OP]: 'ui.interaction.press', }), }), ); @@ -452,7 +453,7 @@ describe('_sendInpSpan', () => { const mockRootSpan = createMockPageloadSpan('span-42'); vi.mocked(SentryCore.spanToStreamedSpanJSON).mockReturnValue({ name: 'cached-route', - attributes: { 'sentry.op': 'navigation' }, + attributes: { [SENTRY_OP]: 'navigation' }, } as any); vi.spyOn(inpModule, 'getCachedInteractionContext').mockReturnValue({ elementName: 'body > CachedButton', diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index d1e9d7662db3..1aa954439b5c 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -77,7 +77,6 @@ export { } from '@sentry/core/browser'; export { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/browser/src/integrations/fetchStreamPerformance.ts b/packages/browser/src/integrations/fetchStreamPerformance.ts index 6481e2783b7c..49c0cd9eac0d 100644 --- a/packages/browser/src/integrations/fetchStreamPerformance.ts +++ b/packages/browser/src/integrations/fetchStreamPerformance.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { IntegrationFn, Span } from '@sentry/core'; import { addFetchEndInstrumentationHandler, @@ -5,7 +6,6 @@ import { defineIntegration, getSanitizedUrlStringFromUrlObject, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, stripDataUrlContent, @@ -83,7 +83,7 @@ export const fetchStreamPerformanceIntegration = defineIntegration(() => { url: stripDataUrlContent(url), 'http.method': method, type: 'fetch', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client.stream', + [SENTRY_OP]: 'http.client.stream', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser.stream', }, }); diff --git a/packages/browser/src/integrations/graphqlClient.ts b/packages/browser/src/integrations/graphqlClient.ts index 71c05d8381a3..0df8c2068782 100644 --- a/packages/browser/src/integrations/graphqlClient.ts +++ b/packages/browser/src/integrations/graphqlClient.ts @@ -4,13 +4,12 @@ import { isObjectLike, isString, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, - SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON, stringMatchesSomePattern, } from '@sentry/core/browser'; import type { FetchHint, XhrHint } from '@sentry/browser-utils'; import { getBodyString, getFetchRequestArgBody, SENTRY_XHR_DATA_KEY } from '@sentry/browser-utils'; -import { GRAPHQL_DOCUMENT, URL_FULL } from '@sentry/conventions/attributes'; +import { GRAPHQL_DOCUMENT, URL_FULL, SENTRY_OP } from '@sentry/conventions/attributes'; interface GraphQLClientOptions { endpoints: Array; @@ -60,7 +59,7 @@ function _updateSpanWithGraphQLData(client: Client, options: GraphQLClientOption const spanJSON = spanToJSON(span); const spanAttributes = spanJSON.data || {}; - const spanOp = spanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]; + const spanOp = spanAttributes[SENTRY_OP]; const isHttpClientSpan = spanOp === 'http.client'; diff --git a/packages/browser/src/integrations/httpcontext.ts b/packages/browser/src/integrations/httpcontext.ts index 92234b2e9631..da8ff52b468e 100644 --- a/packages/browser/src/integrations/httpcontext.ts +++ b/packages/browser/src/integrations/httpcontext.ts @@ -1,6 +1,6 @@ -import { defineIntegration, safeSetSpanJSONAttributes, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core/browser'; +import { defineIntegration, safeSetSpanJSONAttributes } from '@sentry/core/browser'; import { getHttpRequestData, WINDOW } from '../helpers'; -import { URL_FULL } from '@sentry/conventions/attributes'; +import { URL_FULL, SENTRY_OP } from '@sentry/conventions/attributes'; /** * Collects information about HTTP request headers and @@ -28,7 +28,7 @@ export const httpContextIntegration = defineIntegration(() => { }; }, processSegmentSpan(span) { - const spanOp = span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]; + const spanOp = span.attributes?.[SENTRY_OP]; // if none of the information we want exists, don't bother if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) { diff --git a/packages/browser/src/tracing/request.ts b/packages/browser/src/tracing/request.ts index 1c33ceb1f8af..afd946fbb437 100644 --- a/packages/browser/src/tracing/request.ts +++ b/packages/browser/src/tracing/request.ts @@ -18,7 +18,6 @@ import { hasSpanStreamingEnabled, instrumentFetchRequest, parseUrl, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, setHttpStatus, @@ -40,7 +39,7 @@ import { } from '@sentry/browser-utils'; import type { BrowserClient } from '../client'; import { baggageHeaderHasSentryValues, createHeadersSafely, getFullURL, isPerformanceResourceTiming } from './utils'; -import { HTTP_URL, URL_FULL } from '@sentry/conventions/attributes'; +import { HTTP_URL, URL_FULL, SENTRY_OP } from '@sentry/conventions/attributes'; /** Options for Request Instrumentation */ export interface RequestInstrumentationOptions { @@ -398,7 +397,7 @@ function xhrCallback( [URL_FULL]: sanitizedFullUrl, 'server.address': parsedUrl?.host, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client', + [SENTRY_OP]: 'http.client', ...(parsedUrl?.search && { 'http.query': parsedUrl?.search }), ...(parsedUrl?.hash && { 'http.fragment': parsedUrl?.hash }), }, diff --git a/packages/browser/test/integrations/httpcontext.test.ts b/packages/browser/test/integrations/httpcontext.test.ts index ea000bb781fc..1c349541a6c5 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 { StreamedSpanJSON } from '@sentry/core'; import { getDefaultBrowserClientOptions } from '../helper/browser-client-options'; import { BrowserClient } from '../../src/client'; @@ -25,7 +26,7 @@ describe('httpContextIntegration', () => { const span: Partial = { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client', + [SENTRY_OP]: 'http.client', }, }; @@ -35,7 +36,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', 'http.request.header.user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', @@ -47,7 +48,7 @@ describe('httpContextIntegration', () => { const span: Partial = { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', }, }; @@ -56,7 +57,7 @@ describe('httpContextIntegration', () => { integration.processSegmentSpan!(span as StreamedSpanJSON, browserClient); expect(span.attributes).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', 'http.request.header.referer': 'https://example.com', 'http.request.header.user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', diff --git a/packages/browser/test/tracing/browserTracingIntegration.test.ts b/packages/browser/test/tracing/browserTracingIntegration.test.ts index 7cfe1f726913..81a963f96d2f 100644 --- a/packages/browser/test/tracing/browserTracingIntegration.test.ts +++ b/packages/browser/test/tracing/browserTracingIntegration.test.ts @@ -8,7 +8,6 @@ import { getCurrentScope, getDynamicSamplingContextFromSpan, getIsolationScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -33,7 +32,7 @@ import { } from '../../src/tracing/browserTracingIntegration'; import { PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE } from '../../src/tracing/linkedTraces'; import { getDefaultBrowserClientOptions } from '../helper/browser-client-options'; -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; const oldTextEncoder = global.window.TextEncoder; const oldTextDecoder = global.window.TextDecoder; @@ -177,7 +176,7 @@ describe('browserTracingIntegration', () => { op: 'pageload', origin: 'auto.pageload.browser', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', @@ -263,7 +262,7 @@ describe('browserTracingIntegration', () => { op: 'pageload', origin: 'auto.pageload.browser', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', @@ -293,7 +292,7 @@ describe('browserTracingIntegration', () => { op: 'navigation', origin: 'auto.navigation.browser', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', @@ -334,7 +333,7 @@ describe('browserTracingIntegration', () => { op: 'navigation', origin: 'auto.navigation.browser', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', @@ -377,7 +376,7 @@ describe('browserTracingIntegration', () => { op: 'pageload', origin: 'auto.pageload.browser', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', @@ -408,7 +407,7 @@ describe('browserTracingIntegration', () => { expect(getSpanDescendants(span).map(span => spanToJSON(span))).toContainEqual( expect.objectContaining({ data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation.redirect', + [SENTRY_OP]: 'navigation.redirect', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [URL_FULL]: 'https://example.com/test', @@ -471,7 +470,7 @@ describe('browserTracingIntegration', () => { op: 'pageload', origin: 'manual', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', @@ -509,7 +508,7 @@ describe('browserTracingIntegration', () => { op: 'pageload', origin: 'auto.test', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', @@ -751,7 +750,7 @@ describe('browserTracingIntegration', () => { op: 'navigation', origin: 'manual', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', @@ -806,7 +805,7 @@ describe('browserTracingIntegration', () => { op: 'navigation', origin: 'auto.test', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index 4a6c25eed27d..6e8faec5c7e6 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -112,7 +112,6 @@ export { getAutoPerformanceIntegrations, cron, parameterize, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/cloudflare/package.json b/packages/cloudflare/package.json index d4dc35e6fbdd..b16ebe0234b1 100644 --- a/packages/cloudflare/package.json +++ b/packages/cloudflare/package.json @@ -63,6 +63,7 @@ }, "dependencies": { "@opentelemetry/api": "^1.9.1", + "@sentry/conventions": "^0.16.0", "@sentry/core": "10.67.0", "@sentry/server-utils": "10.67.0", "magic-string": "~0.30.21" diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index 89e3f251d414..e886a4eaede2 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -92,7 +92,6 @@ export { instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts index a99b81c6c341..d25c32adba2a 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts @@ -1,8 +1,8 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { ExportedHandler, MessageBatch } from '@cloudflare/workers-types'; import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers'; import { captureException, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, @@ -46,7 +46,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_OP]: 'queue.process', + [SENTRY_OP]: 'queue.process', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', }, diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts b/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts index 40b9f404e3bc..35f6d70e3819 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { MessageSendRequest, Queue, QueueSendBatchOptions, QueueSendOptions } from '@cloudflare/workers-types'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; const ORIGIN = 'auto.faas.cloudflare.queue'; @@ -24,7 +25,7 @@ function startPublishSpan( 'messaging.operation.name': 'send', ...(messageCount !== undefined && { 'messaging.batch.message_count': messageCount }), 'messaging.message.body.size': bodySize, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'queue.publish', + [SENTRY_OP]: 'queue.publish', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, }, }, diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts b/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts index d452dfd073ef..ee59f1c1c322 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { R2Bucket, R2ListOptions, R2MultipartUpload } from '@cloudflare/workers-types'; -import { isObjectLike, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { isObjectLike, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; const ORIGIN = 'auto.faas.cloudflare.r2'; @@ -46,7 +47,7 @@ function createSpanOptions(bindingName: string, r2Op: R2OperationKey, key?: stri ...(requestKey !== undefined && { 'cloudflare.r2.request.key': requestKey }), ...(isR2ListOptions(key) && key.prefix !== undefined && { 'cloudflare.r2.request.prefix': key.prefix }), ...(isR2ListOptions(key) && key.delimiter !== undefined && { 'cloudflare.r2.request.delimiter': key.delimiter }), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, }, }; diff --git a/packages/cloudflare/src/request.ts b/packages/cloudflare/src/request.ts index 2adf4cbf2c24..bf40590ca522 100644 --- a/packages/cloudflare/src/request.ts +++ b/packages/cloudflare/src/request.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types'; import { captureException, @@ -6,7 +7,6 @@ import { getHttpSpanDetailsFromUrlObject, httpHeadersToSpanAttributes, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_OP, setHttpStatus, startSpanManual, winterCGHeadersToDict, @@ -85,7 +85,7 @@ export function wrapRequestHandler( ), ); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = 'http.server'; + attributes[SENTRY_OP] = 'http.server'; addCloudResourceContext(isolationScope); addRequest(isolationScope, request); diff --git a/packages/cloudflare/src/wrapMethodWithSentry.ts b/packages/cloudflare/src/wrapMethodWithSentry.ts index 4723887dbace..694ad481a280 100644 --- a/packages/cloudflare/src/wrapMethodWithSentry.ts +++ b/packages/cloudflare/src/wrapMethodWithSentry.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { DurableObjectStorage } from '@cloudflare/workers-types'; import type { SerializedTraceData } from '@sentry/core'; import { @@ -7,7 +8,6 @@ import { getClient, isThenable, type Scope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startNewTrace as startNewTraceCore, startSpan, @@ -189,7 +189,7 @@ export function wrapMethodWithSentry( const attributes = wrapperOptions.spanOp ? { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: wrapperOptions.spanOp, + [SENTRY_OP]: wrapperOptions.spanOp, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, } : {}; diff --git a/packages/cloudflare/test/instrumentations/worker/instrumentEmail.test.ts b/packages/cloudflare/test/instrumentations/worker/instrumentEmail.test.ts index 5deb79d7d1c1..e83f23180b5b 100644 --- a/packages/cloudflare/test/instrumentations/worker/instrumentEmail.test.ts +++ b/packages/cloudflare/test/instrumentations/worker/instrumentEmail.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; // Note: These tests run the handler in Node.js, which has some differences to the cloudflare workers runtime. // Although this is not ideal, this is the best we can do until we have a better way to test cloudflare workers. @@ -261,7 +262,7 @@ describe('instrumentEmail', () => { expect(sentryEvent.contexts?.trace).toEqual({ data: { 'sentry.origin': 'auto.faas.cloudflare.email', - 'sentry.op': 'faas.email', + [SENTRY_OP]: 'faas.email', 'faas.trigger': 'email', 'sentry.sample_rate': 1, 'sentry.source': 'task', diff --git a/packages/cloudflare/test/instrumentations/worker/instrumentQueue.test.ts b/packages/cloudflare/test/instrumentations/worker/instrumentQueue.test.ts index 999073012b92..93bd96addb6b 100644 --- a/packages/cloudflare/test/instrumentations/worker/instrumentQueue.test.ts +++ b/packages/cloudflare/test/instrumentations/worker/instrumentQueue.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; // Note: These tests run the handler in Node.js, which has some differences to the cloudflare workers runtime. // Although this is not ideal, this is the best we can do until we have a better way to test cloudflare workers. @@ -274,7 +275,7 @@ describe('instrumentQueue', () => { expect(sentryEvent.contexts?.trace).toEqual({ data: { 'sentry.origin': 'auto.faas.cloudflare.queue', - 'sentry.op': 'queue.process', + [SENTRY_OP]: 'queue.process', 'faas.trigger': 'pubsub', 'messaging.destination.name': batch.queue, 'messaging.system': 'cloudflare', diff --git a/packages/cloudflare/test/instrumentations/worker/instrumentQueueProducer.test.ts b/packages/cloudflare/test/instrumentations/worker/instrumentQueueProducer.test.ts index b094641984ce..52e7ad4b1f2f 100644 --- a/packages/cloudflare/test/instrumentations/worker/instrumentQueueProducer.test.ts +++ b/packages/cloudflare/test/instrumentations/worker/instrumentQueueProducer.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Queue } from '@cloudflare/workers-types'; import * as SentryCore from '@sentry/core'; import { beforeEach, describe, expect, test, vi } from 'vitest'; @@ -44,7 +45,7 @@ describe('instrumentQueueProducer', () => { 'messaging.operation.type': 'send', 'messaging.operation.name': 'send', 'messaging.message.body.size': 5, - 'sentry.op': 'queue.publish', + [SENTRY_OP]: 'queue.publish', 'sentry.origin': 'auto.faas.cloudflare.queue', }, }); @@ -117,7 +118,7 @@ describe('instrumentQueueProducer', () => { 'messaging.operation.name': 'send', 'messaging.batch.message_count': 2, 'messaging.message.body.size': 5, - 'sentry.op': 'queue.publish', + [SENTRY_OP]: 'queue.publish', 'sentry.origin': 'auto.faas.cloudflare.queue', }, }); diff --git a/packages/cloudflare/test/instrumentations/worker/instrumentR2.test.ts b/packages/cloudflare/test/instrumentations/worker/instrumentR2.test.ts index 73aa3d2bf72c..f7471d87b952 100644 --- a/packages/cloudflare/test/instrumentations/worker/instrumentR2.test.ts +++ b/packages/cloudflare/test/instrumentations/worker/instrumentR2.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { R2Bucket, R2MultipartUpload } from '@cloudflare/workers-types'; import * as SentryCore from '@sentry/core'; import { beforeEach, describe, expect, test, vi } from 'vitest'; @@ -86,7 +87,7 @@ describe('instrumentR2Bucket', () => { 'cloudflare.r2.operation': 'GetObject', 'cloudflare.r2.bucket': 'MY_BUCKET', 'cloudflare.r2.request.key': 'my-file.txt', - 'sentry.op': 'object.get', + [SENTRY_OP]: 'object.get', 'sentry.origin': 'auto.faas.cloudflare.r2', }), }), diff --git a/packages/cloudflare/test/instrumentations/worker/instrumentScheduled.test.ts b/packages/cloudflare/test/instrumentations/worker/instrumentScheduled.test.ts index 6b0107a68aef..fce137c74065 100644 --- a/packages/cloudflare/test/instrumentations/worker/instrumentScheduled.test.ts +++ b/packages/cloudflare/test/instrumentations/worker/instrumentScheduled.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; // Note: These tests run the handler in Node.js, which has some differences to the cloudflare workers runtime. // Although this is not ideal, this is the best we can do until we have a better way to test cloudflare workers. @@ -255,7 +256,7 @@ describe('instrumentScheduled', () => { expect(sentryEvent.contexts?.trace).toEqual({ data: { 'sentry.origin': 'auto.faas.cloudflare.scheduled', - 'sentry.op': 'faas.cron', + [SENTRY_OP]: 'faas.cron', 'faas.cron': '0 0 0 * * *', 'faas.time': expect.any(String), 'faas.trigger': 'timer', diff --git a/packages/cloudflare/test/request.test.ts b/packages/cloudflare/test/request.test.ts index 4e81bd254258..77e12c4569fd 100644 --- a/packages/cloudflare/test/request.test.ts +++ b/packages/cloudflare/test/request.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; // Note: These tests run the handler in Node.js, which has some differences to the cloudflare workers runtime. // Although this is not ideal, this is the best we can do until we have a better way to test cloudflare workers. @@ -560,7 +561,7 @@ describe('withSentry', () => { expect(sentryEvent.contexts?.trace).toEqual({ data: { 'sentry.origin': 'auto.http.cloudflare', - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', 'sentry.source': 'route', 'http.request.method': 'GET', 'url.full': 'https://example.com/', diff --git a/packages/cloudflare/test/workflow.test.ts b/packages/cloudflare/test/workflow.test.ts index a424dbcd956b..ff790a4f15b4 100644 --- a/packages/cloudflare/test/workflow.test.ts +++ b/packages/cloudflare/test/workflow.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; /* eslint-disable @typescript-eslint/unbound-method */ import { startSpan } from '@sentry/core'; import type { WorkflowEvent, WorkflowStep, WorkflowStepConfig } from 'cloudflare:workers'; @@ -158,7 +159,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { trace_id: TRACE_ID, data: expect.objectContaining({ 'sentry.origin': 'auto.faas.cloudflare.workflow', - 'sentry.op': 'function.step.do', + [SENTRY_OP]: 'function.step.do', 'sentry.source': 'task', 'sentry.sample_rate': 1, }), @@ -275,7 +276,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { trace_id: '0d2b6d1743ce6d53af4f5ee416ad5d1b', data: expect.objectContaining({ 'sentry.origin': 'auto.faas.cloudflare.workflow', - 'sentry.op': 'function.step.do', + [SENTRY_OP]: 'function.step.do', 'sentry.source': 'task', 'sentry.sample_rate': 1, }), @@ -352,7 +353,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { trace_id: TRACE_ID, data: expect.objectContaining({ 'sentry.origin': 'auto.faas.cloudflare.workflow', - 'sentry.op': 'function.step.do', + [SENTRY_OP]: 'function.step.do', 'sentry.source': 'task', 'sentry.sample_rate': 1, }), @@ -395,7 +396,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { trace_id: TRACE_ID, data: expect.objectContaining({ 'sentry.origin': 'auto.faas.cloudflare.workflow', - 'sentry.op': 'function.step.do', + [SENTRY_OP]: 'function.step.do', 'sentry.source': 'task', 'sentry.sample_rate': 1, }), diff --git a/packages/core/src/fetch.ts b/packages/core/src/fetch.ts index 7887de49c687..93dddda2bc22 100644 --- a/packages/core/src/fetch.ts +++ b/packages/core/src/fetch.ts @@ -1,6 +1,6 @@ -import { HTTP_URL, URL_FULL } from '@sentry/conventions/attributes'; +import { HTTP_URL, URL_FULL, SENTRY_OP } from '@sentry/conventions/attributes'; import { getClient } from './currentScopes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; import { setHttpStatus, SPAN_STATUS_ERROR, spanIsIgnored, startInactiveSpan } from './tracing'; import { SentryNonRecordingSpan } from './tracing/sentryNonRecordingSpan'; import { hasSpanStreamingEnabled } from './tracing/spans/hasSpanStreamingEnabled'; @@ -389,7 +389,7 @@ function getFetchSpanAttributes( type: 'fetch', 'http.method': method, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client', + [SENTRY_OP]: 'http.client', }; if (parsedUrl) { if (!isURLObjectRelative(parsedUrl)) { diff --git a/packages/core/src/integrations/express/patch-layer.ts b/packages/core/src/integrations/express/patch-layer.ts index 6a026afa67f8..e786123b2f3f 100644 --- a/packages/core/src/integrations/express/patch-layer.ts +++ b/packages/core/src/integrations/express/patch-layer.ts @@ -27,8 +27,9 @@ * limitations under the License. */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { DEBUG_BUILD } from '../../debug-build'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { SPAN_STATUS_ERROR, startSpanManual, withActiveSpan } from '../../tracing'; import { debug } from '../../utils/debug-logger'; import type { SpanAttributes } from '../../types/span'; @@ -122,7 +123,7 @@ export function patchLayer( const type = metadata.attributes[ATTR_EXPRESS_TYPE]; const attributes: SpanAttributes = Object.assign(metadata.attributes, { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.express', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.express`, + [SENTRY_OP]: `${type}.express`, }); if (actualMatchedRoute) { attributes[ATTR_HTTP_ROUTE] = actualMatchedRoute; diff --git a/packages/core/src/integrations/http/get-outgoing-span-data.ts b/packages/core/src/integrations/http/get-outgoing-span-data.ts index 8092bec8c5bf..3486228be1e7 100644 --- a/packages/core/src/integrations/http/get-outgoing-span-data.ts +++ b/packages/core/src/integrations/http/get-outgoing-span-data.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '../../types/span'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../../semanticAttributes'; + import { getHttpSpanDetailsFromUrlObject, parseStringToURLObject } from '../../utils/url'; import type { HttpClientRequest, HttpIncomingMessage } from './types'; import { getRequestUrlFromClientRequest } from './get-request-url'; @@ -25,7 +26,7 @@ export function getOutgoingRequestSpanData(request: HttpClientRequest): StartSpa attributes: { // TODO(v11): Update these to the Sentry semantic attributes for urls. // https://getsentry.github.io/sentry-conventions/attributes/ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client', + [SENTRY_OP]: 'http.client', 'otel.kind': 'CLIENT', 'http.url': url, 'http.method': request.method, diff --git a/packages/core/src/integrations/http/server-subscription.ts b/packages/core/src/integrations/http/server-subscription.ts index 7517b88509c9..b1ab5ec6cb4f 100644 --- a/packages/core/src/integrations/http/server-subscription.ts +++ b/packages/core/src/integrations/http/server-subscription.ts @@ -32,16 +32,12 @@ import { recordRequestSession } from './record-request-session'; import { generateSpanId, generateTraceId } from '../../utils/propagationContext'; import { continueTrace } from '../../tracing/trace'; import { getSpanStatusFromHttpCode, SPAN_STATUS_ERROR, startSpanManual } from '../../tracing'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '../../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '../../semanticAttributes'; import { safeMathRandom } from '../../utils/randomSafeContext'; import { SPAN_KIND } from '../../spanKind'; import type { SpanAttributes } from '../../types/span'; import type { SpanStatus } from '../../types/spanStatus'; -import { HTTP_URL, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { HTTP_URL, URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; // Tree-shakable guard to remove all code related to tracing declare const __SENTRY_TRACING__: boolean; @@ -285,7 +281,7 @@ function buildServerSpanWrap( kind: SPAN_KIND.SERVER, attributes: { // Sentry-specific attributes - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.server', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', // Set http.route to the URL path as a best-effort route name. diff --git a/packages/core/src/integrations/mcp-server/spans.ts b/packages/core/src/integrations/mcp-server/spans.ts index f7e1b42325d5..d3cbad6af719 100644 --- a/packages/core/src/integrations/mcp-server/spans.ts +++ b/packages/core/src/integrations/mcp-server/spans.ts @@ -5,12 +5,9 @@ * Handles both request and notification spans with attribute extraction. */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { getClient } from '../../currentScopes'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '../../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '../../semanticAttributes'; import { startSpan } from '../../tracing'; import { buildTransportAttributes, buildTypeSpecificAttributes } from './attributeExtraction'; import { @@ -70,7 +67,7 @@ function buildSentryAttributes(type: McpSpanConfig['type']): Record const attributes: Record = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE, + [SENTRY_OP]: GEN_AI_EMBEDDINGS_OPERATION_ATTRIBUTE, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'embeddings', [GEN_AI_REQUEST_MODEL_ATTRIBUTE]: embeddingsInstance.model ?? 'unknown', }; diff --git a/packages/core/src/tracing/langchain/index.ts b/packages/core/src/tracing/langchain/index.ts index 621ae76acdd5..82af1a973cef 100644 --- a/packages/core/src/tracing/langchain/index.ts +++ b/packages/core/src/tracing/langchain/index.ts @@ -1,6 +1,7 @@ /* eslint-disable max-lines */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { captureException } from '../../exports'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { SPAN_STATUS_ERROR } from '../../tracing'; import { startSpanManual } from '../../tracing/trace'; import type { Span, SpanAttributeValue } from '../../types/span'; @@ -108,7 +109,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): attributes: { ...getAgentNameFromMetadata(metadata), ...attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', + [SENTRY_OP]: 'gen_ai.chat', }, }, span => { @@ -154,7 +155,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): attributes: { ...getAgentNameFromMetadata(metadata), ...attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', + [SENTRY_OP]: 'gen_ai.chat', }, }, span => { @@ -232,7 +233,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): op: 'gen_ai.invoke_agent', attributes: { ...attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.invoke_agent', + [SENTRY_OP]: 'gen_ai.invoke_agent', }, }, span => { @@ -307,7 +308,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): op: 'gen_ai.execute_tool', attributes: { ...attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.execute_tool', + [SENTRY_OP]: 'gen_ai.execute_tool', }, }, span => { diff --git a/packages/core/src/tracing/langgraph/index.ts b/packages/core/src/tracing/langgraph/index.ts index bcbd120b38e1..48d2f1458b2d 100644 --- a/packages/core/src/tracing/langgraph/index.ts +++ b/packages/core/src/tracing/langgraph/index.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { captureException } from '../../exports'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { SPAN_STATUS_ERROR } from '../../tracing'; import { GEN_AI_AGENT_NAME_ATTRIBUTE, @@ -53,7 +54,7 @@ export function _INTERNAL_getLangGraphCreateAgentSpanOptions(agentName?: string) } { const attributes: Record = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.create_agent', + [SENTRY_OP]: 'gen_ai.create_agent', [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'create_agent', }; @@ -158,7 +159,7 @@ export function instrumentCompiledGraphInvoke( name: 'invoke_agent', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GEN_AI_INVOKE_AGENT_OPERATION_ATTRIBUTE, + [SENTRY_OP]: GEN_AI_INVOKE_AGENT_OPERATION_ATTRIBUTE, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'invoke_agent', }, }, diff --git a/packages/core/src/tracing/langgraph/utils.ts b/packages/core/src/tracing/langgraph/utils.ts index cf37ce18056e..d3765abc4817 100644 --- a/packages/core/src/tracing/langgraph/utils.ts +++ b/packages/core/src/tracing/langgraph/utils.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { captureException } from '../../exports'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { SPAN_STATUS_ERROR } from '../../tracing'; import type { Span, SpanAttributes } from '../../types/span'; import { @@ -78,7 +79,7 @@ export function wrapToolsWithSpans(tools: unknown[], options: LangGraphOptions, apply(target, thisArg, args: unknown[]): unknown { const spanAttributes: SpanAttributes = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: GEN_AI_EXECUTE_TOOL_OPERATION_ATTRIBUTE, + [SENTRY_OP]: GEN_AI_EXECUTE_TOOL_OPERATION_ATTRIBUTE, [GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'execute_tool', [GEN_AI_TOOL_NAME_ATTRIBUTE]: toolName, [GEN_AI_TOOL_TYPE_ATTRIBUTE]: 'function', diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index 8a951d58011d..79ea92545eb2 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -1,4 +1,5 @@ /* eslint-disable max-lines */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { getClient, getCurrentScope } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; import { createSpanEnvelope } from '../envelope'; @@ -6,7 +7,6 @@ import { SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_PROFILE_ID, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '../semanticAttributes'; @@ -99,7 +99,7 @@ export class SentrySpan implements Span { this._attributes = {}; this.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op, + [SENTRY_OP]: spanContext.op, ...spanContext.attributes, }); @@ -285,7 +285,7 @@ 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, diff --git a/packages/core/src/tracing/trace.ts b/packages/core/src/tracing/trace.ts index 06f35cd4409c..8130b5caae4c 100644 --- a/packages/core/src/tracing/trace.ts +++ b/packages/core/src/tracing/trace.ts @@ -1,16 +1,13 @@ /* eslint-disable max-lines */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { getAsyncContextStrategy } from '../asyncContext'; import type { AsyncContextStrategy } from '../asyncContext/types'; import { getMainCarrier } from '../carrier'; import { getClient, getCurrentScope, getIsolationScope, withScope } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; import type { Scope } from '../scope'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '../semanticAttributes'; import type { ClientOptions } from '../types/options'; import type { SentrySpanArguments, Span, SpanTimeInput } from '../types/span'; import type { StartSpanOptions } from '../types/startSpanOptions'; @@ -663,7 +660,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/tracing/vercel-ai/index.ts b/packages/core/src/tracing/vercel-ai/index.ts index c905ac980614..fcd3bd1e8c9e 100644 --- a/packages/core/src/tracing/vercel-ai/index.ts +++ b/packages/core/src/tracing/vercel-ai/index.ts @@ -1,7 +1,8 @@ /* eslint-disable max-lines */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Client } from '../../client'; import { getClient } from '../../currentScopes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { shouldEnableTruncation } from '../ai/utils'; import type { Event } from '../../types/event'; import type { Span, SpanAttributes, SpanAttributeValue, SpanJSON, StreamedSpanJSON } from '../../types/span'; @@ -370,7 +371,7 @@ function processVercelAiStreamedSpan(span: StreamedSpanJSON): void { processVercelAiSpanAttributes(attributes); // Look up tool description from the toolDescriptionMap for execute_tool spans - if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'gen_ai.execute_tool' && span.parent_span_id) { + if (attributes[SENTRY_OP] === 'gen_ai.execute_tool' && span.parent_span_id) { const descriptions = toolDescriptionMap.get(span.parent_span_id); if (descriptions) { @@ -402,7 +403,7 @@ function renameAttributeKey(attributes: Record, oldKey: string, function processToolCallSpan(span: Span, attributes: SpanAttributes): void { span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.vercelai.otel'); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.execute_tool'); + span.setAttribute(SENTRY_OP, 'gen_ai.execute_tool'); span.setAttribute(GEN_AI_OPERATION_NAME_ATTRIBUTE, 'execute_tool'); renameAttributeKey(attributes, AI_TOOL_CALL_NAME_ATTRIBUTE, GEN_AI_TOOL_NAME_ATTRIBUTE); renameAttributeKey(attributes, AI_TOOL_CALL_ID_ATTRIBUTE, GEN_AI_TOOL_CALL_ID_ATTRIBUTE); @@ -448,9 +449,9 @@ function processGenerateSpan(span: Span, name: string, attributes: SpanAttribute // Set the op based on the operation name registry const operationName = SPAN_TO_OPERATION_NAME.get(name); if (operationName) { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, `gen_ai.${operationName}`); + span.setAttribute(SENTRY_OP, `gen_ai.${operationName}`); } else if (name.startsWith('ai.stream')) { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run'); + span.setAttribute(SENTRY_OP, 'ai.run'); } // For invoke_agent pipeline spans, use 'invoke_agent' as the description diff --git a/packages/core/src/types/span.ts b/packages/core/src/types/span.ts index 7a7cddba62fa..a31e3ded6236 100644 --- a/packages/core/src/types/span.ts +++ b/packages/core/src/types/span.ts @@ -1,3 +1,4 @@ +import type { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Attributes, RawAttributes } from '../attributes'; import type { SpanLink, SpanLinkJSON } from './link'; import type { Measurements } from './measurement'; @@ -26,7 +27,7 @@ export type SpanAttributeValue = export type SpanAttributes = Partial<{ 'sentry.origin': string; - 'sentry.op': string; + [SENTRY_OP]: string; 'sentry.source': TransactionSource; 'sentry.sample_rate': number; }> & diff --git a/packages/core/src/utils/spanUtils.ts b/packages/core/src/utils/spanUtils.ts index 1e9425567e45..5d3a92b826b7 100644 --- a/packages/core/src/utils/spanUtils.ts +++ b/packages/core/src/utils/spanUtils.ts @@ -1,4 +1,5 @@ // oxlint-disable max-lines +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { getAsyncContextStrategy } from '../asyncContext'; import type { RawAttributes } from '../attributes'; import { serializeAttributes } from '../attributes'; @@ -6,7 +7,6 @@ import { getMainCarrier } from '../carrier'; import { getCurrentScope } from '../currentScopes'; import { SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE, @@ -192,7 +192,7 @@ export function spanToJSON(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], + op: attributes[SENTRY_OP], origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined, links: convertSpanLinksForEnvelope(links), }; diff --git a/packages/core/test/lib/fetch.test.ts b/packages/core/test/lib/fetch.test.ts index 5e949439c739..60730bf8cf74 100644 --- a/packages/core/test/lib/fetch.test.ts +++ b/packages/core/test/lib/fetch.test.ts @@ -1,4 +1,4 @@ -import { URL_FULL } from '@sentry/conventions/attributes'; +import { URL_FULL, SENTRY_OP } from '@sentry/conventions/attributes'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import type { HandlerDataFetch } from '../../src'; import { _INTERNAL_getTracingHeadersForFetchRequest, instrumentFetchRequest } from '../../src/fetch'; @@ -492,7 +492,7 @@ describe('instrumentFetchRequest', () => { type: 'fetch', 'http.method': 'GET', 'sentry.origin': 'auto.http.fetch', - 'sentry.op': 'http.client', + [SENTRY_OP]: 'http.client', 'http.url': url, [URL_FULL]: url, 'server.address': 'api.example.com', diff --git a/packages/core/test/lib/integrations/express/patch-layer.test.ts b/packages/core/test/lib/integrations/express/patch-layer.test.ts index 3c44bd93836f..8cc696bb8cad 100644 --- a/packages/core/test/lib/integrations/express/patch-layer.test.ts +++ b/packages/core/test/lib/integrations/express/patch-layer.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { describe, beforeEach, it, expect, vi } from 'vitest'; import { type ExpressPatchLayerOptions, patchLayer } from '../../../../src/integrations/express/patch-layer'; import { @@ -263,7 +264,7 @@ describe('patchLayer', () => { 'express.name': 'mw', 'express.type': 'middleware', 'http.route': '/a/:boo/:car/layerPath', - 'sentry.op': 'middleware.express', + [SENTRY_OP]: 'middleware.express', 'sentry.origin': 'auto.http.express', }, description: 'mw', @@ -349,7 +350,7 @@ describe('patchLayer', () => { 'express.name': 'a/:boo/:car/layerPath', 'express.type': 'request_handler', 'http.route': '/a/:boo/:car/layerPath', - 'sentry.op': 'request_handler.express', + [SENTRY_OP]: 'request_handler.express', 'sentry.origin': 'auto.http.express', }, description: 'a/:boo/:car/layerPath', @@ -403,7 +404,7 @@ describe('patchLayer', () => { 'express.name': 'a/:boo/:car', 'express.type': 'request_handler', 'http.route': '/a/:boo/:car', - 'sentry.op': 'request_handler.express', + [SENTRY_OP]: 'request_handler.express', 'sentry.origin': 'auto.http.express', }, description: 'a/:boo/:car', @@ -414,7 +415,7 @@ describe('patchLayer', () => { 'express.name': 'a/:boo/:car', 'express.type': 'request_handler', 'http.route': '/a/:boo/:car', - 'sentry.op': 'request_handler.express', + [SENTRY_OP]: 'request_handler.express', 'sentry.origin': 'auto.http.express', }, description: 'a/:boo/:car', @@ -453,7 +454,7 @@ describe('patchLayer', () => { 'express.name': 'mw', 'express.type': 'middleware', 'http.route': '/a/b/c', - 'sentry.op': 'middleware.express', + [SENTRY_OP]: 'middleware.express', 'sentry.origin': 'auto.http.express', }, description: 'mw', @@ -493,7 +494,7 @@ describe('patchLayer', () => { data: { 'express.name': '/c', 'express.type': 'router', - 'sentry.op': 'router.express', + [SENTRY_OP]: 'router.express', 'sentry.origin': 'auto.http.express', }, description: '/c', @@ -543,7 +544,7 @@ describe('patchLayer', () => { data: { 'express.name': 'mw', 'express.type': 'middleware', - 'sentry.op': 'middleware.express', + [SENTRY_OP]: 'middleware.express', 'sentry.origin': 'auto.http.express', }, description: 'mw', @@ -593,7 +594,7 @@ describe('patchLayer', () => { data: { 'express.name': 'mw', 'express.type': 'middleware', - 'sentry.op': 'middleware.express', + [SENTRY_OP]: 'middleware.express', 'sentry.origin': 'auto.http.express', }, description: 'mw', @@ -636,7 +637,7 @@ describe('patchLayer', () => { 'express.name': 'mw', 'express.type': 'middleware', 'http.route': '/a/b/c', - 'sentry.op': 'middleware.express', + [SENTRY_OP]: 'middleware.express', 'sentry.origin': 'auto.http.express', }, description: 'mw', diff --git a/packages/core/test/lib/integrations/http/get-outgoing-span-data.test.ts b/packages/core/test/lib/integrations/http/get-outgoing-span-data.test.ts index fc2527ac7732..87992806be0a 100644 --- a/packages/core/test/lib/integrations/http/get-outgoing-span-data.test.ts +++ b/packages/core/test/lib/integrations/http/get-outgoing-span-data.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { describe, expect, it, vi } from 'vitest'; import { getOutgoingRequestSpanData, @@ -51,7 +52,7 @@ describe('getOutgoingRequestSpanData', () => { it('sets sentry.op to "http.client"', () => { const result = getOutgoingRequestSpanData(makeMockRequest()); - expect(result.attributes!['sentry.op']).toBe('http.client'); + expect(result.attributes![SENTRY_OP]).toBe('http.client'); }); it('sets otel.kind to "CLIENT"', () => { diff --git a/packages/core/test/lib/integrations/http/server-subscription.test.ts b/packages/core/test/lib/integrations/http/server-subscription.test.ts index 8c1fc3594403..d7fb56ec06a0 100644 --- a/packages/core/test/lib/integrations/http/server-subscription.test.ts +++ b/packages/core/test/lib/integrations/http/server-subscription.test.ts @@ -1,4 +1,4 @@ -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; import * as http from 'node:http'; import type { AddressInfo } from 'node:net'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -105,7 +105,7 @@ describe('getHttpServerSubscriptions', () => { 'http.status_code': 200, 'http.target': '/users/42?foo=bar', 'otel.kind': 'SERVER', - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', 'sentry.origin': 'auto.http.server', 'sentry.source': 'url', [URL_FULL]: expect.stringMatching(/\/users\/42\?foo=bar$/), diff --git a/packages/core/test/lib/integrations/mcp-server/semanticConventions.test.ts b/packages/core/test/lib/integrations/mcp-server/semanticConventions.test.ts index 06b3cef96592..755b97fb91e6 100644 --- a/packages/core/test/lib/integrations/mcp-server/semanticConventions.test.ts +++ b/packages/core/test/lib/integrations/mcp-server/semanticConventions.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import * as currentScopes from '../../../../src/currentScopes'; import { wrapMcpServerWithSentry } from '../../../../src/integrations/mcp-server'; @@ -60,7 +61,7 @@ describe('MCP Server Semantic Conventions', () => { 'network.transport': 'tcp', 'network.protocol.version': '2.0', 'mcp.request.argument.location': '"Seattle, WA"', - 'sentry.op': 'mcp.server', + [SENTRY_OP]: 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', 'sentry.source': 'route', }, @@ -92,7 +93,7 @@ describe('MCP Server Semantic Conventions', () => { 'network.transport': 'tcp', 'network.protocol.version': '2.0', 'mcp.request.argument.uri': '"file:///docs/api.md"', - 'sentry.op': 'mcp.server', + [SENTRY_OP]: 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', 'sentry.source': 'route', }, @@ -124,7 +125,7 @@ describe('MCP Server Semantic Conventions', () => { 'network.transport': 'tcp', 'network.protocol.version': '2.0', 'mcp.request.argument.name': '"analyze-code"', - 'sentry.op': 'mcp.server', + [SENTRY_OP]: 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', 'sentry.source': 'route', }, @@ -152,7 +153,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.transport': 'StreamableHTTPServerTransport', 'network.transport': 'tcp', 'network.protocol.version': '2.0', - 'sentry.op': 'mcp.notification.client_to_server', + [SENTRY_OP]: 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', 'sentry.source': 'route', }, @@ -192,7 +193,7 @@ describe('MCP Server Semantic Conventions', () => { 'network.transport': 'tcp', 'network.protocol.version': '2.0', // Sentry-specific - 'sentry.op': 'mcp.server', + [SENTRY_OP]: 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', 'sentry.source': 'route', }), @@ -229,7 +230,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.logging.logger': 'math-service', 'mcp.logging.data_type': 'string', 'mcp.logging.message': 'Addition completed: 2 + 5 = 7', - 'sentry.op': 'mcp.notification.client_to_server', + [SENTRY_OP]: 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', 'sentry.source': 'route', }, @@ -260,7 +261,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.method.name': 'notifications/cancelled', 'mcp.cancelled.request_id': 'req-123', 'mcp.cancelled.reason': 'user_requested', - 'sentry.op': 'mcp.notification.client_to_server', + [SENTRY_OP]: 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', 'sentry.source': 'route', }), @@ -294,7 +295,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.progress.total': 100, 'mcp.progress.percentage': 75, 'mcp.progress.message': 'Processing files...', - 'sentry.op': 'mcp.notification.client_to_server', + [SENTRY_OP]: 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', 'sentry.source': 'route', }), @@ -322,7 +323,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.method.name': 'notifications/resources/updated', 'mcp.resource.uri': 'file:///tmp/data.json', 'mcp.resource.protocol': 'file', - 'sentry.op': 'mcp.notification.client_to_server', + [SENTRY_OP]: 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', 'sentry.source': 'route', }), @@ -346,7 +347,7 @@ describe('MCP Server Semantic Conventions', () => { name: 'notifications/tools/list_changed', attributes: expect.objectContaining({ 'mcp.method.name': 'notifications/tools/list_changed', - 'sentry.op': 'mcp.notification.server_to_client', + [SENTRY_OP]: 'mcp.notification.server_to_client', 'sentry.origin': 'auto.mcp.notification', 'sentry.source': 'route', }), diff --git a/packages/core/test/lib/integrations/mcp-server/transportInstrumentation.test.ts b/packages/core/test/lib/integrations/mcp-server/transportInstrumentation.test.ts index ef764b86f213..68c77f12cb35 100644 --- a/packages/core/test/lib/integrations/mcp-server/transportInstrumentation.test.ts +++ b/packages/core/test/lib/integrations/mcp-server/transportInstrumentation.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import * as currentScopes from '../../../../src/currentScopes'; import { wrapMcpServerWithSentry } from '../../../../src/integrations/mcp-server'; @@ -280,7 +281,7 @@ describe('MCP Server Transport Instrumentation', () => { 'network.transport': 'pipe', // Should be pipe, not tcp 'network.protocol.version': '2.0', 'mcp.request.argument.path': '"/tmp/data.txt"', - 'sentry.op': 'mcp.server', + [SENTRY_OP]: 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', 'sentry.source': 'route', }, @@ -432,7 +433,7 @@ describe('MCP Server Transport Instrumentation', () => { 'network.transport': 'tcp', 'network.protocol.version': '2.0', 'mcp.request.argument.input': '"test"', - 'sentry.op': 'mcp.server', + [SENTRY_OP]: 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', 'sentry.source': 'route', }), diff --git a/packages/core/test/lib/tracing/spans/captureSpan.test.ts b/packages/core/test/lib/tracing/spans/captureSpan.test.ts index 28a3f0d48e0b..6c3f749ab413 100644 --- a/packages/core/test/lib/tracing/spans/captureSpan.test.ts +++ b/packages/core/test/lib/tracing/spans/captureSpan.test.ts @@ -3,7 +3,6 @@ import type { Contexts, StreamedSpanJSON } from '../../../../src'; import { captureSpan, SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, @@ -27,6 +26,7 @@ import { SENTRY_SDK_NAME, SENTRY_SDK_VERSION, SENTRY_TRACE_LIFECYCLE, + SENTRY_OP, } from '@sentry/conventions/attributes'; describe('captureSpan', () => { @@ -52,7 +52,7 @@ describe('captureSpan', () => { ip_address: '127.0.0.1', }); - const span = startInactiveSpan({ name: 'my-span', attributes: { 'sentry.op': 'http.client' } }); + const span = startInactiveSpan({ name: 'my-span', attributes: { [SENTRY_OP]: 'http.client' } }); span.end(); return span; @@ -73,7 +73,7 @@ describe('captureSpan', () => { type: 'string', value: 'stream', }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'http.client', }, @@ -157,7 +157,7 @@ describe('captureSpan', () => { ip_address: '127.0.0.1', }); - const span = startInactiveSpan({ name: 'my-span', attributes: { 'sentry.op': 'http.client' } }); + const span = startInactiveSpan({ name: 'my-span', attributes: { [SENTRY_OP]: 'http.client' } }); span.end(); return span; @@ -174,7 +174,7 @@ describe('captureSpan', () => { status: 'ok', is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'http.client', }, @@ -257,7 +257,7 @@ describe('captureSpan', () => { const span = withScope(scope => { scope.setClient(client); - const span = startInactiveSpan({ name: 'my-span', attributes: { 'sentry.op': 'http.client' } }); + const span = startInactiveSpan({ name: 'my-span', attributes: { [SENTRY_OP]: 'http.client' } }); span.end(); return span; @@ -274,7 +274,7 @@ describe('captureSpan', () => { status: 'ok', is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { + [SENTRY_OP]: { type: 'string', value: 'http.client', }, @@ -342,7 +342,7 @@ describe('captureSpan', () => { const span = withScope(scope => { scope.setClient(client); - const span = startInactiveSpan({ name: 'my-span', attributes: { 'sentry.op': 'http.client' } }); + const span = startInactiveSpan({ name: 'my-span', attributes: { [SENTRY_OP]: 'http.client' } }); span.end(); return span; }); @@ -359,7 +359,7 @@ describe('captureSpan', () => { is_segment: true, attributes: { [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'http.client' }, + [SENTRY_OP]: { type: 'string', value: 'http.client' }, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, [SENTRY_SEGMENT_NAME]: { value: 'my-span', type: 'string' }, @@ -420,7 +420,7 @@ describe('captureSpan', () => { client.on('processSpan', processSpanFn); client.on('processSegmentSpan', processSegmentSpanFn); - const span = startInactiveSpan({ name: 'my-span', attributes: { 'sentry.op': 'http.client' } }); + const span = startInactiveSpan({ name: 'my-span', attributes: { [SENTRY_OP]: 'http.client' } }); captureSpan(span, client); @@ -494,7 +494,7 @@ describe('captureSpan', () => { }), ); - const span = startInactiveSpan({ name: 'my-span', attributes: { 'sentry.op': 'http.client' } }); + const span = startInactiveSpan({ name: 'my-span', attributes: { [SENTRY_OP]: 'http.client' } }); span.end(); captureSpan(span, client); @@ -515,7 +515,7 @@ describe('captureSpan', () => { }), ); - const span = startInactiveSpan({ name: 'my-span', attributes: { 'sentry.op': 'http.client' } }); + const span = startInactiveSpan({ name: 'my-span', attributes: { [SENTRY_OP]: 'http.client' } }); span.end(); captureSpan(span, client); @@ -538,7 +538,7 @@ describe('captureSpan', () => { }), ); - const span = startInactiveSpan({ name: 'my-span', attributes: { 'sentry.op': 'http.client' } }); + const span = startInactiveSpan({ name: 'my-span', attributes: { [SENTRY_OP]: 'http.client' } }); span.end(); captureSpan(span, client); diff --git a/packages/core/test/lib/tracing/trace.test.ts b/packages/core/test/lib/tracing/trace.test.ts index 47f97425af64..563b294be1b9 100644 --- a/packages/core/test/lib/tracing/trace.test.ts +++ b/packages/core/test/lib/tracing/trace.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { getCapturedScopesOnSpan, @@ -7,7 +8,6 @@ import { getMainCarrier, getTraceData, Scope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setAsyncContextStrategy, @@ -115,7 +115,7 @@ 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 { @@ -161,7 +161,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(); }); }); diff --git a/packages/core/test/lib/utils/envelope.test.ts b/packages/core/test/lib/utils/envelope.test.ts index d9e2c5dacf9b..ed199f986150 100644 --- a/packages/core/test/lib/utils/envelope.test.ts +++ b/packages/core/test/lib/utils/envelope.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, @@ -54,7 +55,7 @@ describe('envelope', () => { const expectedObj = { data: { 'sentry.origin': expect.any(String), - 'sentry.op': expect.any(String), + [SENTRY_OP]: expect.any(String), release: expect.any(String), environment: expect.any(String), transaction: expect.any(String), diff --git a/packages/core/test/lib/utils/spanUtils.test.ts b/packages/core/test/lib/utils/spanUtils.test.ts index d8b0009cffee..50a265f1b6b3 100644 --- a/packages/core/test/lib/utils/spanUtils.test.ts +++ b/packages/core/test/lib/utils/spanUtils.test.ts @@ -1,7 +1,7 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, test } from 'vitest'; import { convertSpanLinksForEnvelope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE, @@ -353,7 +353,7 @@ describe('spanToJSON', () => { start_timestamp: 123, timestamp: 456, data: { - 'sentry.op': 'test op', + [SENTRY_OP]: 'test op', 'sentry.origin': 'auto', }, }); @@ -391,7 +391,7 @@ describe('spanToJSON', () => { attributes: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', + [SENTRY_OP]: 'test op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', }, status: { code: SPAN_STATUS_ERROR, message: 'unknown_error' }, @@ -408,7 +408,7 @@ describe('spanToJSON', () => { data: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', + [SENTRY_OP]: 'test op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', }, status: 'unknown_error', @@ -479,7 +479,7 @@ describe('spanToJSON', () => { attr2: 2, attr3: true, attr4: [1, 2, 3], - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', + [SENTRY_OP]: 'test op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', }, links: [ @@ -577,7 +577,7 @@ describe('spanToJSON', () => { attributes: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', + [SENTRY_OP]: 'test op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', }, links: [ @@ -607,7 +607,7 @@ describe('spanToJSON', () => { attributes: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', + [SENTRY_OP]: 'test op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', [SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE]: 'unknown_error', }, @@ -674,7 +674,7 @@ describe('spanToJSON', () => { attr2: 2, attr3: true, attr4: [1, 2, 3], - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', + [SENTRY_OP]: 'test op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', }, links: [ @@ -703,7 +703,7 @@ describe('spanToJSON', () => { 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' }, + [SENTRY_OP]: { type: 'string', value: 'test op' }, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto' }, }, links: [ diff --git a/packages/deno/package.json b/packages/deno/package.json index 6740b465f816..49831614a854 100644 --- a/packages/deno/package.json +++ b/packages/deno/package.json @@ -28,6 +28,7 @@ ], "dependencies": { "@opentelemetry/api": "^1.9.1", + "@sentry/conventions": "^0.16.0", "@sentry/core": "10.67.0", "@sentry/server-utils": "10.67.0" }, diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index 58611921021d..2a3b52b44375 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -83,7 +83,6 @@ export { instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/deno/src/opentelemetry/tracer.ts b/packages/deno/src/opentelemetry/tracer.ts index bdd86bde6a8d..18e50ccd2d26 100644 --- a/packages/deno/src/opentelemetry/tracer.ts +++ b/packages/deno/src/opentelemetry/tracer.ts @@ -1,11 +1,7 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Context, Span, SpanOptions, Tracer, TracerProvider } from '@opentelemetry/api'; import { SpanKind, trace } from '@opentelemetry/api'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, - startSpanManual, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, startSpanManual } from '@sentry/core'; /** * Set up a mock OTEL tracer to allow inter-op with OpenTelemetry emitted spans. @@ -43,7 +39,7 @@ class SentryDenoTracer implements Tracer { attributes: { ...options?.attributes, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', - ...(op ? { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op } : {}), + ...(op ? { [SENTRY_OP]: op } : {}), 'sentry.deno_tracer': true, }, }); @@ -77,7 +73,7 @@ class SentryDenoTracer implements Tracer { attributes: { ...opts.attributes, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', - ...(op ? { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op } : {}), + ...(op ? { [SENTRY_OP]: op } : {}), 'sentry.deno_tracer': true, }, }; diff --git a/packages/deno/src/wrap-deno-request-handler.ts b/packages/deno/src/wrap-deno-request-handler.ts index f6b9ccb7de78..6182794224f1 100644 --- a/packages/deno/src/wrap-deno-request-handler.ts +++ b/packages/deno/src/wrap-deno-request-handler.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { captureException, continueTrace, @@ -5,7 +6,6 @@ import { getHttpSpanDetailsFromUrlObject, httpHeadersToSpanAttributes, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_OP, setHttpStatus, startSpanManual, winterCGHeadersToDict, @@ -74,7 +74,7 @@ export const wrapDenoRequestHandler = ( } Object.assign(attributes, httpHeadersToSpanAttributes(winterCGHeadersToDict(request.headers), dataCollection)); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = 'http.server'; + attributes[SENTRY_OP] = 'http.server'; isolationScope.setSDKProcessingMetadata({ normalizedRequest: winterCGRequestToRequestData(request), }); diff --git a/packages/elysia/src/index.ts b/packages/elysia/src/index.ts index 715c2484296e..246eb634b245 100644 --- a/packages/elysia/src/index.ts +++ b/packages/elysia/src/index.ts @@ -90,7 +90,6 @@ export { getAutoPerformanceIntegrations, cron, parameterize, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/elysia/src/withElysia.ts b/packages/elysia/src/withElysia.ts index dd03b20480fb..8f03b5e5f6d7 100644 --- a/packages/elysia/src/withElysia.ts +++ b/packages/elysia/src/withElysia.ts @@ -1,4 +1,4 @@ -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; import { captureException, @@ -7,7 +7,6 @@ import { getIsolationScope, getRootSpan, getTraceData, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, @@ -111,7 +110,7 @@ function instrumentLifecyclePhase(phaseName: string, listener: TraceListener, ro name: phaseName, parentSpan: rootSpan, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, }, }); @@ -125,7 +124,7 @@ function instrumentLifecyclePhase(phaseName: string, listener: TraceListener, ro name: handlerName, parentSpan: phaseSpan, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, }, }); diff --git a/packages/google-cloud-serverless/package.json b/packages/google-cloud-serverless/package.json index 7b05bf42a8b9..60fa1e7eaa1d 100644 --- a/packages/google-cloud-serverless/package.json +++ b/packages/google-cloud-serverless/package.json @@ -41,6 +41,7 @@ "access": "public" }, "dependencies": { + "@sentry/conventions": "^0.16.0", "@sentry/core": "10.67.0", "@sentry/node": "10.67.0" }, diff --git a/packages/google-cloud-serverless/src/index.ts b/packages/google-cloud-serverless/src/index.ts index d07490563212..1c87d8cba484 100644 --- a/packages/google-cloud-serverless/src/index.ts +++ b/packages/google-cloud-serverless/src/index.ts @@ -91,7 +91,6 @@ export { getAutoPerformanceIntegrations, cron, parameterize, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, 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 4f5fee645e1b..2852b5f88830 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Client, IntegrationFn } from '@sentry/core'; import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { startInactiveSpan } from '@sentry/node'; @@ -106,8 +107,8 @@ export function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodNa const span = startInactiveSpan({ name: `${callType} ${methodName}`, onlyIfParent: true, - op: `grpc.${serviceIdentifier}`, attributes: { + [SENTRY_OP]: `grpc.${serviceIdentifier}`, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', }, }); diff --git a/packages/hono/package.json b/packages/hono/package.json index f306fb07095f..bbda233dabf6 100644 --- a/packages/hono/package.json +++ b/packages/hono/package.json @@ -73,6 +73,7 @@ }, "dependencies": { "@opentelemetry/api": "^1.9.1", + "@sentry/conventions": "^0.16.0", "@sentry/core": "10.67.0" }, "peerDependencies": { diff --git a/packages/hono/src/shared/patchAppRequest.ts b/packages/hono/src/shared/patchAppRequest.ts index d70b379eba1e..14c0cc46df9c 100644 --- a/packages/hono/src/shared/patchAppRequest.ts +++ b/packages/hono/src/shared/patchAppRequest.ts @@ -1,8 +1,8 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { debug, getActiveSpan, getOriginalFunction, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, type WrappedFunction, @@ -56,7 +56,7 @@ export function patchAppRequest(app: Hono): void { op: INTERNAL_REQUEST_OP, onlyIfParent: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: INTERNAL_REQUEST_OP, + [SENTRY_OP]: INTERNAL_REQUEST_OP, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, }, }, diff --git a/packages/hono/src/shared/wrapMiddlewareSpan.ts b/packages/hono/src/shared/wrapMiddlewareSpan.ts index 8c2e4787314b..47a360be0f3f 100644 --- a/packages/hono/src/shared/wrapMiddlewareSpan.ts +++ b/packages/hono/src/shared/wrapMiddlewareSpan.ts @@ -1,8 +1,8 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { getActiveSpan, getOriginalFunction, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, @@ -35,7 +35,7 @@ export function wrapMiddlewareWithSpan(handler: MiddlewareHandler): MiddlewareHa onlyIfParent: true, parentSpan: rootSpan, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.hono', + [SENTRY_OP]: 'middleware.hono', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: MIDDLEWARE_ORIGIN, }, }); diff --git a/packages/hono/test/shared/applyPatches.test.ts b/packages/hono/test/shared/applyPatches.test.ts index 51a68859e614..e544d20e30fb 100644 --- a/packages/hono/test/shared/applyPatches.test.ts +++ b/packages/hono/test/shared/applyPatches.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; import { Hono } from 'hono'; import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -585,7 +586,7 @@ describe('applyPatches', () => { name: 'GET /hello', op: 'hono.request', attributes: expect.objectContaining({ - 'sentry.op': 'hono.request', + [SENTRY_OP]: 'hono.request', 'sentry.origin': 'auto.http.hono.internal_request', }), }), diff --git a/packages/hono/test/shared/patchAppRequest.test.ts b/packages/hono/test/shared/patchAppRequest.test.ts index 81fef4c52ace..a73e4cbdf9b6 100644 --- a/packages/hono/test/shared/patchAppRequest.test.ts +++ b/packages/hono/test/shared/patchAppRequest.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; import { Hono } from 'hono'; import { beforeEach, describe, expect, it, vi } from 'vitest'; @@ -35,7 +36,7 @@ describe('patchAppRequest', () => { op: 'hono.request', onlyIfParent: true, attributes: expect.objectContaining({ - 'sentry.op': 'hono.request', + [SENTRY_OP]: 'hono.request', 'sentry.origin': 'auto.http.hono.internal_request', }), }), diff --git a/packages/hono/test/shared/patchAppUse.test.ts b/packages/hono/test/shared/patchAppUse.test.ts index dca53be16040..3a62dc41a84d 100644 --- a/packages/hono/test/shared/patchAppUse.test.ts +++ b/packages/hono/test/shared/patchAppUse.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; import { Hono } from 'hono'; import { beforeEach, describe, expect, it, vi } from 'vitest'; @@ -42,7 +43,7 @@ describe('patchAppUse (middleware spans)', () => { op: 'middleware.hono', onlyIfParent: true, attributes: expect.objectContaining({ - 'sentry.op': 'middleware.hono', + [SENTRY_OP]: 'middleware.hono', 'sentry.origin': 'auto.middleware.hono', }), }), @@ -229,7 +230,7 @@ describe('patchHttpMethodHandlers (inline middleware spans on main app)', () => onlyIfParent: true, parentSpan: undefined, attributes: { - 'sentry.op': 'middleware.hono', + [SENTRY_OP]: 'middleware.hono', 'sentry.origin': 'auto.middleware.hono', }, }); diff --git a/packages/nestjs/src/decorators.ts b/packages/nestjs/src/decorators.ts index f50c3c9bcc68..002c2e6e3219 100644 --- a/packages/nestjs/src/decorators.ts +++ b/packages/nestjs/src/decorators.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { MonitorConfig } from '@sentry/core'; -import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as Sentry from '@sentry/node'; import { startSpan } from '@sentry/node'; import { isExpectedError } from './helpers'; @@ -42,7 +43,7 @@ export function SentryTraced(op: string = 'function') { name: propertyKey, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, }, }, () => { diff --git a/packages/nestjs/src/integrations/helpers.ts b/packages/nestjs/src/integrations/helpers.ts index f9ae4373c806..c2331d8ea534 100644 --- a/packages/nestjs/src/integrations/helpers.ts +++ b/packages/nestjs/src/integrations/helpers.ts @@ -1,10 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; -import { - addNonEnumerableProperty, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - withActiveSpan, -} from '@sentry/core'; +import { addNonEnumerableProperty, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, withActiveSpan } from '@sentry/core'; import { isOrchestrionInjected } from '@sentry/server-utils/orchestrion'; import type { CatchTarget, InjectableTarget, NextFunction, Observable, Subscription } from './types'; @@ -104,7 +100,7 @@ export function getMiddlewareSpanOptions( return { name: name ?? target.name ?? 'unknown', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nestjs', + [SENTRY_OP]: 'middleware.nestjs', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: middlewareOrigin(componentType), }, }; @@ -121,7 +117,7 @@ export function getEventSpanOptions(event: string): { return { name: `event ${event}`, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'event.nestjs', + [SENTRY_OP]: 'event.nestjs', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: eventOrigin(), }, forceTransaction: true, @@ -139,7 +135,7 @@ export function getBullMQProcessSpanOptions(queueName: string): { return { name: `${queueName} process`, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'queue.process', + [SENTRY_OP]: 'queue.process', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: bullmqOrigin(), 'messaging.system': 'bullmq', 'messaging.destination.name': queueName, diff --git a/packages/nestjs/test/decorators.test.ts b/packages/nestjs/test/decorators.test.ts index b5d17451a9f2..9cb0788c87bb 100644 --- a/packages/nestjs/test/decorators.test.ts +++ b/packages/nestjs/test/decorators.test.ts @@ -1,6 +1,7 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import 'reflect-metadata'; import * as core from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { 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,7 +42,7 @@ describe('SentryTraced decorator', () => { name: 'testMethod', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test-operation', + [SENTRY_OP]: 'test-operation', }, }, expect.any(Function), @@ -74,7 +75,7 @@ describe('SentryTraced decorator', () => { name: 'testDefaultOp', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', + [SENTRY_OP]: 'function', }, }, expect.any(Function), @@ -107,7 +108,7 @@ describe('SentryTraced decorator', () => { name: 'syncMethod', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'sync-operation', + [SENTRY_OP]: 'sync-operation', }, }, expect.any(Function), diff --git a/packages/nestjs/test/integrations/bullmq.test.ts b/packages/nestjs/test/integrations/bullmq.test.ts index 349a0c1b8e43..5c7469fa40a3 100644 --- a/packages/nestjs/test/integrations/bullmq.test.ts +++ b/packages/nestjs/test/integrations/bullmq.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import 'reflect-metadata'; import * as core from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -57,7 +58,7 @@ describe('BullMQInstrumentation', () => { name: 'test-queue process', forceTransaction: true, attributes: expect.objectContaining({ - 'sentry.op': 'queue.process', + [SENTRY_OP]: 'queue.process', 'sentry.origin': 'auto.queue.nestjs.bullmq', 'messaging.system': 'bullmq', 'messaging.destination.name': 'test-queue', diff --git a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts index 57bc248410b6..995ada0b8221 100644 --- a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts @@ -2,7 +2,6 @@ import type { Client, Span } from '@sentry/core'; import { browserPerformanceTimeOrigin, GLOBAL_OBJ, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; @@ -13,7 +12,7 @@ import { getAbsoluteUrl, } from '@sentry/react'; import { maybeParameterizeRoute } from './parameterization'; -import { URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; /** * Strips trailing slash from a pathname, unless it's the root path. @@ -64,7 +63,7 @@ export function appRouterInstrumentPageLoad(client: Client): void { // pageload should always start at timeOrigin (and needs to be in s, not ms) startTime: origin ? origin / 1000 : undefined, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.nextjs.app_router_instrumentation', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: parameterizedPathname ? 'route' : 'url', ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), @@ -140,7 +139,7 @@ export function appRouterInstrumentNavigation(client: Client): void { { name: pathname, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: parameterizedPathname ? 'route' : 'url', 'navigation.type': `router.${navigationType}`, @@ -247,7 +246,7 @@ function patchRouter(client: Client, router: NextRouter, currentNavigationSpanRe let transactionName = INCOMPLETE_APP_ROUTER_INSTRUMENTATION_TRANSACTION_NAME; const transactionAttributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', }; diff --git a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts index 43ae1c0fe232..68a03f86ae53 100644 --- a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts @@ -3,7 +3,6 @@ import { browserPerformanceTimeOrigin, debug, parseBaggageHeader, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, stripUrlQueryAndFragment, @@ -18,7 +17,7 @@ import type { NEXT_DATA } from 'next/dist/shared/lib/utils'; import RouterImport from 'next/router'; import type { ParsedUrlQuery } from 'querystring'; import { DEBUG_BUILD } from '../../common/debug-build'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; // next/router v10 is CJS // @@ -132,7 +131,7 @@ export function pagesRouterInstrumentPageLoad(client: Client): void { // pageload should always start at timeOrigin (and needs to be in s, not ms) startTime: origin ? origin / 1000 : undefined, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.nextjs.pages_router_instrumentation', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: route ? 'route' : 'url', ...(route && { [URL_TEMPLATE]: route }), @@ -172,7 +171,7 @@ export function pagesRouterInstrumentNavigation(client: Client): void { { name: newLocation, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.pages_router_instrumentation', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: spanSource, ...(spanSource === 'route' && { [URL_TEMPLATE]: newLocation }), diff --git a/packages/nextjs/src/common/utils/tracingUtils.ts b/packages/nextjs/src/common/utils/tracingUtils.ts index 3c559a481086..de04c907f043 100644 --- a/packages/nextjs/src/common/utils/tracingUtils.ts +++ b/packages/nextjs/src/common/utils/tracingUtils.ts @@ -1,4 +1,4 @@ -import { HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; import type { PropagationContext, Span, SpanAttributes } from '@sentry/core'; import { isObjectLike, @@ -8,7 +8,6 @@ import { getRootSpan, GLOBAL_OBJ, Scope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON, startNewTrace, } from '@sentry/core'; @@ -185,5 +184,5 @@ export function maybeEnhanceServerComponentSpanName( 'sentry.nextjs.ssr.function.type': segment === PAGE_SEGMENT ? 'Page' : 'Layout', 'sentry.nextjs.ssr.function.route': route, }); - activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'function.nextjs'); + activeSpan.setAttribute(SENTRY_OP, 'function.nextjs'); } diff --git a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts index dc5e7fb4f79b..1179635f9bfd 100644 --- a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts +++ b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { RequestEventData } from '@sentry/core'; import { captureException, @@ -8,7 +9,6 @@ import { handleCallbackErrors, propagationContextFromHeaders, Scope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCapturedScopesOnSpan, setHttpStatus, @@ -48,7 +48,7 @@ export function wrapRouteHandlerWithSentry any>( rootSpan.updateName(`${method} ${parameterizedRoute}`); rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); - rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'http.server'); + rootSpan.setAttribute(SENTRY_OP, 'http.server'); } return withIsolationScope( diff --git a/packages/nextjs/src/edge/index.ts b/packages/nextjs/src/edge/index.ts index 556a98afa439..3df19cfd2b41 100644 --- a/packages/nextjs/src/edge/index.ts +++ b/packages/nextjs/src/edge/index.ts @@ -1,6 +1,7 @@ // import/export got a false positive, and affects most of our index barrel files // can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703 /* eslint-disable import/export */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { applySdkMetadata, getGlobalScope, @@ -8,7 +9,6 @@ import { getRootSpan, GLOBAL_OBJ, registerSpanErrorInstrumentation, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, @@ -132,7 +132,7 @@ export function init(options: VercelEdgeOptions = {}): void { // Make sure middleware spans get the right op if (spanAttributes?.['next.span_type'] === 'Middleware.execute') { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'http.server.middleware'); + span.setAttribute(SENTRY_OP, 'http.server.middleware'); span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'url'); } @@ -180,7 +180,7 @@ export function init(options: VercelEdgeOptions = {}): void { span.name = name; }, setOp: op => { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = op; + attributes[SENTRY_OP] = op; }, }); }); diff --git a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts index 1aac5499130f..9fa488694018 100644 --- a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts @@ -6,7 +6,6 @@ import { handleCallbackErrors, isURLObjectRelative, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCapturedScopesOnSpan, @@ -18,7 +17,7 @@ import { import { addHeadersAsAttributes } from '../common/utils/addHeadersAsAttributes'; import { flushSafelyWithTimeout, waitUntil } from '../common/utils/responseEnd'; import type { EdgeRouteHandler } from './types'; -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; /** * Wraps a Next.js edge route handler with Sentry error and performance instrumentation. @@ -71,7 +70,7 @@ export function wrapApiHandlerWithSentry( req instanceof Request ? `${req.method} ${parameterizedRoute}` : `handler ${parameterizedRoute}`, ); rootSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_FULL]: rootSpanAttributes[URL_FULL] ?? urlAttributes[URL_FULL], [URL_PATH]: rootSpanAttributes[URL_PATH] ?? urlAttributes[URL_PATH], diff --git a/packages/nextjs/src/server/enhanceHandleRequestRootSpan.ts b/packages/nextjs/src/server/enhanceHandleRequestRootSpan.ts index d3040fa4bbb3..4f2c0d7fe78e 100644 --- a/packages/nextjs/src/server/enhanceHandleRequestRootSpan.ts +++ b/packages/nextjs/src/server/enhanceHandleRequestRootSpan.ts @@ -1,5 +1,5 @@ -import { HTTP_METHOD, HTTP_REQUEST_METHOD, HTTP_ROUTE, HTTP_TARGET } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, stripUrlQueryAndFragment } from '@sentry/core'; +import { HTTP_METHOD, HTTP_REQUEST_METHOD, HTTP_ROUTE, HTTP_TARGET, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, stripUrlQueryAndFragment } from '@sentry/core'; import { ATTR_NEXT_ROUTE, ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../common/nextSpanAttributes'; import { TRANSACTION_ATTR_SENTRY_ROUTE_BACKFILL } from '../common/span-attributes-with-logic-attached'; @@ -28,7 +28,7 @@ export function enhanceHandleRequestRootSpan(span: MutableRootSpan): void { return; } - attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = 'http.server'; + attributes[SENTRY_OP] = 'http.server'; span.setOp('http.server'); const currentName = span.getName(); diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index ee0d2346c4f2..35ba1aeb6c95 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -1,16 +1,9 @@ // import/export got a false positive, and affects most of our index barrel files // can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703 /* eslint-disable import/export */ -import { HTTP_TARGET, URL_QUERY } from '@sentry/conventions/attributes'; +import { HTTP_TARGET, URL_QUERY, SENTRY_OP } from '@sentry/conventions/attributes'; import type { EventProcessor } from '@sentry/core'; -import { - applySdkMetadata, - debug, - getClient, - getGlobalScope, - GLOBAL_OBJ, - SEMANTIC_ATTRIBUTE_SENTRY_OP, -} from '@sentry/core'; +import { applySdkMetadata, debug, getClient, getGlobalScope, GLOBAL_OBJ } from '@sentry/core'; import type { NodeClient, NodeOptions } from '@sentry/node'; import { experimentalUseDiagnosticsChannelInjection as nodeExperimentalUseDiagnosticsChannelInjection, @@ -312,10 +305,10 @@ export function init(options: NodeOptions): NodeClient | undefined { setName: (name: string) => { span.name = name; }, - // For streamed spans, op lives in `attributes['sentry.op']` - mirror it there so middleware + // For streamed spans, op lives in `attributes[SENTRY_OP]` - mirror it there so middleware // overrides land somewhere readable (the legacy path uses a separate `event.contexts.trace.op`). setOp: (op: string) => { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = op; + attributes[SENTRY_OP] = op; }, }; enhanceHandleRequestRootSpan(mutableRootSpan); diff --git a/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts b/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts index c735cacfa7f0..fc9dc48620a7 100644 --- a/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts +++ b/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts @@ -8,7 +8,7 @@ import { pagesRouterInstrumentNavigation, pagesRouterInstrumentPageLoad, } from '../../src/client/routing/pagesRouterRoutingInstrumentation'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; const globalObject = WINDOW as typeof WINDOW & { __BUILD_MANIFEST?: { @@ -126,7 +126,7 @@ describe('pagesRouterInstrumentPageLoad', () => { { name: '/[user]/posts/[id]', attributes: { - 'sentry.op': 'pageload', + [SENTRY_OP]: 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', 'sentry.source': 'route', [URL_TEMPLATE]: '/[user]/posts/[id]', @@ -150,7 +150,7 @@ describe('pagesRouterInstrumentPageLoad', () => { { name: '/some-page', attributes: { - 'sentry.op': 'pageload', + [SENTRY_OP]: 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', 'sentry.source': 'route', [URL_TEMPLATE]: '/some-page', @@ -166,7 +166,7 @@ describe('pagesRouterInstrumentPageLoad', () => { { name: '/', attributes: { - 'sentry.op': 'pageload', + [SENTRY_OP]: 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', 'sentry.source': 'route', [URL_TEMPLATE]: '/', @@ -182,7 +182,7 @@ describe('pagesRouterInstrumentPageLoad', () => { { name: '/lforst/posts/1337', attributes: { - 'sentry.op': 'pageload', + [SENTRY_OP]: 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', 'sentry.source': 'url', }, @@ -332,7 +332,7 @@ describe('pagesRouterInstrumentNavigation', () => { const expectedStartSpanOptions = { name: expectedTransactionName, attributes: { - 'sentry.op': 'navigation', + [SENTRY_OP]: 'navigation', 'sentry.origin': 'auto.navigation.nextjs.pages_router_instrumentation', 'sentry.source': expectedTransactionSource, ...(expectedTransactionSource === 'route' ? { [URL_TEMPLATE]: expectedTransactionName } : {}), diff --git a/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts b/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts index 8373c3a6e744..5fe71b86ffef 100644 --- a/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts +++ b/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts @@ -1,4 +1,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } 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'; @@ -29,7 +30,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', () => { @@ -44,7 +45,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[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('route'); expect(span.attributes[ATTR_NEXT_ROUTE]).toBe('/api/users/[id]'); @@ -139,7 +140,7 @@ describe('enhanceHandleRequestRootSpan', () => { it('writes the middleware op into attributes when the adapter mirrors op writes (streamed shape)', () => { // Mirrors the `processSegmentSpan` adapter in src/server/index.ts where `setOp` writes back - // into `attributes['sentry.op']` because that is the only op storage for streamed segment spans. + // into `attributes[SENTRY_OP]` because that is the only op storage for streamed segment spans. const attributes: Record = { [ATTR_NEXT_SPAN_TYPE]: 'BaseServer.handleRequest', [ATTR_NEXT_SPAN_NAME]: 'middleware GET /api', @@ -152,14 +153,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('http.server.middleware'); + expect(attributes[SENTRY_OP]).toBe('http.server.middleware'); }); it('rewrites GET /_error using the http.target attribute', () => { diff --git a/packages/nitro/package.json b/packages/nitro/package.json index a90e973000e4..de0fa049ee52 100644 --- a/packages/nitro/package.json +++ b/packages/nitro/package.json @@ -36,6 +36,7 @@ }, "dependencies": { "@sentry/bundler-plugins": "^10.67.0", + "@sentry/conventions": "^0.16.0", "@sentry/core": "10.67.0", "@sentry/node": "10.67.0", "@sentry/server-utils": "10.67.0" diff --git a/packages/nitro/src/runtime/hooks/captureStorageEvents.ts b/packages/nitro/src/runtime/hooks/captureStorageEvents.ts index dc5e7396a934..6b0dd95bd208 100644 --- a/packages/nitro/src/runtime/hooks/captureStorageEvents.ts +++ b/packages/nitro/src/runtime/hooks/captureStorageEvents.ts @@ -1,10 +1,10 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as dc from 'node:diagnostics_channel'; import { flushIfServerless, GLOBAL_OBJ, SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_KEY, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; @@ -68,7 +68,7 @@ function setupStorageTracingChannel(operation: TracedOperation): void { return startInactiveSpan({ name: cacheKeys.join(', ') || operation, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `cache.${normalizeMethodName(operation)}`, + [SENTRY_OP]: `cache.${normalizeMethodName(operation)}`, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, [SEMANTIC_ATTRIBUTE_CACHE_KEY]: cacheKeys.length > 1 ? cacheKeys : cacheKeys[0], 'db.operation.name': operation, diff --git a/packages/nitro/src/runtime/hooks/captureTracingEvents.ts b/packages/nitro/src/runtime/hooks/captureTracingEvents.ts index 131c9d177579..c3beaf881c8d 100644 --- a/packages/nitro/src/runtime/hooks/captureTracingEvents.ts +++ b/packages/nitro/src/runtime/hooks/captureTracingEvents.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as dc from 'node:diagnostics_channel'; import { isObjectLike, @@ -8,7 +9,6 @@ import { GLOBAL_OBJ, httpHeadersToSpanAttributes, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, @@ -105,7 +105,7 @@ function setupH3TracingChannels(): void { attributes: { ...urlAttributes, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.nitro.h3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: data?.type === 'middleware' ? 'middleware.nitro' : 'http.server', + [SENTRY_OP]: data?.type === 'middleware' ? 'middleware.nitro' : 'http.server', }, }); @@ -178,7 +178,7 @@ function setupSrvxTracingChannels(): void { ...urlAttributes, ...headerAttributes, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.nitro.srvx', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: data.middleware ? 'middleware.nitro' : 'http.server', + [SENTRY_OP]: data.middleware ? 'middleware.nitro' : 'http.server', 'server.port': data.server.options.port, }, // Use the same parent span as middleware to make them siblings @@ -217,7 +217,7 @@ function setupSrvxTracingChannels(): void { attributes: { ...urlAttributes, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.nitro.srvx', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nitro', + [SENTRY_OP]: 'middleware.nitro', }, parentSpan: requestParentSpans.get(data.request) || undefined, }); diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index cbbc614c82fe..3a207d3d7b5d 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -90,7 +90,6 @@ export { setAttributes, setUser, setConversationId, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/node/src/integrations/fs/vendored/instrumentation.ts b/packages/node/src/integrations/fs/vendored/instrumentation.ts index 8341a0f9aef4..891af4215a74 100644 --- a/packages/node/src/integrations/fs/vendored/instrumentation.ts +++ b/packages/node/src/integrations/fs/vendored/instrumentation.ts @@ -12,9 +12,9 @@ * - Completely reworked to no longer reference OpenTelemetry. */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '@sentry/core'; import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, getActiveSpan, @@ -97,7 +97,7 @@ function getSpanAttributes( config: FsInstrumentationConfig, ): SpanAttributes { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: SPAN_OP, + [SENTRY_OP]: SPAN_OP, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN, }; diff --git a/packages/node/src/integrations/http/httpServerSpansIntegration.ts b/packages/node/src/integrations/http/httpServerSpansIntegration.ts index a09a1759fd84..f09629496bf6 100644 --- a/packages/node/src/integrations/http/httpServerSpansIntegration.ts +++ b/packages/node/src/integrations/http/httpServerSpansIntegration.ts @@ -25,6 +25,7 @@ import { SENTRY_HTTP_PREFETCH, URL_FULL, URL_PATH, + SENTRY_OP, } from '@sentry/conventions/attributes'; import type { Event, @@ -43,7 +44,6 @@ import { getSpanStatusFromHttpCode, httpHeadersToSpanAttributes, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, stripUrlQueryAndFragment, @@ -171,7 +171,7 @@ const _httpServerSpansIntegration = ((options: HttpServerSpansIntegrationOptions kind: SPAN_KIND.SERVER, attributes: { // Sentry specific attributes - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.http', [SENTRY_HTTP_PREFETCH]: isKnownPrefetchRequest(request) || undefined, [URL_FULL]: fullUrl, diff --git a/packages/node/src/integrations/tracing/dataloader/vendored/instrumentation.ts b/packages/node/src/integrations/tracing/dataloader/vendored/instrumentation.ts index 9d37febcb8a1..afe603d79db8 100644 --- a/packages/node/src/integrations/tracing/dataloader/vendored/instrumentation.ts +++ b/packages/node/src/integrations/tracing/dataloader/vendored/instrumentation.ts @@ -9,15 +9,9 @@ */ import { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation'; -import { CACHE_KEY } from '@sentry/conventions/attributes'; +import { CACHE_KEY, SENTRY_OP } from '@sentry/conventions/attributes'; import type { BatchLoadFn, DataLoader, DataLoaderConstructor } from './types'; -import { - SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_KIND, - startSpan, -} from '@sentry/core'; +import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_KIND, startSpan } from '@sentry/core'; const MODULE_NAME = 'dataloader'; const PACKAGE_NAME = '@sentry/instrumentation-dataloader'; @@ -117,7 +111,7 @@ export class DataloaderInstrumentation extends InstrumentationBase { links: this._batch?.spanLinks, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('batch'), + [SENTRY_OP]: getSpanOp('batch'), [CACHE_KEY]: getCacheKey(args[0]), }, onlyIfParent: true, @@ -172,7 +166,7 @@ export class DataloaderInstrumentation extends InstrumentationBase { kind: SPAN_KIND.CLIENT, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('load'), + [SENTRY_OP]: getSpanOp('load'), [CACHE_KEY]: getCacheKey(args[0]), }, onlyIfParent: true, @@ -211,7 +205,7 @@ export class DataloaderInstrumentation extends InstrumentationBase { kind: SPAN_KIND.CLIENT, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('loadMany'), + [SENTRY_OP]: getSpanOp('loadMany'), [CACHE_KEY]: getCacheKey(args[0]), }, onlyIfParent: true, @@ -238,7 +232,7 @@ export class DataloaderInstrumentation extends InstrumentationBase { kind: SPAN_KIND.CLIENT, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('prime'), + [SENTRY_OP]: getSpanOp('prime'), }, onlyIfParent: true, }, @@ -264,7 +258,7 @@ export class DataloaderInstrumentation extends InstrumentationBase { kind: SPAN_KIND.CLIENT, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('clear'), + [SENTRY_OP]: getSpanOp('clear'), }, onlyIfParent: true, }, @@ -290,7 +284,7 @@ export class DataloaderInstrumentation extends InstrumentationBase { kind: SPAN_KIND.CLIENT, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: getSpanOp('clearAll'), + [SENTRY_OP]: getSpanOp('clearAll'), }, onlyIfParent: true, }, diff --git a/packages/node/src/integrations/tracing/fastify/v3/instrumentation.ts b/packages/node/src/integrations/tracing/fastify/v3/instrumentation.ts index d464b3d4d8cf..6715e1840609 100644 --- a/packages/node/src/integrations/tracing/fastify/v3/instrumentation.ts +++ b/packages/node/src/integrations/tracing/fastify/v3/instrumentation.ts @@ -27,16 +27,9 @@ import { InstrumentationNodeModuleDefinition, safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation'; -import { HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; -import { - getClient, - getIsolationScope, - SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - spanToJSON, -} from '@sentry/core'; +import { getClient, getIsolationScope, SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core'; import { setHttpServerSpanRouteAttribute } from '../../../../utils/setHttpServerSpanRouteAttribute'; import type { FastifyErrorCodes, @@ -312,13 +305,13 @@ function addFastifyV3SpanAttributes(span: Span): void { const type = attributes['fastify.type']; // If this is already set, or we have no fastify span, no need to process again... - if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) { + if (attributes[SENTRY_OP] || !type) { return; } span.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.fastify', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.fastify`, + [SENTRY_OP]: `${type}.fastify`, }); // Also update the name, we don't need to "middleware - " prefix diff --git a/packages/node/src/integrations/tracing/redis/cache.ts b/packages/node/src/integrations/tracing/redis/cache.ts index dcfae6bb5f42..9b56aaf5892a 100644 --- a/packages/node/src/integrations/tracing/redis/cache.ts +++ b/packages/node/src/integrations/tracing/redis/cache.ts @@ -1,9 +1,9 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, SEMANTIC_ATTRIBUTE_CACHE_KEY, - SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON, truncate, } from '@sentry/core'; @@ -92,7 +92,7 @@ export const cacheResponseHook: IORedisResponseCustomAttributeFunction = ( } span.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: cacheOperation, + [SENTRY_OP]: cacheOperation, [SEMANTIC_ATTRIBUTE_CACHE_KEY]: safeKey, }); diff --git a/packages/node/src/utils/setHttpServerSpanRouteAttribute.ts b/packages/node/src/utils/setHttpServerSpanRouteAttribute.ts index dc9219e3aae5..26b4f6c57a5d 100644 --- a/packages/node/src/utils/setHttpServerSpanRouteAttribute.ts +++ b/packages/node/src/utils/setHttpServerSpanRouteAttribute.ts @@ -1,4 +1,5 @@ -import { getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON } from '@sentry/core'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { getActiveSpan, getRootSpan, spanToJSON } from '@sentry/core'; /** * Set the `http.route` attribute on the root HTTP server span for the current trace. @@ -16,7 +17,7 @@ export function setHttpServerSpanRouteAttribute(route: string): void { if (!rootSpan) { return; } - if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'http.server') { + if (spanToJSON(rootSpan).data[SENTRY_OP] !== 'http.server') { return; } rootSpan.setAttribute('http.route', route); diff --git a/packages/node/test/integration/transactions.test.ts b/packages/node/test/integration/transactions.test.ts index cef5ac2852cf..4a2984fb3864 100644 --- a/packages/node/test/integration/transactions.test.ts +++ b/packages/node/test/integration/transactions.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { context, trace, TraceFlags } from '@opentelemetry/api'; import type { ErrorEvent, TransactionEvent } from '@sentry/core'; import { debug, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; @@ -85,7 +86,7 @@ describe('Integration | Transactions', () => { expect(transaction.contexts?.trace).toEqual({ data: { - 'sentry.op': 'test op', + [SENTRY_OP]: 'test op', 'sentry.origin': 'auto.test', 'sentry.source': 'task', 'sentry.sample_rate': 1, @@ -239,7 +240,7 @@ describe('Integration | Transactions', () => { contexts: expect.objectContaining({ trace: { data: { - 'sentry.op': 'test op', + [SENTRY_OP]: 'test op', 'sentry.origin': 'auto.test', 'sentry.source': 'task', 'test.outer': 'test value', @@ -277,7 +278,7 @@ describe('Integration | Transactions', () => { contexts: expect.objectContaining({ trace: { data: { - 'sentry.op': 'test op b', + [SENTRY_OP]: 'test op b', 'sentry.origin': 'manual', 'sentry.source': 'custom', 'test.outer': 'test value b', @@ -489,7 +490,7 @@ describe('Integration | Transactions', () => { contexts: expect.objectContaining({ trace: { data: { - 'sentry.op': 'test op', + [SENTRY_OP]: 'test op', 'sentry.origin': 'auto.test', 'sentry.source': 'task', }, diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index b8f31311f7b7..694159763baa 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -56,6 +56,7 @@ "@nuxt/kit": "^3.13.2", "@sentry/browser": "10.67.0", "@sentry/cloudflare": "10.67.0", + "@sentry/conventions": "^0.16.0", "@sentry/core": "10.67.0", "@sentry/node": "10.67.0", "@sentry/bundler-plugins": "10.67.0", diff --git a/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts b/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts index f425651cfe00..db66cce807d2 100644 --- a/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts +++ b/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts @@ -1,10 +1,10 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { captureException, debug, flushIfServerless, getClient, httpHeadersToSpanAttributes, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, @@ -164,7 +164,7 @@ function getSpanAttributes( index?: number, ): SpanAttributes { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nuxt', + [SENTRY_OP]: 'middleware.nuxt', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.middleware.nuxt', 'nuxt.middleware.name': middlewareName, diff --git a/packages/nuxt/src/runtime/utils/instrumentDatabase.ts b/packages/nuxt/src/runtime/utils/instrumentDatabase.ts index 9f7d320fe390..005708a95f67 100644 --- a/packages/nuxt/src/runtime/utils/instrumentDatabase.ts +++ b/packages/nuxt/src/runtime/utils/instrumentDatabase.ts @@ -1,9 +1,9 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { addBreadcrumb, captureException, debug, flushIfServerless, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, type Span, SPAN_STATUS_ERROR, @@ -225,7 +225,7 @@ function createStartSpanOptions(query: string, data: DatabaseSpanData): StartSpa attributes: { 'db.query.text': query, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SENTRY_ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.query', + [SENTRY_OP]: 'db.query', ...data, }, }; diff --git a/packages/nuxt/src/runtime/utils/instrumentStorage.ts b/packages/nuxt/src/runtime/utils/instrumentStorage.ts index 3e23a5087f4c..aba5bc694a77 100644 --- a/packages/nuxt/src/runtime/utils/instrumentStorage.ts +++ b/packages/nuxt/src/runtime/utils/instrumentStorage.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { isObjectLike, captureException, @@ -5,7 +6,6 @@ import { flushIfServerless, SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_KEY, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, @@ -222,7 +222,7 @@ function createSpanStartOptions( const keys = getCacheKeys(args?.[0], mountBase); const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `cache.${normalizeMethodName(methodName)}`, + [SENTRY_OP]: `cache.${normalizeMethodName(methodName)}`, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.cache.nuxt', [SEMANTIC_ATTRIBUTE_CACHE_KEY]: keys.length > 1 ? keys : keys[0], 'db.operation.name': methodName, diff --git a/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts b/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts index e84b6aeb461b..8020a16d140b 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 type { EventHandler, EventHandlerRequest, H3Event } from 'h3'; import { beforeEach, describe, expect, it, vi } from 'vitest'; @@ -177,7 +178,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'object-middleware', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nuxt', + [SENTRY_OP]: 'middleware.nuxt', 'nuxt.middleware.name': 'object-middleware', }), }), @@ -208,7 +209,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'request-middleware.onRequest', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nuxt', + [SENTRY_OP]: 'middleware.nuxt', 'nuxt.middleware.name': 'request-middleware', 'nuxt.middleware.hook.name': 'onRequest', }), @@ -295,7 +296,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'response-middleware.onBeforeResponse', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nuxt', + [SENTRY_OP]: 'middleware.nuxt', 'nuxt.middleware.name': 'response-middleware', 'nuxt.middleware.hook.name': 'onBeforeResponse', }), @@ -507,7 +508,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'v2-middleware.middleware', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nuxt', + [SENTRY_OP]: 'middleware.nuxt', 'nuxt.middleware.name': 'v2-middleware', 'nuxt.middleware.hook.name': 'middleware', 'nuxt.middleware.hook.index': 0, @@ -586,7 +587,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { expect.objectContaining({ name: 'api-middleware', attributes: expect.objectContaining({ - [SentryCore.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.nuxt', + [SENTRY_OP]: 'middleware.nuxt', 'nuxt.middleware.name': 'api-middleware', 'http.request.method': 'GET', 'http.route': '/test-path', diff --git a/packages/opentelemetry/src/applyOtelSpanData.ts b/packages/opentelemetry/src/applyOtelSpanData.ts index 94e4ea416bc3..5822a3897b35 100644 --- a/packages/opentelemetry/src/applyOtelSpanData.ts +++ b/packages/opentelemetry/src/applyOtelSpanData.ts @@ -1,11 +1,10 @@ import { SpanKind } from '@opentelemetry/api'; -import { HTTP_RESPONSE_STATUS_CODE, HTTP_STATUS_CODE } from '@sentry/conventions/attributes'; +import { HTTP_RESPONSE_STATUS_CODE, HTTP_STATUS_CODE, SENTRY_OP } from '@sentry/conventions/attributes'; import { addNonEnumerableProperty, getClient, hasSpanStreamingEnabled, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanShouldInferOtelSource, spanSourceWasExplicitlySet, @@ -21,7 +20,7 @@ type SentrySpanWithOtelKind = Span & { kind?: SpanKind }; /** * Backfill a native Sentry span with the data the OpenTelemetry SDK pipeline would otherwise derive - * from OTel semantic attributes: `sentry.op`, `sentry.source`, the span name, `otel.kind`, and status. + * from OTel semantic attributes: SENTRY_OP, `sentry.source`, the span name, `otel.kind`, and status. * * On the OTel SDK provider this happens in the `SentrySpanProcessor`/`SentrySpanExporter` while * converting `ReadableSpan`s to Sentry payloads (via `parseSpanDescription` + `mapStatus`). @@ -50,8 +49,8 @@ export function applyOtelSpanData(span: Span, options: { finalizeStatus?: boolea span.setAttribute('otel.kind', SpanKind[kind]); } - if (inferred.op && attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === undefined) { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, inferred.op); + if (inferred.op && attributes[SENTRY_OP] === undefined) { + span.setAttribute(SENTRY_OP, inferred.op); } // Don't apply 'url' source at creation time, only at span end (finalizeStatus). diff --git a/packages/opentelemetry/src/sampler.ts b/packages/opentelemetry/src/sampler.ts index 0d7b2acabad1..14d11984c03a 100644 --- a/packages/opentelemetry/src/sampler.ts +++ b/packages/opentelemetry/src/sampler.ts @@ -4,7 +4,7 @@ import { isSpanContextValid, SpanKind, trace } from '@opentelemetry/api'; import { TraceState } from './utils/TraceState'; import type { Sampler, SamplingResult } from '@opentelemetry/sdk-trace-base'; import { SamplingDecision } from '@opentelemetry/sdk-trace-base'; -import { HTTP_METHOD, HTTP_REQUEST_METHOD, HTTP_URL, URL_FULL } from '@sentry/conventions/attributes'; +import { HTTP_METHOD, HTTP_REQUEST_METHOD, HTTP_URL, URL_FULL, SENTRY_OP } from '@sentry/conventions/attributes'; import type { Client, SpanAttributes } from '@sentry/core'; import { _INTERNAL_safeMathRandom, @@ -14,7 +14,6 @@ import { hasSpanStreamingEnabled, parseSampleRate, sampleSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, shouldIgnoreSpan, } from '@sentry/core'; @@ -96,7 +95,7 @@ export class SentrySampler implements Sampler { shouldIgnoreSpan( { description: inferredChildName, - op: spanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] ?? childOp, + op: spanAttributes[SENTRY_OP] ?? childOp, attributes: spanAttributes, }, ignoreSpans, @@ -139,7 +138,7 @@ export class SentrySampler implements Sampler { }; if (op) { - mergedAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = op; + mergedAttributes[SENTRY_OP] = op; } if ( @@ -148,7 +147,7 @@ export class SentrySampler implements Sampler { shouldIgnoreSpan( { description: inferredSpanName, - op: mergedAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] ?? op, + op: mergedAttributes[SENTRY_OP] ?? op, attributes: mergedAttributes, }, ignoreSpans, diff --git a/packages/opentelemetry/src/spanExporter.ts b/packages/opentelemetry/src/spanExporter.ts index 3e72d2a1cc0f..28e37fbd2c8e 100644 --- a/packages/opentelemetry/src/spanExporter.ts +++ b/packages/opentelemetry/src/spanExporter.ts @@ -2,7 +2,7 @@ import type { Span } from '@opentelemetry/api'; import { SpanKind } from '@opentelemetry/api'; import type { ReadableSpan } from '@opentelemetry/sdk-trace-base'; -import { HTTP_RESPONSE_STATUS_CODE, HTTP_STATUS_CODE } from '@sentry/conventions/attributes'; +import { HTTP_RESPONSE_STATUS_CODE, HTTP_STATUS_CODE, SENTRY_OP } from '@sentry/conventions/attributes'; import type { SpanAttributes, SpanJSON, @@ -22,7 +22,6 @@ import { getStatusMessage, LRUMap, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -250,7 +249,7 @@ function parseSpan(span: ReadableSpan): { op?: string; origin?: SpanOrigin; sour const attributes = span.attributes; const origin = attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined; - const op = attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] as string | undefined; + const op = attributes[SENTRY_OP] as string | undefined; const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] as TransactionSource | undefined; return { origin, op, source }; @@ -266,7 +265,7 @@ export function createTransactionForOtelSpan(span: ReadableSpan): TransactionEve const attributes: SpanAttributes = { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: sampleRate, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, ...data, ...removeSentryAttributes(span.attributes), @@ -359,7 +358,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, spans: SpanJSON[], sentS const { op, description, data, origin = 'manual' } = getSpanData(span); const allData = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, ...removeSentryAttributes(attributes), ...data, }; diff --git a/packages/opentelemetry/src/trace.ts b/packages/opentelemetry/src/trace.ts index b60bda367704..6a56cf1ad5e5 100644 --- a/packages/opentelemetry/src/trace.ts +++ b/packages/opentelemetry/src/trace.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Context, Span, SpanContext, SpanOptions, TimeInput, Tracer } from '@opentelemetry/api'; import { context, SpanStatusCode, trace, TraceFlags } from '@opentelemetry/api'; import { isTracingSuppressed, suppressTracing } from '@opentelemetry/core'; @@ -22,7 +23,6 @@ import { handleCallbackErrors, hasSpansEnabled, SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON, spanToTraceContext, } from '@sentry/core'; @@ -202,7 +202,7 @@ function getSpanOptions(options: OpenTelemetrySpanContext): SpanOptions { return { attributes: op ? { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, ...attributes, } : attributes, diff --git a/packages/opentelemetry/src/utils/backfillStreamedSpanData.ts b/packages/opentelemetry/src/utils/backfillStreamedSpanData.ts index dc215d95e7db..87437bf2f516 100644 --- a/packages/opentelemetry/src/utils/backfillStreamedSpanData.ts +++ b/packages/opentelemetry/src/utils/backfillStreamedSpanData.ts @@ -1,13 +1,7 @@ import type { SpanAttributes, StreamedSpanJSON } from '@sentry/core'; -import { - safeSetSpanJSONAttributes, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - SPAN_KIND, - spanKindToName, -} from '@sentry/core'; +import { safeSetSpanJSONAttributes, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_KIND, spanKindToName } from '@sentry/core'; import { inferSpanData } from './parseSpanDescription'; -import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { SENTRY_ORIGIN, SENTRY_OP } from '@sentry/conventions/attributes'; /** * Backfill op, source, name and data on a streamed span JSON from OTel semantic conventions. @@ -29,7 +23,7 @@ export function backfillStreamedSpanDataFromOtel(spanJSON: StreamedSpanJSON, hin spanJSON.name = description; safeSetSpanJSONAttributes(spanJSON, { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, // If nothing in the chain previously set an origin, we now default it to 'manual' // For transactions, this is done in the SpanExporter. diff --git a/packages/opentelemetry/src/utils/parseSpanDescription.ts b/packages/opentelemetry/src/utils/parseSpanDescription.ts index 0707697ce7f9..be3662b4717d 100644 --- a/packages/opentelemetry/src/utils/parseSpanDescription.ts +++ b/packages/opentelemetry/src/utils/parseSpanDescription.ts @@ -13,13 +13,13 @@ import { MESSAGING_SYSTEM, RPC_SERVICE, URL_FULL, + SENTRY_OP, } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes, TransactionSource } from '@sentry/core'; import { getSanitizedUrlString, parseUrl, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, @@ -50,9 +50,7 @@ export function inferSpanData(spanName: string, attributes: SpanAttributes, kind // eslint-disable-next-line typescript/no-deprecated const dbSystem = attributes[DB_SYSTEM_NAME] || attributes[DB_SYSTEM]; - const opIsCache = - typeof attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'string' && - attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP].startsWith('cache.'); + const opIsCache = typeof attributes[SENTRY_OP] === 'string' && attributes[SENTRY_OP].startsWith('cache.'); // If db.type exists then this is a database call span // If the Redis DB is used as a cache, the span description should not be changed diff --git a/packages/opentelemetry/test/integration/transactions.test.ts b/packages/opentelemetry/test/integration/transactions.test.ts index 7280bc4d9b0c..62d402e48516 100644 --- a/packages/opentelemetry/test/integration/transactions.test.ts +++ b/packages/opentelemetry/test/integration/transactions.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } 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'; @@ -99,7 +100,7 @@ describe('Integration | Transactions', () => { expect(transaction.contexts?.trace).toEqual({ data: { - 'sentry.op': 'test op', + [SENTRY_OP]: 'test op', 'sentry.origin': 'auto.test', 'sentry.source': 'task', 'sentry.sample_rate': 1, @@ -251,7 +252,7 @@ describe('Integration | Transactions', () => { contexts: expect.objectContaining({ trace: { data: { - 'sentry.op': 'test op', + [SENTRY_OP]: 'test op', 'sentry.origin': 'auto.test', 'sentry.source': 'task', 'test.outer': 'test value', @@ -289,7 +290,7 @@ describe('Integration | Transactions', () => { contexts: expect.objectContaining({ trace: { data: { - 'sentry.op': 'test op b', + [SENTRY_OP]: 'test op b', 'sentry.origin': 'manual', 'sentry.source': 'custom', 'test.outer': 'test value b', @@ -368,7 +369,7 @@ describe('Integration | Transactions', () => { contexts: expect.objectContaining({ trace: { data: { - 'sentry.op': 'test op', + [SENTRY_OP]: 'test op', 'sentry.origin': 'auto.test', 'sentry.source': 'task', }, diff --git a/packages/opentelemetry/test/spanExporter.test.ts b/packages/opentelemetry/test/spanExporter.test.ts index d84d326bac1f..e61f1b7ed196 100644 --- a/packages/opentelemetry/test/spanExporter.test.ts +++ b/packages/opentelemetry/test/spanExporter.test.ts @@ -1,5 +1,5 @@ -import { HTTP_RESPONSE_STATUS_CODE } from '@sentry/conventions/attributes'; -import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, startInactiveSpan, startSpanManual } from '@sentry/core'; +import { HTTP_RESPONSE_STATUS_CODE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SDK_VERSION, startInactiveSpan, startSpanManual } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { createTransactionForOtelSpan } from '../src/spanExporter'; import { cleanupOtel, mockSdkInit } from './helpers/mockSdkInit'; @@ -61,7 +61,7 @@ describe('createTransactionForOtelSpan', () => { name: 'test', startTime: 1733821670000, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [HTTP_RESPONSE_STATUS_CODE]: 200, }, }); @@ -80,7 +80,7 @@ describe('createTransactionForOtelSpan', () => { 'sentry.source': 'custom', 'sentry.sample_rate': 1, 'sentry.origin': 'manual', - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', 'http.response.status_code': 200, }, origin: 'manual', diff --git a/packages/opentelemetry/test/trace.test.ts b/packages/opentelemetry/test/trace.test.ts index 02b67b220b43..633e53e8e838 100644 --- a/packages/opentelemetry/test/trace.test.ts +++ b/packages/opentelemetry/test/trace.test.ts @@ -2,7 +2,7 @@ import type { Span, TimeInput } from '@opentelemetry/api'; import { context, ROOT_CONTEXT, SpanKind, trace, TraceFlags } from '@opentelemetry/api'; import type { ReadableSpan } from '@opentelemetry/sdk-trace-base'; -import { HTTP_METHOD } from '@sentry/conventions/attributes'; +import { HTTP_METHOD, SENTRY_OP } from '@sentry/conventions/attributes'; import type { Event, Scope } from '@sentry/core'; import { getClient, @@ -11,7 +11,6 @@ import { getDynamicSamplingContextFromSpan, getRootSpan, isTracingSuppressed, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -241,7 +240,7 @@ describe('trace', () => { expect(getSpanAttributes(span)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'my-op', + [SENTRY_OP]: 'my-op', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, }); }, @@ -646,7 +645,7 @@ describe('trace', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'my-op', + [SENTRY_OP]: 'my-op', }); }); @@ -1766,7 +1765,7 @@ describe('trace (sampling)', () => { attributes: { attr1: 'yes', attr2: 1, - 'sentry.op': 'test.op', + [SENTRY_OP]: 'test.op', }, inheritOrSampleWith: expect.any(Function), }); diff --git a/packages/opentelemetry/test/tracerProvider.test.ts b/packages/opentelemetry/test/tracerProvider.test.ts index 1b8b878d305d..17fca2d3e249 100644 --- a/packages/opentelemetry/test/tracerProvider.test.ts +++ b/packages/opentelemetry/test/tracerProvider.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { context, SpanKind, trace, TraceFlags } from '@opentelemetry/api'; import { suppressTracing } from '@opentelemetry/core'; import { @@ -43,7 +44,7 @@ describe('SentryTracerProvider', () => { expect(spanToJSON(span as Span)).toEqual({ data: { 'sentry.origin': 'manual', - 'sentry.op': 'db', + [SENTRY_OP]: 'db', 'sentry.sample_rate': 1, 'sentry.source': 'task', 'db.system.name': 'postgresql', diff --git a/packages/opentelemetry/test/utils/spanToJSON.test.ts b/packages/opentelemetry/test/utils/spanToJSON.test.ts index c1f9fe2a18c7..abbba8138ce3 100644 --- a/packages/opentelemetry/test/utils/spanToJSON.test.ts +++ b/packages/opentelemetry/test/utils/spanToJSON.test.ts @@ -1,12 +1,8 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span, SpanOptions } from '@opentelemetry/api'; import { trace } from '@opentelemetry/api'; import type { BasicTracerProvider } from '@opentelemetry/sdk-trace-base'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - spanToJSON, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, spanToJSON } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { setupOtel } from '../helpers/initOtel'; import { cleanupOtel } from '../helpers/mockSdkInit'; @@ -49,7 +45,7 @@ describe('spanToJSON', () => { span.setAttributes({ attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', + [SENTRY_OP]: 'test op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', }); @@ -67,7 +63,7 @@ describe('spanToJSON', () => { data: { attr1: 'value1', attr2: 2, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'test op', + [SENTRY_OP]: 'test op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, }, diff --git a/packages/react-router/src/client/createClientInstrumentation.ts b/packages/react-router/src/client/createClientInstrumentation.ts index 9ad9421609a4..65549e48ff55 100644 --- a/packages/react-router/src/client/createClientInstrumentation.ts +++ b/packages/react-router/src/client/createClientInstrumentation.ts @@ -7,7 +7,6 @@ import { getClient, getRootSpan, GLOBAL_OBJ, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, @@ -24,7 +23,7 @@ import { finalizeNavigationSpanFromHydratedRouter, updateNavigationSpanUrlFromLocation, } from './utils'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; @@ -107,7 +106,7 @@ export function createSentryClientInstrumentation( name: pathname, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'browser.popstate', }, @@ -150,7 +149,7 @@ export function createSentryClientInstrumentation( name: currentPathname, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': navigationType, }, @@ -195,7 +194,7 @@ export function createSentryClientInstrumentation( name: toPath, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', }, @@ -221,7 +220,7 @@ export function createSentryClientInstrumentation( { name: `Fetcher ${info.fetcherKey}`, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.fetcher', + [SENTRY_OP]: 'function.react_router.fetcher', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, @@ -255,7 +254,7 @@ export function createSentryClientInstrumentation( { name: routePattern, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.client_loader', + [SENTRY_OP]: 'function.react_router.client_loader', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, @@ -281,7 +280,7 @@ export function createSentryClientInstrumentation( { name: routePattern, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.client_action', + [SENTRY_OP]: 'function.react_router.client_action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, @@ -314,7 +313,7 @@ export function createSentryClientInstrumentation( { name: `middleware ${routeId}`, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.client_middleware', + [SENTRY_OP]: 'function.react_router.client_middleware', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', 'react_router.route.id': routeId, 'http.route': routePattern, @@ -338,7 +337,7 @@ export function createSentryClientInstrumentation( { name: 'Lazy Route Load', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.client_lazy', + [SENTRY_OP]: 'function.react_router.client_lazy', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, diff --git a/packages/react-router/src/client/hydratedRouter.ts b/packages/react-router/src/client/hydratedRouter.ts index d0fbb7b04f29..b556cc4bc9dd 100644 --- a/packages/react-router/src/client/hydratedRouter.ts +++ b/packages/react-router/src/client/hydratedRouter.ts @@ -7,7 +7,6 @@ import { getRootSpan, GLOBAL_OBJ, isThenable, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, @@ -22,7 +21,7 @@ import { resolveNavigateAbsoluteUrl, resolveNavigateArg, } from './utils'; -import { URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_PATH, URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; const GLOBAL_OBJ_WITH_DATA_ROUTER = GLOBAL_OBJ as typeof GLOBAL_OBJ & { __reactRouterDataRouter?: DataRouter; @@ -187,7 +186,7 @@ function maybeCreateNavigationTransaction(name: string, url: string, source: 'ur name, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_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 be826c3d7f5d..89d9c7b6da7d 100644 --- a/packages/react-router/src/server/createServerInstrumentation.ts +++ b/packages/react-router/src/server/createServerInstrumentation.ts @@ -1,12 +1,11 @@ import { context, createContextKey } from '@opentelemetry/api'; -import { HTTP_REQUEST_METHOD, HTTP_ROUTE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { HTTP_REQUEST_METHOD, HTTP_ROUTE, URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; import { debug, flushIfServerless, getActiveSpan, getCurrentScope, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, @@ -62,7 +61,7 @@ export function createSentryServerInstrumentation( if (existingRootSpan) { updateSpanName(existingRootSpan, `${info.request.method} ${pathname}`); existingRootSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [URL_FULL]: info.request.url, @@ -87,7 +86,7 @@ export function createSentryServerInstrumentation( name: `${info.request.method} ${pathname}`, forceTransaction: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [HTTP_REQUEST_METHOD]: info.request.method, @@ -132,7 +131,7 @@ export function createSentryServerInstrumentation( { name: routePattern, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.loader', + [SENTRY_OP]: 'function.react_router.loader', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, @@ -159,7 +158,7 @@ export function createSentryServerInstrumentation( { name: routePattern, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.action', + [SENTRY_OP]: 'function.react_router.action', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, @@ -198,7 +197,7 @@ export function createSentryServerInstrumentation( { name: `middleware ${middlewareName || routeId}`, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.middleware', + [SENTRY_OP]: 'function.react_router.middleware', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', 'react_router.route.id': routeId, [HTTP_ROUTE]: routePattern, @@ -224,7 +223,7 @@ export function createSentryServerInstrumentation( { name: 'Lazy Route Load', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.react_router.lazy', + [SENTRY_OP]: 'function.react_router.lazy', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.react_router.instrumentation_api', }, }, diff --git a/packages/react-router/src/server/instrumentation/reactRouter.ts b/packages/react-router/src/server/instrumentation/reactRouter.ts index 41a60a9740bc..66a611a9c7b1 100644 --- a/packages/react-router/src/server/instrumentation/reactRouter.ts +++ b/packages/react-router/src/server/instrumentation/reactRouter.ts @@ -1,12 +1,11 @@ import type { InstrumentationConfig } from '@opentelemetry/instrumentation'; import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation'; -import { HTTP_TARGET } from '@sentry/conventions/attributes'; +import { HTTP_TARGET, SENTRY_OP } from '@sentry/conventions/attributes'; import { debug, getActiveSpan, getRootSpan, SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, @@ -125,7 +124,7 @@ export class ReactRouterInstrumentation extends InstrumentationBase { diff --git a/packages/react-router/test/client/createClientInstrumentation.test.ts b/packages/react-router/test/client/createClientInstrumentation.test.ts index d5c44f4cf6ca..8cc4bb5de56f 100644 --- a/packages/react-router/test/client/createClientInstrumentation.test.ts +++ b/packages/react-router/test/client/createClientInstrumentation.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as browser from '@sentry/browser'; import * as core from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -19,7 +20,6 @@ vi.mock('@sentry/core', async () => { spanToJSON: vi.fn(), updateSpanName: vi.fn(), GLOBAL_OBJ: globalThis, - SEMANTIC_ATTRIBUTE_SENTRY_OP: 'sentry.op', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', }; @@ -110,7 +110,7 @@ describe('createSentryClientInstrumentation', () => { name: '/about', attributes: expect.objectContaining({ 'sentry.source': 'url', - 'sentry.op': 'navigation', + [SENTRY_OP]: 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', }), @@ -180,7 +180,7 @@ describe('createSentryClientInstrumentation', () => { name: '/items/123', attributes: expect.objectContaining({ 'sentry.source': 'url', - 'sentry.op': 'navigation', + [SENTRY_OP]: 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', }), @@ -213,7 +213,7 @@ describe('createSentryClientInstrumentation', () => { expect.objectContaining({ name: 'Fetcher fetcher-1', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.fetcher', + [SENTRY_OP]: 'function.react_router.fetcher', 'sentry.origin': 'auto.function.react_router.instrumentation_api', }), }), @@ -252,7 +252,7 @@ describe('createSentryClientInstrumentation', () => { expect.objectContaining({ name: '/users/:id', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.client_loader', + [SENTRY_OP]: 'function.react_router.client_loader', 'sentry.origin': 'auto.function.react_router.instrumentation_api', }), }), @@ -289,7 +289,7 @@ describe('createSentryClientInstrumentation', () => { expect.objectContaining({ name: '/users/:id', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.client_action', + [SENTRY_OP]: 'function.react_router.client_action', 'sentry.origin': 'auto.function.react_router.instrumentation_api', }), }), @@ -436,7 +436,7 @@ describe('createSentryClientInstrumentation', () => { name: '/current-page', attributes: expect.objectContaining({ 'sentry.source': 'url', - 'sentry.op': 'navigation', + [SENTRY_OP]: 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': expectedType, }), @@ -603,7 +603,7 @@ describe('createSentryClientInstrumentation', () => { expect.objectContaining({ name: 'middleware test-route', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.client_middleware', + [SENTRY_OP]: 'function.react_router.client_middleware', 'sentry.origin': 'auto.function.react_router.instrumentation_api', 'react_router.route.id': 'test-route', 'http.route': '/users/:id', @@ -636,7 +636,7 @@ describe('createSentryClientInstrumentation', () => { expect.objectContaining({ name: 'Lazy Route Load', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.client_lazy', + [SENTRY_OP]: 'function.react_router.client_lazy', 'sentry.origin': 'auto.function.react_router.instrumentation_api', }), }), @@ -702,7 +702,7 @@ describe('createSentryClientInstrumentation', () => { name: '/current-page', attributes: expect.objectContaining({ 'sentry.source': 'url', - 'sentry.op': 'navigation', + [SENTRY_OP]: 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'browser.popstate', }), diff --git a/packages/react-router/test/client/hydratedRouter.test.ts b/packages/react-router/test/client/hydratedRouter.test.ts index f425b7e80c21..29de47856f76 100644 --- a/packages/react-router/test/client/hydratedRouter.test.ts +++ b/packages/react-router/test/client/hydratedRouter.test.ts @@ -15,7 +15,6 @@ vi.mock('@sentry/core', async () => { debug: { warn: vi.fn(), }, - SEMANTIC_ATTRIBUTE_SENTRY_OP: 'op', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'origin', SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'source', GLOBAL_OBJ: globalThis, diff --git a/packages/react-router/test/server/createServerInstrumentation.test.ts b/packages/react-router/test/server/createServerInstrumentation.test.ts index 6762be8e4e83..4bb2252e5158 100644 --- a/packages/react-router/test/server/createServerInstrumentation.test.ts +++ b/packages/react-router/test/server/createServerInstrumentation.test.ts @@ -1,5 +1,5 @@ import * as otelApi from '@opentelemetry/api'; -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; import * as core from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { @@ -19,7 +19,6 @@ vi.mock('@sentry/core', async () => { getRootSpan: vi.fn(), updateSpanName: vi.fn(), GLOBAL_OBJ: globalThis, - SEMANTIC_ATTRIBUTE_SENTRY_OP: 'sentry.op', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', }; @@ -114,7 +113,7 @@ describe('createSentryServerInstrumentation', () => { // Should update the root span name and attributes expect(core.updateSpanName).toHaveBeenCalledWith(mockRootSpan, 'GET /test-path'); expect(mockSetAttributes).toHaveBeenCalledWith({ - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api', 'sentry.source': 'url', [URL_FULL]: 'http://example.com/test-path', @@ -146,7 +145,7 @@ describe('createSentryServerInstrumentation', () => { name: 'GET /api/users', forceTransaction: true, attributes: expect.objectContaining({ - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api', 'sentry.source': 'url', 'http.request.method': 'GET', @@ -284,7 +283,7 @@ describe('createSentryServerInstrumentation', () => { expect.objectContaining({ name: '/users/:id', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.loader', + [SENTRY_OP]: 'function.react_router.loader', 'sentry.origin': 'auto.function.react_router.instrumentation_api', }), }), @@ -324,7 +323,7 @@ describe('createSentryServerInstrumentation', () => { expect.objectContaining({ name: '/users/:id', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.action', + [SENTRY_OP]: 'function.react_router.action', 'sentry.origin': 'auto.function.react_router.instrumentation_api', }), }), @@ -381,7 +380,7 @@ describe('createSentryServerInstrumentation', () => { expect.objectContaining({ name: 'middleware test-route', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.middleware', + [SENTRY_OP]: 'function.react_router.middleware', 'sentry.origin': 'auto.function.react_router.instrumentation_api', 'react_router.route.id': 'test-route', 'http.route': '/users/:id', @@ -412,7 +411,7 @@ describe('createSentryServerInstrumentation', () => { expect.objectContaining({ name: 'middleware authMiddleware', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.middleware', + [SENTRY_OP]: 'function.react_router.middleware', 'react_router.route.id': 'routes/protected', 'http.route': '/protected', 'react_router.middleware.name': 'authMiddleware', @@ -472,7 +471,7 @@ describe('createSentryServerInstrumentation', () => { // Filter to only middleware spans const middlewareSpans = startSpanCalls.filter( - opts => opts.attributes?.['sentry.op'] === 'function.react_router.middleware', + opts => opts.attributes?.[SENTRY_OP] === 'function.react_router.middleware', ); expect(middlewareSpans).toHaveLength(3); @@ -504,7 +503,7 @@ describe('createSentryServerInstrumentation', () => { expect.objectContaining({ name: 'Lazy Route Load', attributes: expect.objectContaining({ - 'sentry.op': 'function.react_router.lazy', + [SENTRY_OP]: 'function.react_router.lazy', 'sentry.origin': 'auto.function.react_router.instrumentation_api', }), }), diff --git a/packages/react-router/test/server/instrumentation/reactRouterServer.test.ts b/packages/react-router/test/server/instrumentation/reactRouterServer.test.ts index f9b9d88c1a2b..14bbacd270f8 100644 --- a/packages/react-router/test/server/instrumentation/reactRouterServer.test.ts +++ b/packages/react-router/test/server/instrumentation/reactRouterServer.test.ts @@ -16,7 +16,6 @@ vi.mock('@sentry/core', async () => { log: vi.fn(), }, SDK_VERSION: '1.0.0', - SEMANTIC_ATTRIBUTE_SENTRY_OP: 'sentry.op', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', startSpan: vi.fn((opts, fn) => fn({})), diff --git a/packages/react/src/reactrouter-compat-utils/instrumentation.tsx b/packages/react/src/reactrouter-compat-utils/instrumentation.tsx index 12b1efecbb07..7555e5293545 100644 --- a/packages/react/src/reactrouter-compat-utils/instrumentation.tsx +++ b/packages/react/src/reactrouter-compat-utils/instrumentation.tsx @@ -14,7 +14,6 @@ import { debug, getClient, getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, @@ -47,7 +46,7 @@ import { setNavigationContext, transactionNameHasWildcard, } from './utils'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; let _useEffect: UseEffect; let _useLocation: UseLocation; @@ -738,7 +737,7 @@ export function createReactRouterV6CompatibleTracingIntegration( name: initPathName, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter${version ? `_v${version}` : ''}`, }, }); @@ -1037,7 +1036,7 @@ export function handleNavigation(opts: { name: placeholderEntry.routeName, // Use placeholder's routeName in case it was updated attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_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 1ac4c7b265ee..7bb0f3428a79 100644 --- a/packages/react/src/reactrouter.tsx +++ b/packages/react/src/reactrouter.tsx @@ -9,7 +9,6 @@ import { getActiveSpan, getCurrentScope, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, @@ -18,7 +17,7 @@ import type { ReactElement } from 'react'; import * as React from 'react'; import { hoistNonReactStatics } from './hoist-non-react-statics'; import type { Action, Location } from './types'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; // We need to disable eslint no-explicit-any because any is required for the // react-router typings. @@ -160,7 +159,7 @@ function instrumentReactRouter( startBrowserTracingPageLoadSpan(client, { name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: name }), @@ -176,7 +175,7 @@ function instrumentReactRouter( startBrowserTracingNavigationSpan(client, { name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: name }), diff --git a/packages/react/src/reactrouterv3.ts b/packages/react/src/reactrouterv3.ts index b08df8632f41..61315b187d8c 100644 --- a/packages/react/src/reactrouterv3.ts +++ b/packages/react/src/reactrouterv3.ts @@ -5,13 +5,9 @@ import { WINDOW, } from '@sentry/browser'; import type { Integration, TransactionSource } from '@sentry/core/browser'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core/browser'; import type { Location } from './types'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; // Many of the types below had to be mocked out to prevent typescript issues // these types are required for correct functionality. @@ -66,7 +62,7 @@ export function reactRouterV3BrowserTracingIntegration( startBrowserTracingPageLoadSpan(client, { name: localName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: localName }), @@ -87,7 +83,7 @@ export function reactRouterV3BrowserTracingIntegration( startBrowserTracingNavigationSpan(client, { name: localName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: localName }), diff --git a/packages/react/src/tanstackrouter.ts b/packages/react/src/tanstackrouter.ts index ea6e9a3ea1f2..20f0d1b54c25 100644 --- a/packages/react/src/tanstackrouter.ts +++ b/packages/react/src/tanstackrouter.ts @@ -6,11 +6,7 @@ import { WINDOW, } from '@sentry/browser'; import type { Integration } from '@sentry/core/browser'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core/browser'; import type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types'; import { PARAMS_KEY_BASE, @@ -18,6 +14,7 @@ import { URL_PATH, URL_PATH_PARAMETER_KEY_BASE, URL_TEMPLATE, + SENTRY_OP, } from '@sentry/conventions/attributes'; interface TanstackRouterLocation { @@ -90,7 +87,7 @@ export function tanstackRouterBrowserTracingIntegration( const pageloadSpan = startBrowserTracingPageLoadSpan(client, { name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), @@ -139,7 +136,7 @@ export function tanstackRouterBrowserTracingIntegration( { name: routeMatch ? routeMatch.routeId : fallbackName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), diff --git a/packages/react/test/reactrouter-compat-utils/instrumentation.test.tsx b/packages/react/test/reactrouter-compat-utils/instrumentation.test.tsx index 89f838adff51..3e037d3640d8 100644 --- a/packages/react/test/reactrouter-compat-utils/instrumentation.test.tsx +++ b/packages/react/test/reactrouter-compat-utils/instrumentation.test.tsx @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; /** * @vitest-environment jsdom */ @@ -946,7 +947,7 @@ describe('tryUpdateSpanNameBeforeEnd - source upgrade logic', () => { expect.objectContaining({ name: '/search', attributes: expect.objectContaining({ - 'sentry.op': 'navigation', + [SENTRY_OP]: 'navigation', 'sentry.source': 'route', }), }), diff --git a/packages/react/test/reactrouter-cross-usage.test.tsx b/packages/react/test/reactrouter-cross-usage.test.tsx index 05fa5d9411a1..8aa5f5c0a416 100644 --- a/packages/react/test/reactrouter-cross-usage.test.tsx +++ b/packages/react/test/reactrouter-cross-usage.test.tsx @@ -4,12 +4,11 @@ import { createTransport, getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '@sentry/core'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; import { render, waitFor } from '@testing-library/react'; import * as React from 'react'; import { act } from 'react'; @@ -648,7 +647,7 @@ describe('React Router cross usage of wrappers', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/settings', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -668,8 +667,8 @@ describe('React Router cross usage of wrappers', () => { const calls = mockStartBrowserTracingNavigationSpan.mock.calls; expect(calls[0]![1].name).toBe('/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 () => { @@ -767,7 +766,7 @@ describe('React Router cross usage of wrappers', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/user/:id', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -789,7 +788,7 @@ describe('React Router cross usage of wrappers', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/user/:id', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -845,7 +844,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/settings/*', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }), }); }); @@ -893,7 +892,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 b7e068df0c97..b72c30cce10f 100644 --- a/packages/react/test/reactrouter-descendant-routes.test.tsx +++ b/packages/react/test/reactrouter-descendant-routes.test.tsx @@ -4,12 +4,11 @@ import { createTransport, getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '@sentry/core'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; import { render } from '@testing-library/react'; import * as React from 'react'; import { @@ -175,7 +174,7 @@ describe('React Router Descendant Routes', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/child/:id', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -307,7 +306,7 @@ describe('React Router Descendant Routes', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/:orgId/:id', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -418,7 +417,7 @@ describe('React Router Descendant Routes', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -479,7 +478,7 @@ describe('React Router Descendant Routes', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -632,7 +631,7 @@ describe('React Router Descendant Routes', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); diff --git a/packages/react/test/reactrouterv3.test.tsx b/packages/react/test/reactrouterv3.test.tsx index 2679e6dd033b..3379ae0fcb15 100644 --- a/packages/react/test/reactrouterv3.test.tsx +++ b/packages/react/test/reactrouterv3.test.tsx @@ -5,12 +5,11 @@ import { BrowserClient } from '@sentry/browser'; import { createTransport, getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '@sentry/core'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; import { render } from '@testing-library/react'; import * as React from 'react'; import { act } from 'react'; @@ -107,7 +106,7 @@ describe('browserTracingReactRouterV3', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', }, }); }); @@ -144,7 +143,7 @@ describe('browserTracingReactRouterV3', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/about', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); @@ -158,7 +157,7 @@ describe('browserTracingReactRouterV3', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/features', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); }); @@ -200,7 +199,7 @@ describe('browserTracingReactRouterV3', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/users/:userid', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); expect(getCurrentScope().getScopeData().transactionName).toEqual('/users/:userid'); @@ -216,7 +215,7 @@ describe('browserTracingReactRouterV3', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/teams/:teamId/details', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [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 779adfb31559..900cd3bd72b3 100644 --- a/packages/react/test/reactrouterv4.test.tsx +++ b/packages/react/test/reactrouterv4.test.tsx @@ -4,7 +4,6 @@ import { createTransport, getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, @@ -15,7 +14,7 @@ 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 { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; import { BrowserClient, reactRouterV4BrowserTracingIntegration, withSentryRouting } from '../src'; import type { RouteConfig } from '../src/reactrouter'; @@ -85,7 +84,7 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', }, }); }); @@ -130,7 +129,7 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); @@ -143,7 +142,7 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); }); @@ -202,7 +201,7 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); }); @@ -239,7 +238,7 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(2); @@ -284,7 +283,7 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(2); @@ -307,7 +306,7 @@ describe('browserTracingReactRouterV4', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(3); @@ -356,7 +355,7 @@ describe('browserTracingReactRouterV4', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid/v1/:teamid', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); @@ -370,7 +369,7 @@ describe('browserTracingReactRouterV4', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); }); diff --git a/packages/react/test/reactrouterv5.test.tsx b/packages/react/test/reactrouterv5.test.tsx index 7841833fb6cc..f1e96d5ebb84 100644 --- a/packages/react/test/reactrouterv5.test.tsx +++ b/packages/react/test/reactrouterv5.test.tsx @@ -4,7 +4,6 @@ import { createTransport, getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, @@ -15,7 +14,7 @@ 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 { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; import { BrowserClient, reactRouterV5BrowserTracingIntegration, withSentryRouting } from '../src'; import type { RouteConfig } from '../src/reactrouter'; @@ -85,7 +84,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', }, }); }); @@ -130,7 +129,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); @@ -143,7 +142,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); }); @@ -202,7 +201,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); }); @@ -239,7 +238,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(2); @@ -284,7 +283,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(2); @@ -307,7 +306,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', }, }); expect(mockRootSpan.updateName).toHaveBeenCalledTimes(3); @@ -355,7 +354,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [URL_TEMPLATE]: '/organizations/:orgid/v1/:teamid', }, }); @@ -369,7 +368,7 @@ describe('browserTracingReactRouterV5', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [URL_TEMPLATE]: '/organizations/:orgid', }, }); diff --git a/packages/react/test/reactrouterv6.test.tsx b/packages/react/test/reactrouterv6.test.tsx index 80afbedf22ec..68c1d05607f9 100644 --- a/packages/react/test/reactrouterv6.test.tsx +++ b/packages/react/test/reactrouterv6.test.tsx @@ -4,12 +4,11 @@ import { createTransport, getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '@sentry/core'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { URL_TEMPLATE, SENTRY_OP } from '@sentry/conventions/attributes'; import { fireEvent, render } from '@testing-library/react'; import * as React from 'react'; import type { RouteObject } from 'react-router-6'; @@ -130,7 +129,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { name: '/', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, }); @@ -177,7 +176,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { name: '/', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, }); @@ -214,7 +213,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { name: '/', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, }); @@ -332,7 +331,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/about', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -419,7 +418,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/about/us', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -457,7 +456,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/about/:page', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -497,7 +496,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/stores/:storeId/products/:productId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -545,7 +544,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -595,7 +594,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -647,7 +646,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -687,7 +686,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -727,7 +726,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -799,7 +798,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { name: '/', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, }); @@ -951,7 +950,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/about', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -1003,7 +1002,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/about/us', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -1055,7 +1054,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/about/:page', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -1113,7 +1112,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/stores/:storeId/products/:productId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -1195,7 +1194,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -1275,7 +1274,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/param-page/:id/details/:superId', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -1432,7 +1431,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); @@ -1472,7 +1471,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', }, }); diff --git a/packages/remix/src/cloudflare/index.ts b/packages/remix/src/cloudflare/index.ts index ef2f89cee2a5..e05edec4609e 100644 --- a/packages/remix/src/cloudflare/index.ts +++ b/packages/remix/src/cloudflare/index.ts @@ -108,7 +108,6 @@ export { supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/remix/src/server/index.ts b/packages/remix/src/server/index.ts index 4fd2331b34fa..d6e578b37bc1 100644 --- a/packages/remix/src/server/index.ts +++ b/packages/remix/src/server/index.ts @@ -84,7 +84,6 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, diff --git a/packages/remix/src/server/instrumentServer.ts b/packages/remix/src/server/instrumentServer.ts index 8c157d697687..7f6cd3ac17b9 100644 --- a/packages/remix/src/server/instrumentServer.ts +++ b/packages/remix/src/server/instrumentServer.ts @@ -25,7 +25,6 @@ import { httpHeadersToSpanAttributes, isNodeEnv, loadModule, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, @@ -40,7 +39,7 @@ import { createRoutes, getTransactionName, isCloudflareEnv } from '../utils/util import { extractData, isResponse, json } from '../utils/vendor/response'; import { captureRemixServerException, errorHandleDataFunction } from './errors'; import { generateSentryServerTimingHeader, injectServerTimingHeaderValue } from './serverTimingTracePropagation'; -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; type AppData = unknown; type RemixRequest = Parameters[0]; @@ -135,7 +134,7 @@ function makeWrappedDocumentRequestFunction(instrumentTracing?: boolean) { method: request.method, url: request.url, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.remix', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.remix.document_request', + [SENTRY_OP]: 'function.remix.document_request', }, }, () => { @@ -206,7 +205,7 @@ function makeWrappedDataFunction( name: id, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.remix', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `function.remix.${name}`, + [SENTRY_OP]: `function.remix.${name}`, name, }, }, @@ -375,7 +374,7 @@ function wrapRequestHandler ServerBuild | Promise attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.remix', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [URL_FULL]: url.href, [URL_PATH]: url.pathname, method: request.method, diff --git a/packages/remix/src/server/integrations/opentelemetry.ts b/packages/remix/src/server/integrations/opentelemetry.ts index ceaa9349c706..319d18f4c18d 100644 --- a/packages/remix/src/server/integrations/opentelemetry.ts +++ b/packages/remix/src/server/integrations/opentelemetry.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { generateInstrumentOnce, spanToJSON } from '@sentry/node'; import { RemixInstrumentation } from '../../vendor/instrumentation'; @@ -23,7 +24,7 @@ export function addRemixSpanAttributes(span: Span): void { const type = attributes['code.function']; // If this is already set, or we have no remix span, no need to process again... - if (attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] || !type) { + if (attributes[SENTRY_OP] || !type) { return; } @@ -35,6 +36,6 @@ export function addRemixSpanAttributes(span: Span): void { span.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.remix', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, }); } diff --git a/packages/remix/src/server/integrations/tracing-channel.ts b/packages/remix/src/server/integrations/tracing-channel.ts index 04d5e4a21269..e18e493c691b 100644 --- a/packages/remix/src/server/integrations/tracing-channel.ts +++ b/packages/remix/src/server/integrations/tracing-channel.ts @@ -5,7 +5,6 @@ import { isObjectLike, isURLObjectRelative, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_KIND, startInactiveSpan, @@ -20,6 +19,7 @@ import { HTTP_URL, URL_FULL, URL_PATH, + SENTRY_OP, } from '@sentry/conventions/attributes'; import { remixChannels } from '@sentry/server-utils/orchestrion'; @@ -137,7 +137,7 @@ function subscribeRequestHandler(): void { kind: SPAN_KIND.SERVER, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [CODE_FUNCTION]: 'requestHandler', ...getRequestAttributes(data.arguments[0]), }, @@ -171,7 +171,7 @@ function subscribeCallRouteLoader(): void { name: `LOADER ${params.routeId}`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'loader.remix', + [SENTRY_OP]: 'loader.remix', [CODE_FUNCTION]: 'loader', ...getRequestAttributes(params.request), ...getMatchAttributes(params), @@ -205,7 +205,7 @@ function subscribeCallRouteAction(actionFormDataAttributes: Record { kind: SentryCore.SPAN_KIND.SERVER, attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.orchestrion.remix', - 'sentry.op': 'http.server', + [SENTRY_OP]: 'http.server', 'code.function': 'requestHandler', 'http.method': 'GET', 'http.url': 'http://localhost/users', @@ -99,7 +100,7 @@ describe('remixIntegration (Orchestrion-based)', () => { name: 'LOADER routes/users.$userId', attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.orchestrion.remix', - 'sentry.op': 'loader.remix', + [SENTRY_OP]: 'loader.remix', 'code.function': 'loader', 'http.method': 'GET', 'http.url': 'http://localhost/users/123', @@ -138,7 +139,7 @@ describe('remixIntegration (Orchestrion-based)', () => { expect.objectContaining({ name: 'ACTION routes/submit', attributes: expect.objectContaining({ - 'sentry.op': 'action.remix', + [SENTRY_OP]: 'action.remix', 'code.function': 'action', 'http.method': 'POST', }), diff --git a/packages/server-utils/src/graphql/graphql-dc-subscriber.ts b/packages/server-utils/src/graphql/graphql-dc-subscriber.ts index cd4337954dc4..f381f0421178 100644 --- a/packages/server-utils/src/graphql/graphql-dc-subscriber.ts +++ b/packages/server-utils/src/graphql/graphql-dc-subscriber.ts @@ -1,12 +1,12 @@ import type { TracingChannel } from 'node:diagnostics_channel'; -import { GRAPHQL_DOCUMENT, GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE } from '@sentry/conventions/attributes'; -import { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op'; import { - 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, +} from '@sentry/conventions/attributes'; +import { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../tracing-channel'; import type { GraphqlDocumentNode } from './utils'; import { collectGraphqlDocument, getOperationSpanName, hasResultErrors, renameRootSpanWithOperation } from './utils'; @@ -150,7 +150,7 @@ function setupParseChannel(tracingChannel: GraphqlTracingChannelFactory): void { name: SPAN_NAME_PARSE, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, + [SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, }, }), ); @@ -164,7 +164,7 @@ function setupValidateChannel(tracingChannel: GraphqlTracingChannelFactory): voi name: SPAN_NAME_VALIDATE, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, + [SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, [GRAPHQL_DOCUMENT]: collectGraphqlDocument(data.document), }, }); @@ -193,7 +193,7 @@ function setupOperationChannel( name: getOperationSpanName(data.operationType, data.operationName, fallbackName), attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, + [SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, [GRAPHQL_OPERATION_TYPE]: data.operationType, [GRAPHQL_OPERATION_NAME]: data.operationName || undefined, [GRAPHQL_DOCUMENT]: collectGraphqlDocument(data.document), @@ -229,7 +229,7 @@ function setupResolveChannel(tracingChannel: GraphqlTracingChannelFactory, ignor name: `${SPAN_NAME_RESOLVE} ${data.fieldPath}`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, + [SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, [GRAPHQL_FIELD_NAME]: data.fieldName, [GRAPHQL_FIELD_PATH]: data.fieldPath, [GRAPHQL_FIELD_TYPE]: data.fieldType, diff --git a/packages/server-utils/src/integrations/tracing-channel/express/instrumentation.ts b/packages/server-utils/src/integrations/tracing-channel/express/instrumentation.ts index 19db7a815d14..06391986d840 100644 --- a/packages/server-utils/src/integrations/tracing-channel/express/instrumentation.ts +++ b/packages/server-utils/src/integrations/tracing-channel/express/instrumentation.ts @@ -1,5 +1,5 @@ import type * as diagnosticsChannel from 'node:diagnostics_channel'; -import { HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; import { debug, @@ -7,7 +7,6 @@ import { getDefaultIsolationScope, getIsolationScope, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, startInactiveSpan, @@ -220,7 +219,7 @@ function getSpanForLayer(data: HandleChannelContext, options: ExpressIntegration name, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `${type}.express`, + [SENTRY_OP]: `${type}.express`, [ATTR_EXPRESS_NAME]: name, [ATTR_EXPRESS_TYPE]: type, ...(matchedRoute ? { [HTTP_ROUTE]: matchedRoute } : {}), @@ -265,7 +264,7 @@ function setHttpServerSpanRoute(route: string): void { if (!rootSpan) { return; } - if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'http.server') { + if (spanToJSON(rootSpan).data[SENTRY_OP] !== 'http.server') { return; } rootSpan.setAttribute(HTTP_ROUTE, route); diff --git a/packages/server-utils/src/integrations/tracing-channel/fastify/instrumentation.ts b/packages/server-utils/src/integrations/tracing-channel/fastify/instrumentation.ts index c5c43d61befb..3385f64eda87 100644 --- a/packages/server-utils/src/integrations/tracing-channel/fastify/instrumentation.ts +++ b/packages/server-utils/src/integrations/tracing-channel/fastify/instrumentation.ts @@ -15,7 +15,13 @@ /* eslint-disable max-lines */ import * as diagnosticsChannel from 'node:diagnostics_channel'; -import { HTTP_REQUEST_METHOD, HTTP_RESPONSE_STATUS_CODE, HTTP_ROUTE, URL_PATH } from '@sentry/conventions/attributes'; +import { + HTTP_REQUEST_METHOD, + HTTP_RESPONSE_STATUS_CODE, + HTTP_ROUTE, + URL_PATH, + SENTRY_OP, +} from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; import { isObjectLike, @@ -23,7 +29,6 @@ import { getActiveSpan, getIsolationScope, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, spanToJSON, @@ -190,7 +195,7 @@ function startRequestSpanHook(this: any, request: any, _reply: any, hookDone: () // Update the route of the request on the root span, if it is a http.server span const activeSpan = getActiveSpan(); const rootSpan = activeSpan && getRootSpan(activeSpan); - if (rootSpan && spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'http.server') { + if (rootSpan && spanToJSON(rootSpan).data[SENTRY_OP] === 'http.server') { rootSpan.setAttribute(HTTP_ROUTE, route); } } diff --git a/packages/server-utils/src/integrations/tracing-channel/graphql/resolvers.ts b/packages/server-utils/src/integrations/tracing-channel/graphql/resolvers.ts index 91d43172e574..0da8d694247e 100644 --- a/packages/server-utils/src/integrations/tracing-channel/graphql/resolvers.ts +++ b/packages/server-utils/src/integrations/tracing-channel/graphql/resolvers.ts @@ -6,11 +6,11 @@ * call runs). Resolver spans use the same origin/op/field attributes as the native subscriber. */ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; import { isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, @@ -179,7 +179,7 @@ function createFieldIfNotExists( function createResolverSpan(info: GraphQLResolveInfo, path: string[], parentSpan?: Span): Span { const attributes: SpanAttributes = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, + [SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, [GRAPHQL_FIELD_NAME]: info.fieldName, [GRAPHQL_FIELD_PATH]: path.join('.'), [GRAPHQL_FIELD_TYPE]: info.returnType.toString(), diff --git a/packages/server-utils/src/integrations/tracing-channel/graphql/spans.ts b/packages/server-utils/src/integrations/tracing-channel/graphql/spans.ts index e308c546cfc1..56c8ff3f83c2 100644 --- a/packages/server-utils/src/integrations/tracing-channel/graphql/spans.ts +++ b/packages/server-utils/src/integrations/tracing-channel/graphql/spans.ts @@ -5,15 +5,15 @@ * 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, +} from '@sentry/conventions/attributes'; import { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan } from '@sentry/core'; import type { GraphqlDocumentNode } from '../../../graphql/utils'; import { collectGraphqlDocument, @@ -34,7 +34,7 @@ import type { const BASE_ATTRIBUTES = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, + [SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP, } as const; export function startParseSpan(): Span { diff --git a/packages/server-utils/src/integrations/tracing-channel/hapi-utils.ts b/packages/server-utils/src/integrations/tracing-channel/hapi-utils.ts index 82af2a11f196..a44d6a8c1b56 100644 --- a/packages/server-utils/src/integrations/tracing-channel/hapi-utils.ts +++ b/packages/server-utils/src/integrations/tracing-channel/hapi-utils.ts @@ -7,14 +7,7 @@ * guard is replaced with `getActiveSpan()`. */ -import { - getActiveSpan, - getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - spanToJSON, - startSpan, -} from '@sentry/core'; +import { getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, startSpan } from '@sentry/core'; import type { LifecycleMethod, PatchableExtMethod, @@ -27,7 +20,7 @@ import type { ServerRouteOptions, } from './hapi-types'; // eslint-disable-next-line typescript/no-deprecated -- TODO(v11): Replace deprecated attributes -import { HTTP_METHOD, HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { HTTP_METHOD, HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; import { AttributeNames, handlerPatched, HapiLayerType, HapiLifecycleMethodNames } from './hapi-types'; type SpanAttributes = Record; @@ -53,7 +46,7 @@ function setHttpServerSpanRouteAttribute(route: string): void { if (!rootSpan) { return; } - if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'http.server') { + if (spanToJSON(rootSpan).data[SENTRY_OP] !== 'http.server') { return; } rootSpan.setAttribute(HTTP_ROUTE, route); diff --git a/packages/server-utils/src/integrations/tracing-channel/koa.ts b/packages/server-utils/src/integrations/tracing-channel/koa.ts index 982faee9765e..f977e70a588e 100644 --- a/packages/server-utils/src/integrations/tracing-channel/koa.ts +++ b/packages/server-utils/src/integrations/tracing-channel/koa.ts @@ -7,13 +7,12 @@ import { getDefaultIsolationScope, getIsolationScope, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, startSpan, } from '@sentry/core'; // oxlint-disable-next-line typescript/no-deprecated -import { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_NAME, KOA_TYPE } from '@sentry/conventions/attributes'; +import { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_NAME, KOA_TYPE, SENTRY_OP } from '@sentry/conventions/attributes'; import { DEBUG_BUILD } from '../../debug-build'; import { CHANNELS } from '../../orchestrion/channels'; @@ -247,7 +246,7 @@ function setHttpServerSpanRouteAttribute(route: string): void { if (!rootSpan) { return; } - if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'http.server') { + if (spanToJSON(rootSpan).data[SENTRY_OP] !== 'http.server') { return; } rootSpan.setAttribute(HTTP_ROUTE, route); diff --git a/packages/server-utils/src/integrations/tracing-channel/mysql2.ts b/packages/server-utils/src/integrations/tracing-channel/mysql2.ts index 9e59f521d363..6b5f8b85745a 100644 --- a/packages/server-utils/src/integrations/tracing-channel/mysql2.ts +++ b/packages/server-utils/src/integrations/tracing-channel/mysql2.ts @@ -3,7 +3,6 @@ import type { IntegrationFn, SpanAttributes } from '@sentry/core'; import { defineIntegration, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_KIND, startInactiveSpan, @@ -20,6 +19,7 @@ import { DB_USER, NET_PEER_NAME, NET_PEER_PORT, + SENTRY_OP, } from '@sentry/conventions/attributes'; const INTEGRATION_NAME = 'Mysql2' as const; @@ -85,7 +85,7 @@ function subscribeQueryChannel(channelName: ChannelName): void { kind: SPAN_KIND.CLIENT, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', + [SENTRY_OP]: 'db', // oxlint-disable-next-line typescript/no-deprecated [DB_SYSTEM]: DB_SYSTEM_VALUE_MYSQL, ...getConnectionAttributes(data.self?.config), diff --git a/packages/server-utils/src/integrations/tracing-channel/redis.ts b/packages/server-utils/src/integrations/tracing-channel/redis.ts index 6dedde81bafb..1e3ff095fc24 100644 --- a/packages/server-utils/src/integrations/tracing-channel/redis.ts +++ b/packages/server-utils/src/integrations/tracing-channel/redis.ts @@ -11,6 +11,7 @@ import { NET_PEER_PORT, SERVER_ADDRESS, SERVER_PORT, + SENTRY_OP, } from '@sentry/conventions/attributes'; import type { IntegrationFn, Span, SpanAttributes } from '@sentry/core'; import { @@ -18,7 +19,6 @@ import { debug, defineIntegration, getActiveSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_KIND, SPAN_STATUS_ERROR, @@ -148,7 +148,7 @@ function startCommandSpan(commandName: string, commandArgs: Array 1 ? { [DB_OPERATION_BATCH_SIZE]: size } : {}), ...(socket?.host != null ? { [SERVER_ADDRESS]: socket.host } : {}), diff --git a/packages/server-utils/src/mongoose/mongoose-dc-subscriber.ts b/packages/server-utils/src/mongoose/mongoose-dc-subscriber.ts index 0bbc7ca63df0..f12418d509ca 100644 --- a/packages/server-utils/src/mongoose/mongoose-dc-subscriber.ts +++ b/packages/server-utils/src/mongoose/mongoose-dc-subscriber.ts @@ -8,14 +8,9 @@ import { DB_SYSTEM_NAME, SERVER_ADDRESS, SERVER_PORT, + SENTRY_OP, } from '@sentry/conventions/attributes'; -import { - isObjectLike, - debug, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { isObjectLike, debug, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { bindTracingChannelToSpan } from '../tracing-channel'; @@ -125,7 +120,7 @@ function setupChannel(tracingChannel: MongooseTracingChannelFactory, channelName name: collection ? `mongoose.${collection}.${data.operation}` : `mongoose.${data.operation}`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', + [SENTRY_OP]: 'db', [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB, [DB_OPERATION_NAME]: data.operation, [DB_COLLECTION_NAME]: collection ?? undefined, diff --git a/packages/server-utils/src/mysql2/mysql2-dc-subscriber.ts b/packages/server-utils/src/mysql2/mysql2-dc-subscriber.ts index bf3c1fb462a3..33800941b8a8 100644 --- a/packages/server-utils/src/mysql2/mysql2-dc-subscriber.ts +++ b/packages/server-utils/src/mysql2/mysql2-dc-subscriber.ts @@ -6,13 +6,9 @@ import { DB_SYSTEM_NAME, SERVER_ADDRESS, SERVER_PORT, + SENTRY_OP, } from '@sentry/conventions/attributes'; -import { - _INTERNAL_sanitizeSqlQuery, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { _INTERNAL_sanitizeSqlQuery, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../tracing-channel'; // Channel names published by mysql2 >= 3.20.0 (see mysql2 `lib/tracing.js`). @@ -105,7 +101,7 @@ function setupQueryChannel(tracingChannel: MySQL2TracingChannelFactory, channelN name: queryText || 'mysql2.query', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', + [SENTRY_OP]: 'db', [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL, [DB_QUERY_TEXT]: queryText, [DB_OPERATION_NAME]: operation, @@ -127,7 +123,7 @@ function setupConnectChannel(tracingChannel: MySQL2TracingChannelFactory, channe name: spanName, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', + [SENTRY_OP]: 'db', [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL, [DB_NAMESPACE]: data.database || undefined, [SERVER_ADDRESS]: data.serverAddress, diff --git a/packages/server-utils/src/redis/redis-dc-subscriber.ts b/packages/server-utils/src/redis/redis-dc-subscriber.ts index 860f61138ae8..7ca40cd35564 100644 --- a/packages/server-utils/src/redis/redis-dc-subscriber.ts +++ b/packages/server-utils/src/redis/redis-dc-subscriber.ts @@ -5,9 +5,10 @@ import { DB_SYSTEM_NAME, SERVER_ADDRESS, SERVER_PORT, + SENTRY_OP, } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../tracing-channel'; // Channel names published by node-redis >= 5.12.0 and ioredis >= 5.11.0. @@ -155,7 +156,7 @@ function setupCommandChannel( name: `redis-${data.command}`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis', + [SENTRY_OP]: 'db.redis', [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, [DB_QUERY_TEXT]: statement, ...(data.serverAddress != null ? { [SERVER_ADDRESS]: data.serverAddress } : {}), @@ -182,7 +183,7 @@ function setupBatchChannel( name: getOperationName(data), attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis', + [SENTRY_OP]: 'db.redis', [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, // should only include batch size greater than 1, // or else it isn't properly considered a "batch" @@ -200,7 +201,7 @@ function setupConnectChannel(tracingChannel: RedisTracingChannelFactory, channel name: 'redis-connect', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis.connect', + [SENTRY_OP]: 'db.redis.connect', [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, ...(data.serverAddress != null ? { [SERVER_ADDRESS]: data.serverAddress } : {}), ...(data.serverPort != null ? { [SERVER_PORT]: data.serverPort } : {}), diff --git a/packages/solid/src/solidrouter.ts b/packages/solid/src/solidrouter.ts index 6041253a2d28..4357dbd669ed 100644 --- a/packages/solid/src/solidrouter.ts +++ b/packages/solid/src/solidrouter.ts @@ -12,14 +12,10 @@ import { URL_PATH, URL_PATH_PARAMETER_KEY_BASE, URL_TEMPLATE, + SENTRY_OP, } from '@sentry/conventions/attributes'; import type { Client, Integration, Span } from '@sentry/core'; -import { - getClient, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core'; +import { getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; import type { BeforeLeaveEventArgs, HashRouter, @@ -64,7 +60,7 @@ function handleNavigation(location: string): void { { name: location, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.${framework}.solidrouter`, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', }, diff --git a/packages/solid/src/tanstackrouter.ts b/packages/solid/src/tanstackrouter.ts index bc03ba841ff6..94389efee684 100644 --- a/packages/solid/src/tanstackrouter.ts +++ b/packages/solid/src/tanstackrouter.ts @@ -11,13 +11,10 @@ import { URL_PATH, URL_PATH_PARAMETER_KEY_BASE, URL_TEMPLATE, + SENTRY_OP, } from '@sentry/conventions/attributes'; import type { Integration } from '@sentry/core'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; import type { AnyRouter } from '@tanstack/solid-router'; type RouteMatch = ReturnType[number]; @@ -86,7 +83,7 @@ export function tanstackRouterBrowserTracingIntegration( const pageloadSpan = startBrowserTracingPageLoadSpan(client, { name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.solid.tanstack_router', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), @@ -137,7 +134,7 @@ export function tanstackRouterBrowserTracingIntegration( { name: routeMatch ? routeMatch.routeId : fallbackName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.tanstack_router', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), diff --git a/packages/solid/test/solidrouter.test.tsx b/packages/solid/test/solidrouter.test.tsx index f33b7e72daf4..009d2be9d6b3 100644 --- a/packages/solid/test/solidrouter.test.tsx +++ b/packages/solid/test/solidrouter.test.tsx @@ -1,9 +1,9 @@ +import { SENTRY_OP } 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, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, @@ -75,7 +75,7 @@ describe('solidRouterBrowserTracingIntegration', () => { description: '/', data: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', }), }), @@ -107,7 +107,7 @@ describe('solidRouterBrowserTracingIntegration', () => { description: '/', data: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', }), }), @@ -152,7 +152,7 @@ describe('solidRouterBrowserTracingIntegration', () => { expect(span.description).toBe(parametrizedRoute); expect(span.data).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter', }); @@ -189,7 +189,7 @@ describe('solidRouterBrowserTracingIntegration', () => { description: '/about', data: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter', }), }), diff --git a/packages/solidstart/package.json b/packages/solidstart/package.json index ac54823eb596..2ac315638741 100644 --- a/packages/solidstart/package.json +++ b/packages/solidstart/package.json @@ -72,6 +72,7 @@ "@sentry/bundler-plugins": "10.67.0" }, "devDependencies": { + "@sentry/conventions": "^0.16.0", "@solidjs/router": "^0.15.0", "@solidjs/start": "^1.2.1", "@solidjs/testing-library": "0.8.5", diff --git a/packages/solidstart/src/server/index.ts b/packages/solidstart/src/server/index.ts index fd5fbb2e0e39..43b48025d3f3 100644 --- a/packages/solidstart/src/server/index.ts +++ b/packages/solidstart/src/server/index.ts @@ -88,7 +88,6 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, diff --git a/packages/solidstart/test/client/solidrouter.test.tsx b/packages/solidstart/test/client/solidrouter.test.tsx index 1b9623cabc13..92e3685277ad 100644 --- a/packages/solidstart/test/client/solidrouter.test.tsx +++ b/packages/solidstart/test/client/solidrouter.test.tsx @@ -1,9 +1,9 @@ +import { SENTRY_OP } 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, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, @@ -75,7 +75,7 @@ describe('solidRouterBrowserTracingIntegration', () => { description: '/', data: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', }), }), @@ -107,7 +107,7 @@ describe('solidRouterBrowserTracingIntegration', () => { description: '/', data: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', }), }), @@ -152,7 +152,7 @@ describe('solidRouterBrowserTracingIntegration', () => { expect(span.description).toBe(parametrizedRoute); expect(span.data).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solidstart.solidrouter', }); @@ -189,7 +189,7 @@ describe('solidRouterBrowserTracingIntegration', () => { description: '/about', data: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_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 cdfb8050e20d..1d9cb5080cdf 100644 --- a/packages/solidstart/test/server/withServerActionInstrumentation.test.ts +++ b/packages/solidstart/test/server/withServerActionInstrumentation.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; import * as SentryNode from '@sentry/node'; import { @@ -5,7 +6,6 @@ import { getCurrentScope, getIsolationScope, NodeClient, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, @@ -105,7 +105,7 @@ describe('withServerActionInstrumentation', () => { op: 'function.server_action', description: 'getPrefecture', data: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.server_action', + [SENTRY_OP]: 'function.server_action', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', }), diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 77a8368f0138..b6e7fd8638f3 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -40,6 +40,7 @@ "svelte": "3.x || 4.x || 5.x" }, "devDependencies": { + "@sentry/conventions": "^0.16.0", "@sveltejs/vite-plugin-svelte": "1.4.0", "@testing-library/svelte": "^3.2.1", "svelte": "3.59.2", diff --git a/packages/svelte/test/performance.test.ts b/packages/svelte/test/performance.test.ts index 9d439b6275ba..5666b93beb5b 100644 --- a/packages/svelte/test/performance.test.ts +++ b/packages/svelte/test/performance.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; /** * @vitest-environment jsdom */ @@ -52,7 +53,7 @@ describe('Sentry.trackComponent()', () => { expect(transaction.spans![0]).toEqual({ data: { - 'sentry.op': 'ui.svelte.init', + [SENTRY_OP]: 'ui.svelte.init', 'sentry.origin': 'auto.ui.svelte', }, description: '', @@ -92,7 +93,7 @@ describe('Sentry.trackComponent()', () => { expect(transaction.spans![0]).toEqual({ data: { - 'sentry.op': 'ui.svelte.init', + [SENTRY_OP]: 'ui.svelte.init', 'sentry.origin': 'auto.ui.svelte', }, description: '', @@ -107,7 +108,7 @@ describe('Sentry.trackComponent()', () => { expect(transaction.spans![1]).toEqual({ data: { - 'sentry.op': 'ui.svelte.update', + [SENTRY_OP]: 'ui.svelte.update', 'sentry.origin': 'auto.ui.svelte', }, description: '', @@ -122,7 +123,7 @@ describe('Sentry.trackComponent()', () => { expect(transaction.spans![2]).toEqual({ data: { - 'sentry.op': 'ui.svelte.update', + [SENTRY_OP]: 'ui.svelte.update', 'sentry.origin': 'auto.ui.svelte', }, description: '', diff --git a/packages/sveltekit/src/server-common/handle.ts b/packages/sveltekit/src/server-common/handle.ts index 5ebdbf97d98b..cc7ae46faaa8 100644 --- a/packages/sveltekit/src/server-common/handle.ts +++ b/packages/sveltekit/src/server-common/handle.ts @@ -9,7 +9,6 @@ import { getIsolationScope, getTraceMetaTags, httpHeadersToSpanAttributes, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, @@ -23,7 +22,7 @@ import { import type { Handle, ResolveOptions } from '@sveltejs/kit'; import { DEBUG_BUILD } from '../common/debug-build'; import { getTracePropagationData, sendErrorToSentry } from './utils'; -import { HTTP_URL, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { HTTP_URL, URL_FULL, URL_PATH, SENTRY_OP } from '@sentry/conventions/attributes'; export type SentryHandleOptions = { /** @@ -175,7 +174,7 @@ async function instrumentHandle( } kitRootSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeName ? 'route' : 'url', 'sveltekit.tracing.original_name': originalName, diff --git a/packages/sveltekit/src/server-common/integrations/svelteKitSpans.ts b/packages/sveltekit/src/server-common/integrations/svelteKitSpans.ts index dd8912f54a65..cad6b450131a 100644 --- a/packages/sveltekit/src/server-common/integrations/svelteKitSpans.ts +++ b/packages/sveltekit/src/server-common/integrations/svelteKitSpans.ts @@ -1,9 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Integration, SpanJSON, SpanOrigin, StreamedSpanJSON } from '@sentry/core'; -import { - safeSetSpanJSONAttributes, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '@sentry/core'; +import { safeSetSpanJSONAttributes, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; /** * A small integration that preprocesses spans so that SvelteKit-generated spans @@ -37,12 +34,12 @@ export function svelteKitSpansIntegration(): Integration { export function _enhanceKitSpan(span: SpanJSON): void { const { op, origin } = _getKitSpanEnhancement(span.description); - const previousOp = span.op || span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]; + const previousOp = span.op || span.data[SENTRY_OP]; const previousOrigin = span.origin || span.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]; if (!previousOp && op) { span.op = op; - span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = op; + span.data[SENTRY_OP] = op; } if ((!previousOrigin || previousOrigin === 'manual') && origin) { @@ -60,7 +57,7 @@ export function _enhanceKitSpanStreamed(span: StreamedSpanJSON): void { const previousOrigin = span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined; if (op) { - safeSetSpanJSONAttributes(span, { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op }); + safeSetSpanJSONAttributes(span, { [SENTRY_OP]: op }); } if (previousOrigin === 'manual' && origin) { diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index 5ebd934e9e88..e32f47ca128f 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -85,7 +85,6 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, diff --git a/packages/sveltekit/src/worker/index.ts b/packages/sveltekit/src/worker/index.ts index de2146c9e259..c251d5f549c2 100644 --- a/packages/sveltekit/src/worker/index.ts +++ b/packages/sveltekit/src/worker/index.ts @@ -54,7 +54,6 @@ export { rewriteFramesIntegration, Scope, SDK_VERSION, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, diff --git a/packages/sveltekit/test/server-common/integrations/svelteKitSpans.test.ts b/packages/sveltekit/test/server-common/integrations/svelteKitSpans.test.ts index b051d613aad1..5b70649d1c6b 100644 --- a/packages/sveltekit/test/server-common/integrations/svelteKitSpans.test.ts +++ b/packages/sveltekit/test/server-common/integrations/svelteKitSpans.test.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } 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 { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { _enhanceKitSpan, @@ -47,7 +48,7 @@ describe('svelteKitSpansIntegration', () => { expect(event.spans).toHaveLength(1); expect(event.spans?.[0]?.op).toBe('function.sveltekit.resolve'); expect(event.spans?.[0]?.origin).toBe('auto.http.sveltekit'); - expect(event.spans?.[0]?.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('function.sveltekit.resolve'); + expect(event.spans?.[0]?.data[SENTRY_OP]).toBe('function.sveltekit.resolve'); expect(event.spans?.[0]?.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); }); @@ -74,7 +75,7 @@ describe('svelteKitSpansIntegration', () => { expect(span.op).toBe(op); expect(span.origin).toBe(origin); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe(op); + expect(span.data[SENTRY_OP]).toBe(op); expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe(origin); }); @@ -88,7 +89,7 @@ describe('svelteKitSpansIntegration', () => { expect(span.op).toBeUndefined(); expect(span.origin).toBeUndefined(); - expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBeUndefined(); + expect(span.data[SENTRY_OP]).toBeUndefined(); expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBeUndefined(); }); @@ -98,7 +99,7 @@ describe('svelteKitSpansIntegration', () => { op: 'http.server', origin: 'auto.http.sveltekit', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', }, span_id: '123', @@ -108,7 +109,7 @@ describe('svelteKitSpansIntegration', () => { _enhanceKitSpan(rootHandleSpan); - expect(rootHandleSpan.data[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); + expect(rootHandleSpan.data[SENTRY_OP]).toBe('http.server'); expect(rootHandleSpan.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); expect(rootHandleSpan.op).toBe('http.server'); expect(rootHandleSpan.origin).toBe('auto.http.sveltekit'); @@ -118,7 +119,7 @@ describe('svelteKitSpansIntegration', () => { const span = { description: 'someOtherSpan', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', + [SENTRY_OP]: 'db', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.pg', }, op: 'db', @@ -132,7 +133,7 @@ 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[SENTRY_OP]).toBe('db'); expect(span.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.db.pg'); }); @@ -142,7 +143,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 +153,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 +162,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 +172,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,7 +203,7 @@ describe('svelteKitSpansIntegration', () => { _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe(op); + expect(span.attributes?.[SENTRY_OP]).toBe(op); expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe(origin); }); @@ -211,7 +212,7 @@ describe('svelteKitSpansIntegration', () => { _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBeUndefined(); + expect(span.attributes?.[SENTRY_OP]).toBeUndefined(); expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBeUndefined(); }); @@ -219,14 +220,14 @@ describe('svelteKitSpansIntegration', () => { const rootHandleSpan = makeStreamedSpan({ name: 'sveltekit.handle.root', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', + [SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', }, }); _enhanceKitSpanStreamed(rootHandleSpan); - expect(rootHandleSpan.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); + expect(rootHandleSpan.attributes?.[SENTRY_OP]).toBe('http.server'); expect(rootHandleSpan.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.sveltekit'); }); @@ -234,14 +235,14 @@ describe('svelteKitSpansIntegration', () => { const span = makeStreamedSpan({ name: 'someOtherSpan', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db', + [SENTRY_OP]: 'db', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.pg', }, }); _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('db'); + expect(span.attributes?.[SENTRY_OP]).toBe('db'); expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.db.pg'); }); @@ -250,14 +251,14 @@ describe('svelteKitSpansIntegration', () => { const span = makeStreamedSpan({ name: 'sveltekit.resolve', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'custom.op', + [SENTRY_OP]: 'custom.op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.custom.origin', }, }); _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('custom.op'); + expect(span.attributes?.[SENTRY_OP]).toBe('custom.op'); expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.custom.origin'); }); @@ -265,14 +266,14 @@ describe('svelteKitSpansIntegration', () => { const span = makeStreamedSpan({ name: 'sveltekit.resolve', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'custom.op', + [SENTRY_OP]: 'custom.op', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', }, }); _enhanceKitSpanStreamed(span); - expect(span.attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('custom.op'); + expect(span.attributes?.[SENTRY_OP]).toBe('custom.op'); expect(span.attributes?.[SEMANTIC_ATTRIBUTE_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 45ec289ed230..f8133d72110b 100644 --- a/packages/sveltekit/test/server-common/load.test.ts +++ b/packages/sveltekit/test/server-common/load.test.ts @@ -1,9 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { Event } from '@sentry/core'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; import * as SentryCore from '@sentry/core'; import { getCurrentScope, getIsolationScope, NodeClient, setCurrentClient } from '@sentry/node'; import type { Load, ServerLoad } from '@sveltejs/kit'; @@ -258,7 +255,7 @@ describe('wrapServerLoadWithSentry calls `startSpan`', () => { data: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function.sveltekit.server.load', + [SENTRY_OP]: 'function.sveltekit.server.load', 'http.method': 'GET', 'sentry.sample_rate': 1, }, diff --git a/packages/tanstackstart-react/src/server/utils.ts b/packages/tanstackstart-react/src/server/utils.ts index 9ff87c8ebbf4..03c8562b48b9 100644 --- a/packages/tanstackstart-react/src/server/utils.ts +++ b/packages/tanstackstart-react/src/server/utils.ts @@ -1,5 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import type { StartSpanOptions } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/node'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/node'; /** * Returns span options for TanStack Start middleware spans. @@ -10,7 +11,7 @@ export function getMiddlewareSpanOptions(name: string): StartSpanOptions { name, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.middleware.tanstackstart', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'middleware.tanstackstart', + [SENTRY_OP]: 'middleware.tanstackstart', }, }; } diff --git a/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts b/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts index fab2788cd234..3f78ac8c18e6 100644 --- a/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts +++ b/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts @@ -1,10 +1,6 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { flushIfServerless, getTraceMetaTags } from '@sentry/core'; -import { - captureException, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startSpan, -} from '@sentry/node'; +import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/node'; import { updateSpanWithRouteParametrization } from './routeParametrization'; declare const __SENTRY_ROUTE_PATTERNS__: string[] | undefined; @@ -150,7 +146,7 @@ export function wrapFetchWithSentry(serverEntry: ServerEntry): ServerEntry { name: `${method} ${url.pathname}`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server', - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, + [SENTRY_OP]: op, }, }, async () => { diff --git a/packages/tanstackstart-react/test/server/utils.test.ts b/packages/tanstackstart-react/test/server/utils.test.ts index 66540bf3dfb3..64ea3e932c87 100644 --- a/packages/tanstackstart-react/test/server/utils.test.ts +++ b/packages/tanstackstart-react/test/server/utils.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { describe, expect, it } from 'vitest'; import { getMiddlewareSpanOptions } from '../../src/server/utils'; @@ -8,7 +9,7 @@ describe('getMiddlewareSpanOptions', () => { op: 'middleware.tanstackstart', name: 'testMiddleware', attributes: { - 'sentry.op': 'middleware.tanstackstart', + [SENTRY_OP]: 'middleware.tanstackstart', 'sentry.origin': 'auto.middleware.tanstackstart', }, }); diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index d8e277f9fea0..64677899f3d5 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -89,7 +89,6 @@ export { instrumentSupabaseClient, zodErrorsIntegration, consoleIntegration, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, diff --git a/packages/vue/src/tanstackrouter.ts b/packages/vue/src/tanstackrouter.ts index e2508f2754df..da9e5f6d96cc 100644 --- a/packages/vue/src/tanstackrouter.ts +++ b/packages/vue/src/tanstackrouter.ts @@ -11,13 +11,10 @@ import { URL_PATH, URL_PATH_PARAMETER_KEY_BASE, URL_TEMPLATE, + SENTRY_OP, } from '@sentry/conventions/attributes'; import type { Integration } from '@sentry/core'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; import type { AnyRouter } from '@tanstack/vue-router'; type RouteMatch = ReturnType[number]; @@ -92,7 +89,7 @@ export function tanstackRouterBrowserTracingIntegration( const pageloadSpan = startBrowserTracingPageLoadSpan(client, { name: routeMatch ? routeMatch.routeId : initialWindowLocation.pathname, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', + [SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue.tanstack_router', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), @@ -144,7 +141,7 @@ export function tanstackRouterBrowserTracingIntegration( { name: routeMatch ? routeMatch.routeId : fallbackName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', + [SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue.tanstack_router', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }),