From e6c54fef7b33122a4bdf6206c92db160e24d84f1 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 13:45:12 +0200 Subject: [PATCH 01/13] ref(core)!: Migrate to SENTRY_SEGMENT_NAME_SOURCE Replace sentry.source with sentry.segment.name.source and set the attribute only on segment spans. Fixes #22259 Co-Authored-By: Cursor Grok 4.6 --- docs/migration/v11-end-state.md | 2 + packages/angular/src/tracing.ts | 18 +++-- .../src/client/browserTracingIntegration.ts | 5 +- packages/astro/src/index.server.ts | 2 +- packages/astro/src/server/middleware.ts | 13 +++- packages/aws-serverless/src/index.ts | 2 +- packages/browser/src/exports.ts | 1 - .../src/tracing/browserTracingIntegration.ts | 13 ++-- packages/bun/src/index.ts | 2 +- packages/bun/src/integrations/bunserver.ts | 8 +-- packages/cloudflare/src/index.ts | 2 +- .../worker/instrumentEmail.ts | 12 +--- .../worker/instrumentQueue.ts | 12 +--- .../worker/instrumentScheduled.ts | 12 +--- packages/cloudflare/src/workflows.ts | 5 +- .../integrations/http/server-subscription.ts | 11 ++- .../core/src/integrations/mcp-server/spans.ts | 9 +-- packages/core/src/semanticAttributes.ts | 7 -- packages/core/src/shared-exports.ts | 2 + .../src/tracing/dynamicSamplingContext.ts | 6 +- packages/core/src/tracing/sentrySpan.ts | 21 ++++-- .../core/src/tracing/spans/captureSpan.ts | 11 --- packages/core/src/tracing/trace.ts | 9 +-- packages/core/src/trpc.ts | 8 ++- packages/core/src/types/span.ts | 2 +- packages/core/src/utils/spanUtils.ts | 30 ++++++-- packages/core/src/utils/url.ts | 21 +++--- .../test/lib/utils/segmentNameSource.test.ts | 71 +++++++++++++++++++ packages/deno/src/index.ts | 2 +- packages/elysia/src/index.ts | 2 +- packages/elysia/src/withElysia.ts | 7 +- ...nstrumentEmberAppInstanceForPerformance.ts | 22 +++--- .../src/utils/instrumentRoutePerformance.ts | 19 ++--- .../src/gcpfunction/cloud_events.ts | 11 +-- .../src/gcpfunction/events.ts | 11 +-- .../src/gcpfunction/http.ts | 5 +- packages/google-cloud-serverless/src/index.ts | 2 +- .../hono/src/shared/middlewareHandlers.ts | 9 +-- .../test/shared/middlewareHandlers.test.ts | 10 ++- .../appRouterRoutingInstrumentation.ts | 17 +++-- .../pagesRouterRoutingInstrumentation.ts | 7 +- .../src/common/enhanceMiddlewareRootSpan.ts | 6 +- .../src/common/utils/liveRootSpanAdapter.ts | 7 +- .../nextjs/src/common/utils/tracingUtils.ts | 6 +- .../common/withServerActionInstrumentation.ts | 5 +- .../src/common/wrapRouteHandlerWithSentry.ts | 5 +- .../src/edge/enhanceRunHandlerRootSpan.ts | 6 +- packages/nextjs/src/edge/index.ts | 7 +- .../server/enhanceHandleRequestRootSpan.ts | 16 +++-- .../nextjs/src/server/handleOnSpanStart.ts | 19 +++-- packages/node/src/index.ts | 2 +- .../http/httpServerSpansIntegration.ts | 4 +- packages/node/src/integrations/http/index.ts | 9 +-- .../node-fetch/undici-instrumentation.ts | 4 -- .../node/test/integrations/undici.test.ts | 3 +- .../runtime/hooks/wrapMiddlewareHandler.ts | 5 +- .../src/client/createClientInstrumentation.ts | 17 +++-- .../react-router/src/client/hydratedRouter.ts | 11 ++- packages/react-router/src/client/utils.ts | 8 +-- .../src/server/createServerInstrumentation.ts | 8 +-- .../src/server/wrapSentryHandleRequest.ts | 7 +- .../instrumentation.tsx | 21 +++--- packages/react/src/reactrouter.tsx | 9 ++- packages/react/src/reactrouterv3.ts | 7 +- packages/react/src/tanstackrouter.ts | 13 ++-- packages/remix/src/client/performance.tsx | 9 ++- packages/remix/src/cloudflare/index.ts | 2 +- packages/remix/src/server/index.ts | 1 - packages/remix/src/server/instrumentServer.ts | 18 +++-- .../server/integrations/tracing-channel.ts | 6 +- packages/replay-internal/src/replay.ts | 5 +- .../server-utils/src/integrations/amqplib.ts | 4 +- .../src/integrations/firebase/functions.ts | 11 ++- .../src/integrations/graphql/utils.ts | 8 +-- .../src/integrations/redis/redis-cache.ts | 4 +- .../utils/setHttpServerSpanRouteAttribute.ts | 12 +++- packages/solid/src/solidrouter.ts | 8 +-- packages/solid/src/tanstackrouter.ts | 8 +-- packages/solidstart/src/server/index.ts | 2 +- .../server/withServerActionInstrumentation.ts | 12 +++- packages/sveltekit/src/client/load.ts | 5 +- .../src/client/svelte4BrowserTracing.ts | 15 ++-- .../src/client/svelte5BrowserTracing.ts | 15 ++-- .../sveltekit/src/server-common/handle.ts | 7 +- packages/sveltekit/src/server-common/load.ts | 14 ++-- .../src/server-common/serverRoute.ts | 9 +-- packages/sveltekit/src/server/index.ts | 1 - packages/sveltekit/src/worker/index.ts | 1 - .../src/server/globalMiddleware.ts | 13 +--- .../src/server/routeParametrization.ts | 5 +- packages/vercel-edge/src/index.ts | 2 +- packages/vue/src/router.ts | 8 +-- packages/vue/src/tanstackrouter.ts | 8 +-- 93 files changed, 444 insertions(+), 415 deletions(-) create mode 100644 packages/core/test/lib/utils/segmentNameSource.test.ts diff --git a/docs/migration/v11-end-state.md b/docs/migration/v11-end-state.md index f4b13aa3af11..53ad481b90d6 100644 --- a/docs/migration/v11-end-state.md +++ b/docs/migration/v11-end-state.md @@ -638,6 +638,8 @@ Attribute availability remains runtime-dependent. For example, browser and Worke Span attributes now use the shared `@sentry/conventions` package under the hood. The deprecated `semanticAttributes` re-export was removed. Import span attribute constants from `@sentry/core` directly. +`SEMANTIC_ATTRIBUTE_SENTRY_SOURCE` (`sentry.source`) was removed. Use `SENTRY_SEGMENT_NAME_SOURCE` (`sentry.segment.name.source`) instead. +`sentry.segment.name.source` is only set on segment spans. Setting it on a child span is a no-op: `setAttribute` ignores it, and a value passed in a child span's initial attributes is dropped when the span is linked to its parent. To set it defensively, use `setSegmentNameSourceIfSegment(span, source)` from `@sentry/core`, which no-ops unless `span` is the segment. ### Span operation (`op`) changes diff --git a/packages/angular/src/tracing.ts b/packages/angular/src/tracing.ts index 47fd6014eb61..6fc69ef6a962 100644 --- a/packages/angular/src/tracing.ts +++ b/packages/angular/src/tracing.ts @@ -15,13 +15,19 @@ import { getCurrentScope, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startBrowserTracingNavigationSpan, startInactiveSpan, getAbsoluteUrl, } from '@sentry/browser'; -import { CODE_FUNCTION_NAME, SENTRY_OP, URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + CODE_FUNCTION_NAME, + SENTRY_OP, + URL_FULL, + URL_PATH, + URL_TEMPLATE, +} from '@sentry/conventions/attributes'; import { GENERAL_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; import type { Integration, Span } from '@sentry/core'; import { @@ -70,14 +76,14 @@ export function _updateSpanAttributesForParametrizedUrl(route: string, url: stri const attributes = spanToJSON(span).attributes; - if (!attributes || attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === 'url') { + if (!attributes || attributes[SENTRY_SEGMENT_NAME_SOURCE] === 'url') { span.updateName(route); const absoluteUrl = getAbsoluteUrl(url); span.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.${attributes[SENTRY_OP]}.angular`, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_FULL]: filterCollectedUrl(absoluteUrl), [URL_PATH]: parseStringToURLObject(absoluteUrl)?.pathname, [URL_TEMPLATE]: route, @@ -118,7 +124,7 @@ export class TraceService implements OnDestroy { name: strippedUrl, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.angular', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }, { @@ -141,7 +147,7 @@ export class TraceService implements OnDestroy { // TODO(conventions): Replace `'router'` with the `router` span op constant once it is released in `@sentry/conventions`. [SENTRY_OP]: 'router', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: strippedUrl, ...(navigationEvent.navigationTrigger && { navigationTrigger: navigationEvent.navigationTrigger, diff --git a/packages/astro/src/client/browserTracingIntegration.ts b/packages/astro/src/client/browserTracingIntegration.ts index 10842f2eff17..fc432b04e7f9 100644 --- a/packages/astro/src/client/browserTracingIntegration.ts +++ b/packages/astro/src/client/browserTracingIntegration.ts @@ -10,10 +10,9 @@ import { hasSpanStreamingEnabled, PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; /** * Returns the value of a meta-tag @@ -49,7 +48,7 @@ export function browserTracingIntegration( // pageload should always start at timeOrigin (and needs to be in s, not ms) startTime: origin ? origin / 1000 : undefined, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.astro', ...(source === 'route' && { [URL_TEMPLATE]: name }), }, diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index 0e7571cc4a6e..16a6986007a8 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -112,7 +112,7 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, setContext, setConversationId, setCurrentClient, diff --git a/packages/astro/src/server/middleware.ts b/packages/astro/src/server/middleware.ts index 00b3623aeb80..31d42d8f3742 100644 --- a/packages/astro/src/server/middleware.ts +++ b/packages/astro/src/server/middleware.ts @@ -1,5 +1,13 @@ /* eslint-disable max-lines */ -import { HTTP_ROUTE, SENTRY_OP, URL_FRAGMENT, URL_FULL, URL_PATH, URL_QUERY } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + HTTP_ROUTE, + SENTRY_OP, + URL_FRAGMENT, + URL_FULL, + URL_PATH, + URL_QUERY, +} from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '@sentry/core'; import { addNonEnumerableProperty, @@ -24,7 +32,6 @@ import { getTraceMetaTags, httpHeadersToSpanAttributes, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, startSpan, winterCGHeadersToDict, @@ -212,7 +219,7 @@ async function instrumentRequestStartHttpServerSpan( const attributes: SpanAttributes = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.astro', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, [SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD]: method, // This is here for backwards compatibility, we used to set this here before method, diff --git a/packages/aws-serverless/src/index.ts b/packages/aws-serverless/src/index.ts index 43835cea6313..e89f4228a0eb 100644 --- a/packages/aws-serverless/src/index.ts +++ b/packages/aws-serverless/src/index.ts @@ -89,7 +89,7 @@ export { parameterize, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, expressIntegration, diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index 5716c98db98c..6cb5f41c60fa 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -79,7 +79,6 @@ export { export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, } from '@sentry/core/browser'; diff --git a/packages/browser/src/tracing/browserTracingIntegration.ts b/packages/browser/src/tracing/browserTracingIntegration.ts index 7b92855d936f..5cfbd5dfbfac 100644 --- a/packages/browser/src/tracing/browserTracingIntegration.ts +++ b/packages/browser/src/tracing/browserTracingIntegration.ts @@ -30,7 +30,6 @@ import { registerSpanErrorInstrumentation, SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanIsSampled, spanToJSON, startIdleSpan, @@ -52,7 +51,7 @@ import { WEB_VITALS_INTEGRATION_NAME, webVitalsIntegration } from '../integratio import { registerBackgroundTabDetection } from './backgroundtab'; import { linkTraces } from './linkedTraces'; import { defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from './request'; -import { SENTRY_OP, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; export const BROWSER_TRACING_INTEGRATION_ID = 'BrowserTracing'; @@ -387,7 +386,7 @@ export const browserTracingIntegration = ((options: Partial( // If a route has parameters, it's a parameterized route if (route) { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + attributes[SENTRY_SEGMENT_NAME_SOURCE] = 'route'; attributes['url.template'] = route; routeName = route; } @@ -215,7 +215,7 @@ function wrapRequestHandler( // Handle wildcard routes if (route?.endsWith('/*')) { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + attributes[SENTRY_SEGMENT_NAME_SOURCE] = 'route'; attributes['url.template'] = route; routeName = route; } @@ -287,7 +287,7 @@ function getSpanAttributesFromParsedUrl( const attributes: SpanAttributes = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.bun.serve', [SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD]: request.method || 'GET', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }; if (parsedUrl) { diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index 059362ee3297..ca7e382351e3 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -89,7 +89,7 @@ export { consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToStaticSpanJSON, diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentEmail.ts b/packages/cloudflare/src/instrumentations/worker/instrumentEmail.ts index ed2d9a05f7f5..a9b5932a3fdf 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentEmail.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentEmail.ts @@ -1,15 +1,9 @@ import type { EmailMessage } from '@cloudflare/workers-types'; import type { AnyExportedHandler } from '../../types'; import type { env as cloudflareEnv } from 'cloudflare:workers'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; import { GENERAL_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; -import { - captureException, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - startSpan, - withIsolationScope, -} from '@sentry/core'; +import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, withIsolationScope } from '@sentry/core'; import type { CloudflareOptions } from '../../client'; import { flushAndDispose } from '../../flush'; import { ensureInstrumented } from '../../instrument'; @@ -43,7 +37,7 @@ function wrapEmailHandler( [SENTRY_OP]: GENERAL_FUNCTION_SPAN_OP, 'faas.trigger': 'email', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.email', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, async () => { diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts index ac609e241a55..7849c0f632ef 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts @@ -1,15 +1,9 @@ import type { MessageBatch } from '@cloudflare/workers-types'; import type { AnyExportedHandler } from '../../types'; import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; import { MESSAGING_QUEUE_PROCESS_SPAN_OP } from '@sentry/conventions/op'; -import { - captureException, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - startSpan, - withIsolationScope, -} from '@sentry/core'; +import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, withIsolationScope } from '@sentry/core'; import type { CloudflareOptions } from '../../client'; import { flushAndDispose } from '../../flush'; import { ensureInstrumented } from '../../instrument'; @@ -49,7 +43,7 @@ function wrapQueueHandler( 'messaging.batch.message_count': batch.messages.length, 'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts - 1, 0), [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, async () => { diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentScheduled.ts b/packages/cloudflare/src/instrumentations/worker/instrumentScheduled.ts index 018dd8b56ee1..900bb64bfb51 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentScheduled.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentScheduled.ts @@ -1,15 +1,9 @@ import type { ScheduledController } from '@cloudflare/workers-types'; import type { AnyExportedHandler } from '../../types'; import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; import { GENERAL_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; -import { - captureException, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - startSpan, - withIsolationScope, -} from '@sentry/core'; +import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, withIsolationScope } from '@sentry/core'; import type { CloudflareOptions } from '../../client'; import { flushAndDispose } from '../../flush'; import { ensureInstrumented } from '../../instrument'; @@ -42,7 +36,7 @@ function wrapScheduledHandler( 'faas.time': new Date(controller.scheduledTime).toISOString(), 'faas.trigger': 'timer', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.scheduled', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, async () => { diff --git a/packages/cloudflare/src/workflows.ts b/packages/cloudflare/src/workflows.ts index 09a639c84c91..06a7f91c9c69 100644 --- a/packages/cloudflare/src/workflows.ts +++ b/packages/cloudflare/src/workflows.ts @@ -1,4 +1,4 @@ -import { CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; import { GENERAL_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; import type { PropagationContext } from '@sentry/core'; import { @@ -6,7 +6,6 @@ import { flush, getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, withIsolationScope, withScope, @@ -134,7 +133,7 @@ class WrappedWorkflowStep implements WorkflowStep { 'cloudflare.workflow.retries.limit': config?.retries?.limit, 'cloudflare.workflow.attempt': attempt, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, async span => { diff --git a/packages/core/src/integrations/http/server-subscription.ts b/packages/core/src/integrations/http/server-subscription.ts index b4d3839c877d..12b7377d6ff6 100644 --- a/packages/core/src/integrations/http/server-subscription.ts +++ b/packages/core/src/integrations/http/server-subscription.ts @@ -32,11 +32,7 @@ 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_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { safeMathRandom } from '../../utils/randomSafeContext'; import type { SpanAttributes } from '../../types/span'; import type { SpanStatus } from '../../types/spanStatus'; @@ -52,9 +48,10 @@ import { NETWORK_TRANSPORT, SERVER_ADDRESS, SERVER_PORT, + SENTRY_KIND, + SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, - SENTRY_KIND, } from '@sentry/conventions/attributes'; import { filterCollectedUrl } from '../../utils/data-collection/filterCollectedUrl'; @@ -309,7 +306,7 @@ function buildServerSpanWrap( // Sentry-specific attributes [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.server', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SENTRY_KIND]: 'server', // Network attributes [SERVER_ADDRESS]: hostname, diff --git a/packages/core/src/integrations/mcp-server/spans.ts b/packages/core/src/integrations/mcp-server/spans.ts index f7e1b42325d5..52feb6c608eb 100644 --- a/packages/core/src/integrations/mcp-server/spans.ts +++ b/packages/core/src/integrations/mcp-server/spans.ts @@ -6,11 +6,8 @@ */ import { getClient } from '../../currentScopes'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '../../semanticAttributes'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { startSpan } from '../../tracing'; import { buildTransportAttributes, buildTypeSpecificAttributes } from './attributeExtraction'; import { @@ -72,7 +69,7 @@ function buildSentryAttributes(type: McpSpanConfig['type']): Record { + // The procedure path names the segment only when tRPC is not nested in another span, + // e.g. an incoming HTTP request span. + setSegmentNameSourceIfSegment(span, 'route'); + try { const nextResult = await next(); captureIfError(nextResult); diff --git a/packages/core/src/types/span.ts b/packages/core/src/types/span.ts index 042afb0862b2..cf189a079516 100644 --- a/packages/core/src/types/span.ts +++ b/packages/core/src/types/span.ts @@ -28,7 +28,7 @@ export type SpanAttributeValue = export type SpanAttributes = Partial<{ 'sentry.origin': string; 'sentry.op': string; - 'sentry.source': TransactionSource; + 'sentry.segment.name.source': TransactionSource; 'sentry.sample_rate': number; 'sentry.kind': SpanKind; }> & diff --git a/packages/core/src/utils/spanUtils.ts b/packages/core/src/utils/spanUtils.ts index 3d69f3f2ccff..c765bdecd705 100644 --- a/packages/core/src/utils/spanUtils.ts +++ b/packages/core/src/utils/spanUtils.ts @@ -5,11 +5,11 @@ import { serializeAttributes } from '../attributes'; import { getMainCarrier } from '../carrier'; import { getCurrentScope } from '../currentScopes'; import type { Scope } from '../scope'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE, } from '../semanticAttributes'; import type { SentrySpan } from '../tracing/sentrySpan'; @@ -17,6 +17,7 @@ import { isStatusErrorMessageValid, SPAN_STATUS_OK, SPAN_STATUS_UNSET } from '.. import { getCapturedScopesOnSpan } from '../tracing/utils'; import type { TraceContext } from '../types/context'; import type { SpanLink, SpanLinkJSON } from '../types/link'; +import type { TransactionSource } from '../types/transaction'; import type { SerializedStreamedSpan, Span, @@ -229,7 +230,7 @@ export function spanToJSON(span: Span): StreamedSpanJSON { start_timestamp: spanTimeInputToSeconds(startTime), // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time end_timestamp: spanTimeInputToSeconds(endTime) || undefined, - is_segment: span === INTERNAL_getSegmentSpan(span), + is_segment: spanIsSegment(span), status: getSimpleStatus(status), attributes: addStatusMessageAttribute(attributes, status), links: getStreamedSpanLinks(links), @@ -244,7 +245,7 @@ export function spanToJSON(span: Span): StreamedSpanJSON { start_timestamp: 0, name: '', status: 'ok', - is_segment: span === INTERNAL_getSegmentSpan(span), + is_segment: spanIsSegment(span), attributes: {}, }; } @@ -378,6 +379,10 @@ export function addChildSpanToSpan(span: SpanWithPotentialChildren, childSpan: S const rootSpan = span[ROOT_SPAN_FIELD] || span; addNonEnumerableProperty(childSpan, ROOT_SPAN_FIELD, rootSpan); + // Name source is exclusive to segment spans. Constructor-time attribute bags can leak it onto + // children before this link exists, so drop it once the span is known not to be the segment. + childSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, undefined); + // `_sentryChildSpans` exists only so `getSpanDescendants()` can walk the tree when the segment span // is sent, and that walk stops at an unsampled span without ever visiting its children. So a child // tracked here would be held for the parent's lifetime and never read. @@ -448,6 +453,13 @@ export function INTERNAL_getSegmentSpan(span: SpanWithPotentialChildren): Span { return span[ROOT_SPAN_FIELD] || span; } +/** + * Whether the given span is the segment span, i.e. it has no parent within its trace. + */ +export function spanIsSegment(span: SpanWithPotentialChildren): boolean { + return span === INTERNAL_getSegmentSpan(span); +} + /** * Returns the currently active span. */ @@ -480,7 +492,17 @@ export function getActiveSpan(scope?: Scope): Span | undefined { export function updateSpanName(span: Span, name: string): void { span.updateName(name); span.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: name, }); + setSegmentNameSourceIfSegment(span, 'custom'); +} + +/** + * Sets `sentry.segment.name.source` only when `span` is the segment span. + * No-op for child spans — the attribute must exclusively live on the segment. + */ +export function setSegmentNameSourceIfSegment(span: Span, source: TransactionSource): void { + if (spanIsSegment(span)) { + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); + } } diff --git a/packages/core/src/utils/url.ts b/packages/core/src/utils/url.ts index 69261dd1bfb2..46d3b912b694 100644 --- a/packages/core/src/utils/url.ts +++ b/packages/core/src/utils/url.ts @@ -7,16 +7,14 @@ import { URL_PATH, URL_PORT, URL_QUERY, + SENTRY_SEGMENT_NAME_SOURCE, URL_SCHEME, URL_TEMPLATE, } from '@sentry/conventions/attributes'; -import { - SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; import type { Client } from '../client'; import type { SpanAttributes } from '../types/span'; +import type { TransactionSource } from '../types/transaction'; import { filterCollectedUrl, filterCollectedUrlQuery } from './data-collection/filterCollectedUrl'; type PartialURL = { @@ -198,13 +196,14 @@ export function getHttpSpanDetailsFromUrlObject( ): [name: string, attributes: SpanAttributes] { const attributes: SpanAttributes = { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', }; + let nameSource: TransactionSource = 'url'; + if (routeName) { // This is based on https://opentelemetry.io/docs/specs/semconv/http/http-spans/#name attributes[kind === 'server' ? HTTP_ROUTE : URL_TEMPLATE] = routeName; - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + nameSource = 'route'; } if (request?.method) { @@ -223,7 +222,7 @@ export function getHttpSpanDetailsFromUrlObject( if (urlObject.pathname) { attributes[URL_PATH] = urlObject.pathname; if (urlObject.pathname === '/') { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + nameSource = 'route'; } } @@ -240,6 +239,12 @@ export function getHttpSpanDetailsFromUrlObject( } } + // Outgoing HTTP (`kind === 'client'`) is not a segment span. Incoming HTTP usually is; + // if it is nested under a local parent, `addChildSpanToSpan` strips this attribute. + if (kind === 'server') { + attributes[SENTRY_SEGMENT_NAME_SOURCE] = nameSource; + } + return [getHttpSpanNameFromUrlObject(urlObject, kind, request, routeName), attributes]; } diff --git a/packages/core/test/lib/utils/segmentNameSource.test.ts b/packages/core/test/lib/utils/segmentNameSource.test.ts new file mode 100644 index 000000000000..0607d1f3b311 --- /dev/null +++ b/packages/core/test/lib/utils/segmentNameSource.test.ts @@ -0,0 +1,71 @@ +import { beforeEach, describe, expect, it } from 'vitest'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { setCurrentClient } from '../../../src/sdk'; +import { SentrySpan } from '../../../src/tracing/sentrySpan'; +import { startInactiveSpan, startSpan } from '../../../src/tracing/trace'; +import { spanToJSON } from '../../../src/utils/spanUtils'; +import { getHttpSpanDetailsFromUrlObject, parseStringToURLObject } from '../../../src/utils/url'; +import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; + +describe('SENTRY_SEGMENT_NAME_SOURCE exclusivity', () => { + beforeEach(() => { + const client = new TestClient(getDefaultTestClientOptions({ tracesSampleRate: 1 })); + setCurrentClient(client); + client.init(); + }); + + it('keeps the attribute on a root span started with it in attributes', () => { + const span = startInactiveSpan({ + name: 'GET /users', + attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' }, + }); + + expect(spanToJSON(span).attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('url'); + }); + + it('strips the attribute from a child started with it in attributes', () => { + startSpan({ name: 'parent' }, () => { + const child = startInactiveSpan({ + name: 'child', + attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' }, + }); + + expect(spanToJSON(child).attributes).not.toHaveProperty(SENTRY_SEGMENT_NAME_SOURCE); + }); + }); + + it('ignores setAttribute of the source on a child span', () => { + startSpan({ name: 'parent' }, () => { + const child = startInactiveSpan({ name: 'child' }); + child.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); + + expect(spanToJSON(child).attributes).not.toHaveProperty(SENTRY_SEGMENT_NAME_SOURCE); + }); + }); + + it('allows setAttribute of the source on a segment span', () => { + const span = new SentrySpan({ name: 'segment' }); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); + + expect(spanToJSON(span).attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route'); + }); + + it('does not keep name source on a nested incoming HTTP span', () => { + const urlObject = parseStringToURLObject('https://example.com/api/users')!; + const [name, attributes] = getHttpSpanDetailsFromUrlObject(urlObject, 'server', 'test-origin'); + + expect(attributes).toHaveProperty(SENTRY_SEGMENT_NAME_SOURCE, 'url'); + + startSpan({ name: 'parent' }, () => { + const child = startInactiveSpan({ name, attributes }); + expect(spanToJSON(child).attributes).not.toHaveProperty(SENTRY_SEGMENT_NAME_SOURCE); + }); + }); + + it('does not include name source on outgoing HTTP span details', () => { + const urlObject = parseStringToURLObject('https://example.com/api/users')!; + const [, attributes] = getHttpSpanDetailsFromUrlObject(urlObject, 'client', 'test-origin', undefined, '/api/users'); + + expect(attributes).not.toHaveProperty(SENTRY_SEGMENT_NAME_SOURCE); + }); +}); diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index b5dd460093c8..202f5b3c62c7 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -83,7 +83,7 @@ export { zodErrorsIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, startSession, captureSession, diff --git a/packages/elysia/src/index.ts b/packages/elysia/src/index.ts index 8786ab737f17..3ff0aecd8af1 100644 --- a/packages/elysia/src/index.ts +++ b/packages/elysia/src/index.ts @@ -89,7 +89,7 @@ export { parameterize, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, expressIntegration, diff --git a/packages/elysia/src/withElysia.ts b/packages/elysia/src/withElysia.ts index ac1a5e5a4aec..482cffbe60b6 100644 --- a/packages/elysia/src/withElysia.ts +++ b/packages/elysia/src/withElysia.ts @@ -1,4 +1,4 @@ -import { HTTP_ROUTE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; import { WEB_SERVER_MIDDLEWARE_SPAN_OP } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; import { @@ -10,7 +10,6 @@ import { getTraceData, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, startInactiveSpan, startSpanManual, @@ -66,7 +65,7 @@ function updateRouteTransactionName(request: Request, method: string, route: str function applyRouteToSpan(span: Span): void { updateSpanName(span, transactionName); span.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [HTTP_ROUTE]: route, }); } @@ -207,7 +206,7 @@ export function withElysia(app: T, options: ElysiaHandlerOp name: `${request.method} ${new URL(request.url).pathname}`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: filterCollectedUrl(request.url), [URL_PATH]: new URL(request.url).pathname, }, diff --git a/packages/ember/src/utils/instrumentEmberAppInstanceForPerformance.ts b/packages/ember/src/utils/instrumentEmberAppInstanceForPerformance.ts index 43c9a88cd8d4..b970eda21d68 100644 --- a/packages/ember/src/utils/instrumentEmberAppInstanceForPerformance.ts +++ b/packages/ember/src/utils/instrumentEmberAppInstanceForPerformance.ts @@ -5,14 +5,14 @@ import type { startBrowserTracingNavigationSpan as startBrowserTracingNavigationSpanType, startBrowserTracingPageLoadSpan as startBrowserTracingPageLoadSpanType, } from '@sentry/browser'; +import { getAbsoluteUrl, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, WINDOW } from '@sentry/browser'; import { - getAbsoluteUrl, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - startInactiveSpan, - WINDOW, -} from '@sentry/browser'; -import { SENTRY_OP, URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; + SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_OP, + URL_FULL, + URL_PATH, + URL_TEMPLATE, +} from '@sentry/conventions/attributes'; import { filterCollectedUrl, getCurrentScope, @@ -71,7 +71,7 @@ export function instrumentEmberAppInstanceForPerformance( ? PAGELOAD_SPAN_NAME_FALLBACK : url || WINDOW.location.pathname, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeInfo ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeInfo ? 'route' : 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.ember', ...(url ? _getRouteUrlAttributes(client, url, routeInfo?.params) : {}), toRoute: routeInfo?.name, @@ -113,7 +113,7 @@ export function instrumentEmberAppInstanceForPerformance( activeRootSpan = startBrowserTracingNavigationSpan(client, { name: `route:${toRoute}`, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.ember', ...urlAttributes, fromRoute, @@ -121,7 +121,7 @@ export function instrumentEmberAppInstanceForPerformance( }, }); } - } else if (activeRootSpan && spanToJSON(activeRootSpan).attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === 'url') { + } else if (activeRootSpan && spanToJSON(activeRootSpan).attributes[SENTRY_SEGMENT_NAME_SOURCE] === 'url') { // We make sure to update the pageload span with the current URL, if we couldn't get it before // In this case we re-load the router:main reference, as this may change and we may have a stale reference const location = getRouterMain(appInstance).location; @@ -130,7 +130,7 @@ export function instrumentEmberAppInstanceForPerformance( const routeInfo = routerService.recognize(url); activeRootSpan.updateName(`route:${toRoute}`); activeRootSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', ..._getRouteUrlAttributes(client, url, routeInfo?.params), toRoute: toRoute, }); diff --git a/packages/ember/src/utils/instrumentRoutePerformance.ts b/packages/ember/src/utils/instrumentRoutePerformance.ts index 1c52e1a42dbd..2ab60da0f0e9 100644 --- a/packages/ember/src/utils/instrumentRoutePerformance.ts +++ b/packages/ember/src/utils/instrumentRoutePerformance.ts @@ -1,10 +1,9 @@ import { startSpan } from '@sentry/browser'; import { CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; import { GENERAL_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type Route from '@ember/routing/route'; -import type { TransactionSource } from '@sentry/core'; type RouteConstructor = new (...args: ConstructorParameters) => Route; @@ -38,12 +37,10 @@ export function instrumentRoutePerformance(BaseRoute // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Route hooks have varied signatures that can't be unified with unknown fn: (...args: any[]) => any, args: unknown[], - source: TransactionSource, ): Promise => { return startSpan( { attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember', [SENTRY_OP]: GENERAL_FUNCTION_SPAN_OP, [CODE_FUNCTION_NAME]: hookName, @@ -63,25 +60,19 @@ export function instrumentRoutePerformance(BaseRoute // @ts-expect-error TS2545 We do not need to redefine a constructor here [routeName]: class extends BaseRoute { public beforeModel(...args: unknown[]): void | Promise { - return instrumentFunction('beforeModel', this.fullRouteName, super.beforeModel.bind(this), args, 'custom'); + return instrumentFunction('beforeModel', this.fullRouteName, super.beforeModel.bind(this), args); } public async model(...args: unknown[]): Promise { - return instrumentFunction('model', this.fullRouteName, super.model.bind(this), args, 'custom'); + return instrumentFunction('model', this.fullRouteName, super.model.bind(this), args); } public afterModel(...args: unknown[]): void | Promise { - return instrumentFunction('afterModel', this.fullRouteName, super.afterModel.bind(this), args, 'custom'); + return instrumentFunction('afterModel', this.fullRouteName, super.afterModel.bind(this), args); } public setupController(...args: unknown[]): void | Promise { - return instrumentFunction( - 'setupController', - this.fullRouteName, - super.setupController.bind(this), - args, - 'custom', - ); + return instrumentFunction('setupController', this.fullRouteName, super.setupController.bind(this), args); } }, }[routeName] as T; diff --git a/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts b/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts index 5f8fabf1d7d6..f49018bf5fc1 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts @@ -1,11 +1,6 @@ -import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; import { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op'; -import { - debug, - handleCallbackErrors, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core'; +import { debug, handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node'; import { DEBUG_BUILD } from '../debug-build'; import { domainify, markEventUnhandled, proxyFunction } from '../utils'; @@ -42,7 +37,7 @@ function _wrapCloudEventFunction( attributes: { [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP, [FAAS_TRIGGER]: 'cloud_event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', }, }, diff --git a/packages/google-cloud-serverless/src/gcpfunction/events.ts b/packages/google-cloud-serverless/src/gcpfunction/events.ts index 874250bb3358..ac0228b6eaec 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/events.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/events.ts @@ -1,11 +1,6 @@ -import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; import { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op'; -import { - debug, - handleCallbackErrors, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core'; +import { debug, handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node'; import { DEBUG_BUILD } from '../debug-build'; import { domainify, markEventUnhandled, proxyFunction } from '../utils'; @@ -45,7 +40,7 @@ function _wrapEventFunction attributes: { [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP, [FAAS_TRIGGER]: 'event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', }, }, diff --git a/packages/google-cloud-serverless/src/gcpfunction/http.ts b/packages/google-cloud-serverless/src/gcpfunction/http.ts index 5c27a68a8878..a5982070e03e 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/http.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/http.ts @@ -1,4 +1,4 @@ -import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; import { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op'; import { debug, @@ -6,7 +6,6 @@ import { httpRequestToRequestData, isString, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, stripUrlQueryAndFragment, } from '@sentry/core'; @@ -56,7 +55,7 @@ function _wrapHttpFunction(fn: HttpFunction, options: Partial): attributes: { [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP, [FAAS_TRIGGER]: 'http', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', }, }, diff --git a/packages/google-cloud-serverless/src/index.ts b/packages/google-cloud-serverless/src/index.ts index 7332aed65692..30a4a472297f 100644 --- a/packages/google-cloud-serverless/src/index.ts +++ b/packages/google-cloud-serverless/src/index.ts @@ -90,7 +90,7 @@ export { parameterize, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, expressIntegration, diff --git a/packages/hono/src/shared/middlewareHandlers.ts b/packages/hono/src/shared/middlewareHandlers.ts index 5f36ac386d92..e0b6b6c28e54 100644 --- a/packages/hono/src/shared/middlewareHandlers.ts +++ b/packages/hono/src/shared/middlewareHandlers.ts @@ -5,7 +5,7 @@ import { getDefaultIsolationScope, getIsolationScope, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + setSegmentNameSourceIfSegment, updateSpanName, type Scope, winterCGRequestToRequestData, @@ -107,14 +107,11 @@ function updateSpanRouteName(isolationScope: Scope, context: Context): void { if (activeSpan) { activeSpan.updateName(routeName); - activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); const rootSpan = getRootSpan(activeSpan); updateSpanName(rootSpan, routeName); - rootSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', - [HTTP_ROUTE]: route, - }); + setSegmentNameSourceIfSegment(rootSpan, 'route'); + rootSpan.setAttribute(HTTP_ROUTE, route); } isolationScope.setTransactionName(routeName); diff --git a/packages/hono/test/shared/middlewareHandlers.test.ts b/packages/hono/test/shared/middlewareHandlers.test.ts index 0ba38af16bc9..c52e4f62eb69 100644 --- a/packages/hono/test/shared/middlewareHandlers.test.ts +++ b/packages/hono/test/shared/middlewareHandlers.test.ts @@ -1,5 +1,5 @@ import * as SentryCore from '@sentry/core'; -import { HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { requestHandler, responseHandler } from '../../src/shared/middlewareHandlers'; @@ -192,16 +192,14 @@ describe('responseHandler', () => { expect(mockSetTransactionName).toHaveBeenCalledWith('GET /test'); }); - it('sets http.route on the root span', () => { + it('sets http.route and segment name source on the root span', () => { getActiveSpanMock.mockReturnValue(mockRootSpan); // oxlint-disable-next-line typescript/no-explicit-any requestHandler(createMockContext(200) as any); - expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'route', - [HTTP_ROUTE]: '/test', - }); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(HTTP_ROUTE, '/test'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); }); }); }); diff --git a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts index b81bf6d9fda5..0446eda55de7 100644 --- a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts @@ -6,7 +6,6 @@ import { PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, filterCollectedUrl, } from '@sentry/core'; import { @@ -16,7 +15,7 @@ import { getAbsoluteUrl, } from '@sentry/react'; import { maybeParameterizeRoute } from './parameterization'; -import { URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; /** * Strips trailing slash from a pathname, unless it's the root path. @@ -70,7 +69,7 @@ export function appRouterInstrumentPageLoad(client: Client): void { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.nextjs.app_router_instrumentation', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: parameterizedPathname ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), }, }); @@ -129,7 +128,7 @@ export function appRouterInstrumentNavigation(client: Client): void { currentNavigationSpan.updateName(pathname); currentNavigationSpan.setAttributes({ 'navigation.type': `router.${navigationType}`, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: parameterizedPathname ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), }); setNavigationSpanUrlAttributes(currentNavigationSpan, unparameterizedPathname, normalizedHref); @@ -142,7 +141,7 @@ export function appRouterInstrumentNavigation(client: Client): void { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: parameterizedPathname ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', 'navigation.type': `router.${navigationType}`, ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), }, @@ -158,7 +157,7 @@ export function appRouterInstrumentNavigation(client: Client): void { if (currentRouterPatchingNavigationSpanRef.current?.isRecording()) { currentRouterPatchingNavigationSpanRef.current.updateName(parameterizedPathname ?? pathname); currentRouterPatchingNavigationSpanRef.current.setAttribute( - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, parameterizedPathname ? 'route' : 'url', ); if (parameterizedPathname) { @@ -172,7 +171,7 @@ export function appRouterInstrumentNavigation(client: Client): void { name: parameterizedPathname ?? pathname, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: parameterizedPathname ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', 'navigation.type': 'browser.popstate', ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), }, @@ -247,7 +246,7 @@ function patchRouter(client: Client, router: NextRouter, currentNavigationSpanRe const transactionAttributes: Record = { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.app_router_instrumentation', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }; const href = argArray[0]; @@ -279,7 +278,7 @@ function patchRouter(client: Client, router: NextRouter, currentNavigationSpanRe name: parameterizedPathname ?? transactionName, attributes: { ...transactionAttributes, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: parameterizedPathname ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedPathname ? 'route' : 'url', ...(parameterizedPathname && { [URL_TEMPLATE]: parameterizedPathname }), }, }, diff --git a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts index 27d54fddf6cc..e59c836bb8af 100644 --- a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts @@ -7,7 +7,6 @@ import { parseBaggageHeader, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, stripUrlQueryAndFragment, } from '@sentry/core'; import { @@ -20,7 +19,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 { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; // next/router v10 is CJS // @@ -133,7 +132,7 @@ export function pagesRouterInstrumentPageLoad(client: Client): void { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.nextjs.pages_router_instrumentation', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: route ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: route ? 'route' : 'url', ...(route && { [URL_TEMPLATE]: route }), ...(params && { ...params }), }, @@ -173,7 +172,7 @@ export function pagesRouterInstrumentNavigation(client: Client): void { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.nextjs.pages_router_instrumentation', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: spanSource, + [SENTRY_SEGMENT_NAME_SOURCE]: spanSource, ...(spanSource === 'route' && { [URL_TEMPLATE]: newLocation }), }, }, diff --git a/packages/nextjs/src/common/enhanceMiddlewareRootSpan.ts b/packages/nextjs/src/common/enhanceMiddlewareRootSpan.ts index 50bd60ec5af5..e247f724cda2 100644 --- a/packages/nextjs/src/common/enhanceMiddlewareRootSpan.ts +++ b/packages/nextjs/src/common/enhanceMiddlewareRootSpan.ts @@ -1,5 +1,7 @@ import { WEB_SERVER_MIDDLEWARE_SPAN_OP } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, stripUrlQueryAndFragment } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; + +import { stripUrlQueryAndFragment } from '@sentry/core'; import { ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from './nextSpanAttributes'; export interface MutableMiddlewareRootSpan { @@ -37,7 +39,7 @@ export function enhanceMiddlewareRootSpan(span: MutableMiddlewareRootSpan): void const match = spanName.match(/^middleware (GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)/); if (match) { span.setName(`middleware ${match[1]}`); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + attributes[SENTRY_SEGMENT_NAME_SOURCE] = 'route'; } else { span.setName(stripUrlQueryAndFragment(spanName)); } diff --git a/packages/nextjs/src/common/utils/liveRootSpanAdapter.ts b/packages/nextjs/src/common/utils/liveRootSpanAdapter.ts index a984d00c59fb..e80079fe68bd 100644 --- a/packages/nextjs/src/common/utils/liveRootSpanAdapter.ts +++ b/packages/nextjs/src/common/utils/liveRootSpanAdapter.ts @@ -1,5 +1,6 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import type { Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToStaticSpanJSON } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToStaticSpanJSON } from '@sentry/core'; import type { MutableRootSpan } from '../../server/enhanceHandleRequestRootSpan'; /** @@ -18,9 +19,9 @@ export function createLiveRootSpanAdapter(span: Span): MutableRootSpan { attributes, getName: () => spanToStaticSpanJSON(span).description, setName: (name: string) => { - const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + const source = attributes[SENTRY_SEGMENT_NAME_SOURCE]; span.updateName(name); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); }, setOp: (op: string) => { span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, op); diff --git a/packages/nextjs/src/common/utils/tracingUtils.ts b/packages/nextjs/src/common/utils/tracingUtils.ts index 1cfae4cef289..4c5de6b17d18 100644 --- a/packages/nextjs/src/common/utils/tracingUtils.ts +++ b/packages/nextjs/src/common/utils/tracingUtils.ts @@ -1,7 +1,7 @@ import { HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; import { WEB_SERVER_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; import type { PropagationContext, RawAttributes, Span } from '@sentry/core'; -import { isObjectLike, Scope, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { isObjectLike, Scope, setSegmentNameSourceIfSegment } from '@sentry/core'; import { ATTR_NEXT_SEGMENT, ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../nextSpanAttributes'; const commonPropagationContextMap = new WeakMap(); @@ -111,6 +111,8 @@ export function maybeEnhanceServerComponentSpanName( 'sentry.nextjs.ssr.function.type': segment === PAGE_SEGMENT ? 'Page' : 'Layout', 'sentry.nextjs.ssr.function.route': route as string | undefined, [SENTRY_OP]: WEB_SERVER_FUNCTION_SPAN_OP, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', }); + // Usually a child of the request root span, in which case this no-ops and the root keeps the name + // source it got from `handleOnSpanStart` / `enhanceHandleRequestRootSpan`. + setSegmentNameSourceIfSegment(activeSpan, 'route'); } diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index a0551f5c0256..bc98cf3818a7 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -8,7 +8,6 @@ import { getIsolationScope, handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, SPAN_STATUS_OK, startSpan, @@ -17,7 +16,7 @@ import { import { flushSafelyWithTimeout, waitUntil } from '../common/utils/responseEnd'; import { DEBUG_BUILD } from './debug-build'; import { isNotFoundNavigationError, isRedirectNavigationError } from './nextNavigationErrorUtils'; -import { SENTRY_KIND, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_KIND, SENTRY_OP } from '@sentry/conventions/attributes'; import { WEB_SERVER_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; interface Options { @@ -119,7 +118,7 @@ async function withServerActionInstrumentationImplementation any>( rootSpan.updateName(`${method} ${parameterizedRoute}`); rootSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', [HTTP_ROUTE]: parameterizedRoute, }); diff --git a/packages/nextjs/src/edge/enhanceRunHandlerRootSpan.ts b/packages/nextjs/src/edge/enhanceRunHandlerRootSpan.ts index 924fd7b48b82..8fac75dd3463 100644 --- a/packages/nextjs/src/edge/enhanceRunHandlerRootSpan.ts +++ b/packages/nextjs/src/edge/enhanceRunHandlerRootSpan.ts @@ -1,5 +1,5 @@ -import { HTTP_METHOD, HTTP_REQUEST_METHOD } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_METHOD, HTTP_REQUEST_METHOD } from '@sentry/conventions/attributes'; + import { ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../common/nextSpanAttributes'; import { ATTR_NEXT_PAGES_API_ROUTE_TYPE } from '../common/span-attributes-with-logic-attached'; @@ -33,7 +33,7 @@ export function enhanceRunHandlerRootSpan(span: MutableRootSpan): void { } span.setOp('http.server'); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + attributes[SENTRY_SEGMENT_NAME_SOURCE] = 'route'; const path = spanName.replace(ATTR_NEXT_PAGES_API_ROUTE_TYPE, '').trim(); // eslint-disable-next-line typescript/no-deprecated diff --git a/packages/nextjs/src/edge/index.ts b/packages/nextjs/src/edge/index.ts index f82300c3d2c3..ba716a9fc266 100644 --- a/packages/nextjs/src/edge/index.ts +++ b/packages/nextjs/src/edge/index.ts @@ -10,7 +10,6 @@ import { registerSpanErrorInstrumentation, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, } from '@sentry/core'; import type { VercelEdgeOptions } from '@sentry/vercel-edge'; @@ -34,7 +33,7 @@ import { setUrlProcessingMetadata } from '../common/utils/setUrlProcessingMetada import { distDirRewriteFramesIntegration } from './distDirRewriteFramesIntegration'; import { enhanceMiddlewareRootSpan } from '../common/enhanceMiddlewareRootSpan'; import { enhanceRunHandlerRootSpan } from './enhanceRunHandlerRootSpan'; -import { SENTRY_KIND } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_KIND } from '@sentry/conventions/attributes'; import { WEB_SERVER_MIDDLEWARE_SPAN_OP } from '@sentry/conventions/op'; export * from '@sentry/vercel-edge'; @@ -144,7 +143,7 @@ export function init(options: VercelEdgeOptions = {}): void { // Make sure middleware spans get the right op if (spanAttributes?.[ATTR_NEXT_SPAN_TYPE] === 'Middleware.execute') { span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, WEB_SERVER_MIDDLEWARE_SPAN_OP); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'url'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'url'); } // Backfill op and source for pages-router API routes: we no longer create this span in the wrapper, @@ -154,7 +153,7 @@ export function init(options: VercelEdgeOptions = {}): void { String(spanAttributes?.[ATTR_NEXT_SPAN_NAME]).startsWith(ATTR_NEXT_PAGES_API_ROUTE_TYPE) ) { span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'http.server'); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); } // The `BaseServer.handleRequest` span is the incoming request root span (e.g. for app-router server diff --git a/packages/nextjs/src/server/enhanceHandleRequestRootSpan.ts b/packages/nextjs/src/server/enhanceHandleRequestRootSpan.ts index d5064966bcf9..2d29ef6a563b 100644 --- a/packages/nextjs/src/server/enhanceHandleRequestRootSpan.ts +++ b/packages/nextjs/src/server/enhanceHandleRequestRootSpan.ts @@ -1,6 +1,12 @@ -import { HTTP_METHOD, HTTP_REQUEST_METHOD, HTTP_ROUTE, HTTP_TARGET } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + HTTP_METHOD, + HTTP_REQUEST_METHOD, + HTTP_ROUTE, + HTTP_TARGET, +} from '@sentry/conventions/attributes'; import { WEB_SERVER_MIDDLEWARE_SPAN_OP } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, stripUrlQueryAndFragment } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_OP, 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'; import { backfillHttpResponseStatusCode } from '../common/utils/backfillHttpResponseStatusCode'; @@ -50,7 +56,7 @@ export function enhanceHandleRequestRootSpan(span: MutableRootSpan): void { if (typeof method === 'string' && typeof route === 'string' && !route.startsWith('middleware')) { const cleanRoute = route.replace(/\/route$/, ''); span.setName(`${method} ${cleanRoute}`); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + attributes[SENTRY_SEGMENT_NAME_SOURCE] = 'route'; attributes[HTTP_ROUTE] = cleanRoute; // Preserve next.route in case it did not get hoisted attributes[ATTR_NEXT_ROUTE] = cleanRoute; @@ -60,7 +66,7 @@ export function enhanceHandleRequestRootSpan(span: MutableRootSpan): void { const routeBackfill = attributes[TRANSACTION_ATTR_SENTRY_ROUTE_BACKFILL]; if (typeof routeBackfill === 'string' && span.getName() !== 'GET /_app') { span.setName(`${typeof method === 'string' ? method : 'GET'} ${routeBackfill}`); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + attributes[SENTRY_SEGMENT_NAME_SOURCE] = 'route'; attributes[HTTP_ROUTE] = attributes[HTTP_ROUTE] ?? routeBackfill; } @@ -70,7 +76,7 @@ export function enhanceHandleRequestRootSpan(span: MutableRootSpan): void { if (middlewareMatch) { span.setName(`middleware ${middlewareMatch[1]}`); span.setOp(WEB_SERVER_MIDDLEWARE_SPAN_OP); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route'; + attributes[SENTRY_SEGMENT_NAME_SOURCE] = 'route'; } // Next.js overrides transaction names for page loads that throw an error diff --git a/packages/nextjs/src/server/handleOnSpanStart.ts b/packages/nextjs/src/server/handleOnSpanStart.ts index 12d105f7d228..df5bf1dc9362 100644 --- a/packages/nextjs/src/server/handleOnSpanStart.ts +++ b/packages/nextjs/src/server/handleOnSpanStart.ts @@ -1,12 +1,11 @@ -import { HTTP_METHOD, HTTP_REQUEST_METHOD, HTTP_ROUTE } from '@sentry/conventions/attributes'; -import type { Span } from '@sentry/core'; import { - getIsolationScope, - getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - spanToJSON, -} from '@sentry/core'; + SENTRY_SEGMENT_NAME_SOURCE, + HTTP_METHOD, + HTTP_REQUEST_METHOD, + HTTP_ROUTE, +} from '@sentry/conventions/attributes'; +import type { Span } from '@sentry/core'; +import { getIsolationScope, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core'; import { ATTR_NEXT_ROUTE, ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../common/nextSpanAttributes'; import { addHeadersAsAttributes } from '../common/utils/addHeadersAsAttributes'; import { dropMiddlewareTunnelRequests } from '../common/utils/dropMiddlewareTunnelRequests'; @@ -48,7 +47,7 @@ export function handleOnSpanStart(span: Span): void { [HTTP_ROUTE]: route, // Preserving the original attribute despite internally not depending on it [ATTR_NEXT_ROUTE]: route, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }); // Update the isolation scope's transaction name so that non-transaction events @@ -70,7 +69,7 @@ export function handleOnSpanStart(span: Span): void { rootSpan.setAttributes({ [HTTP_ROUTE]: middlewareName, [ATTR_NEXT_SPAN_NAME]: middlewareName, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }); } span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto'); diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 7610e137e75d..2d6fdfc007a1 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -97,7 +97,6 @@ export { setConversationId, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, @@ -209,6 +208,7 @@ export { defaultStackParser, getSentryRelease } from './sdk/api'; export { makeNodeTransport } from './transports'; export { createGetModuleFromFilename } from './utils/module'; +export { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; export { httpServerIntegration } from './integrations/http/httpServerIntegration'; export { httpServerSpansIntegration } from './integrations/http/httpServerSpansIntegration'; export { processSessionIntegration } from './integrations/processSession'; diff --git a/packages/node/src/integrations/http/httpServerSpansIntegration.ts b/packages/node/src/integrations/http/httpServerSpansIntegration.ts index 1234321e7433..f1bee46b1a2d 100644 --- a/packages/node/src/integrations/http/httpServerSpansIntegration.ts +++ b/packages/node/src/integrations/http/httpServerSpansIntegration.ts @@ -2,6 +2,7 @@ import { errorMonitor } from 'node:events'; import type { IncomingHttpHeaders } from 'node:http'; import { + SENTRY_SEGMENT_NAME_SOURCE, HTTP_CLIENT_IP, HTTP_FLAVOR, HTTP_HOST, @@ -46,7 +47,6 @@ import { parseStringToURLObject, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, stripUrlQueryAndFragment, isTracingSuppressed, @@ -165,7 +165,7 @@ const _httpServerSpansIntegration = ((options: HttpServerSpansIntegrationOptions // Sentry specific attributes [SENTRY_KIND]: 'server', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.http', [SENTRY_HTTP_PREFETCH]: isKnownPrefetchRequest(request) || undefined, [URL_FULL]: filterCollectedUrl(fullUrl, client), diff --git a/packages/node/src/integrations/http/index.ts b/packages/node/src/integrations/http/index.ts index 36b71950c721..7ebf23c4dcf3 100644 --- a/packages/node/src/integrations/http/index.ts +++ b/packages/node/src/integrations/http/index.ts @@ -1,13 +1,7 @@ import type { RequestOptions } from 'node:http'; import type { HttpClientRequest, HttpIncomingMessage, HttpServerResponse, Span } from '@sentry/core'; import { URL_FULL } from '@sentry/conventions/attributes'; -import { - defineIntegration, - getRequestUrlFromClientRequest, - hasSpansEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - stripDataUrlContent, -} from '@sentry/core'; +import { defineIntegration, getRequestUrlFromClientRequest, hasSpansEnabled, stripDataUrlContent } from '@sentry/core'; import type { NodeClient } from '../../sdk/client'; import type { HttpServerIntegrationOptions } from './httpServerIntegration'; import { httpServerIntegration } from './httpServerIntegration'; @@ -207,7 +201,6 @@ export const httpIntegration = defineIntegration((options: HttpOptions = {}) => const sanitizedUrl = stripDataUrlContent(url); span.updateName(`${request.method || 'GET'} ${sanitizedUrl}`); span.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [URL_FULL]: sanitizedUrl, }); } diff --git a/packages/node/src/integrations/node-fetch/undici-instrumentation.ts b/packages/node/src/integrations/node-fetch/undici-instrumentation.ts index 62e19cc62f8c..78a4bfd3e806 100644 --- a/packages/node/src/integrations/node-fetch/undici-instrumentation.ts +++ b/packages/node/src/integrations/node-fetch/undici-instrumentation.ts @@ -31,7 +31,6 @@ import { parseUrl, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, startInactiveSpan, stripDataUrlContent, @@ -263,9 +262,6 @@ function onRequestCreated(config: NodeFetchOptions, { request }: RequestMessage) // when an OpenTelemetry SDK tracer provider is set up, so we enforce it here too, which covers // SDKs that don't use an OpenTelemetry tracer provider at all. const isDataUrl = url.startsWith('data:'); - if (!isDataUrl) { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'url'; - } const spanName = requestMethod === '_OTHER' ? 'HTTP' diff --git a/packages/node/test/integrations/undici.test.ts b/packages/node/test/integrations/undici.test.ts index 72209ba78b5d..47184411fed9 100644 --- a/packages/node/test/integrations/undici.test.ts +++ b/packages/node/test/integrations/undici.test.ts @@ -10,7 +10,7 @@ import { URL_QUERY, URL_SCHEME, } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { channel } from 'node:diagnostics_channel'; import { beforeAll, describe, expect, it, vi } from 'vitest'; import type { UndiciRequest } from '../../src/integrations/node-fetch/types'; @@ -61,7 +61,6 @@ describe('instrumentUndici', () => { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch', [SERVER_ADDRESS]: 'api.example.com', [SERVER_PORT]: 443, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', }, onlyIfParent: true, }); diff --git a/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts b/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts index 988e3b36c70e..40901670ab87 100644 --- a/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts +++ b/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts @@ -1,4 +1,4 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; import { WEB_SERVER_MIDDLEWARE_SPAN_OP } from '@sentry/conventions/op'; import { captureException, @@ -7,7 +7,6 @@ import { getClient, httpHeadersToSpanAttributes, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, SPAN_STATUS_OK, type SpanAttributes, @@ -166,7 +165,7 @@ function getSpanAttributes( ): SpanAttributes { const attributes: SpanAttributes = { [SENTRY_OP]: WEB_SERVER_MIDDLEWARE_SPAN_OP, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.middleware.nuxt', 'nuxt.middleware.name': middlewareName, 'nuxt.middleware.hook.name': hookName ?? 'handler', diff --git a/packages/react-router/src/client/createClientInstrumentation.ts b/packages/react-router/src/client/createClientInstrumentation.ts index 24cc79b7095f..67112409a7fd 100644 --- a/packages/react-router/src/client/createClientInstrumentation.ts +++ b/packages/react-router/src/client/createClientInstrumentation.ts @@ -9,7 +9,6 @@ import { GLOBAL_OBJ, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, SPAN_STATUS_ERROR, startSpan, @@ -25,7 +24,13 @@ import { finalizeNavigationSpanFromHydratedRouter, updateNavigationSpanUrlFromLocation, } from './utils'; -import { CODE_FUNCTION_NAME, SENTRY_OP, URL_FULL, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + CODE_FUNCTION_NAME, + SENTRY_OP, + URL_FULL, + URL_TEMPLATE, +} from '@sentry/conventions/attributes'; import { GENERAL_FUNCTION_SPAN_OP, WEB_SERVER_MIDDLEWARE_SPAN_OP } from '@sentry/conventions/op'; const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; @@ -108,7 +113,7 @@ export function createSentryClientInstrumentation( { name: pathname, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'browser.popstate', @@ -151,7 +156,7 @@ export function createSentryClientInstrumentation( { name: currentPathname, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': navigationType, @@ -196,7 +201,7 @@ export function createSentryClientInstrumentation( { name: toPath, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', @@ -385,7 +390,7 @@ function updateRootSpanRoute(routeName: string, hasPattern: boolean): void { } updateSpanName(rootSpan, routeName); - rootSpan.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: routeName }); + rootSpan.setAttributes({ [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: routeName }); } /** diff --git a/packages/react-router/src/client/hydratedRouter.ts b/packages/react-router/src/client/hydratedRouter.ts index f8e517c500ef..47562b183b80 100644 --- a/packages/react-router/src/client/hydratedRouter.ts +++ b/packages/react-router/src/client/hydratedRouter.ts @@ -9,7 +9,6 @@ import { isThenable, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, } from '@sentry/core'; import type { DataRouter } from 'react-router'; @@ -22,7 +21,7 @@ import { resolveNavigateAbsoluteUrl, resolveNavigateArg, } from './utils'; -import { SENTRY_OP, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; const GLOBAL_OBJ_WITH_DATA_ROUTER = GLOBAL_OBJ as typeof GLOBAL_OBJ & { __reactRouterDataRouter?: DataRouter; @@ -60,7 +59,7 @@ export function instrumentHydratedRouter(): void { ) { pageloadSpan.updateName(parameterizePageloadRoute); pageloadSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react_router', [URL_TEMPLATE]: parameterizePageloadRoute, }); @@ -135,7 +134,7 @@ export function instrumentHydratedRouter(): void { if ( rootSpanAttributes[SENTRY_OP] === 'navigation' && isClientInstrumentationApiUsed() && - rootSpanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === 'route' + rootSpanAttributes[SENTRY_SEGMENT_NAME_SOURCE] === 'route' ) { return; } @@ -154,7 +153,7 @@ export function instrumentHydratedRouter(): void { ) { rootSpan.updateName(parameterizedRoute); rootSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: parameterizedRoute, }); } @@ -192,7 +191,7 @@ function maybeCreateNavigationTransaction(name: string, url: string, source: 'ur { name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react_router', ...(source === 'route' ? { [URL_TEMPLATE]: name } : {}), diff --git a/packages/react-router/src/client/utils.ts b/packages/react-router/src/client/utils.ts index c8e522b182b2..fab6bf827ad0 100644 --- a/packages/react-router/src/client/utils.ts +++ b/packages/react-router/src/client/utils.ts @@ -1,7 +1,7 @@ import { getAbsoluteUrl } from '@sentry/browser'; import type { Span } from '@sentry/core'; -import { GLOBAL_OBJ, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, filterCollectedUrl } from '@sentry/core'; -import { URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { GLOBAL_OBJ, filterCollectedUrl } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; import type { DataRouter, RouterState } from 'react-router'; const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; @@ -104,7 +104,7 @@ export function updateNavigationSpanUrlFromLocation(span: Span): void { span.updateName(pathname); span.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_PATH]: pathname, [URL_FULL]: filterCollectedUrl(destinationUrl), }); @@ -147,7 +147,7 @@ export function finalizeNavigationSpanFromRouterState(span: Span, routerState: R const parameterizedRoute = getParameterizedRoute(routerState); span.updateName(parameterizedRoute); span.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: parameterizedRoute, }); } diff --git a/packages/react-router/src/server/createServerInstrumentation.ts b/packages/react-router/src/server/createServerInstrumentation.ts index f62bb3ac9dec..673a1e155725 100644 --- a/packages/react-router/src/server/createServerInstrumentation.ts +++ b/packages/react-router/src/server/createServerInstrumentation.ts @@ -1,4 +1,5 @@ import { + SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME, HTTP_REQUEST_METHOD, HTTP_ROUTE, @@ -15,7 +16,6 @@ import { getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, startSpan, updateSpanName, @@ -72,7 +72,7 @@ export function createSentryServerInstrumentation( existingRootSpan.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: filterCollectedUrl(info.request.url), [URL_PATH]: pathname, }); @@ -97,7 +97,7 @@ export function createSentryServerInstrumentation( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.instrumentation_api', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [HTTP_REQUEST_METHOD]: info.request.method, [URL_PATH]: pathname, [URL_FULL]: filterCollectedUrl(info.request.url), @@ -276,7 +276,7 @@ function updateRootSpanWithRoute(method: string, pattern: string | undefined, ur updateSpanName(rootSpan, transactionName); rootSpan.setAttributes({ [HTTP_ROUTE]: routeName, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: hasPattern ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: hasPattern ? 'route' : 'url', }); // Also update the scope's transaction name so errors captured during this request diff --git a/packages/react-router/src/server/wrapSentryHandleRequest.ts b/packages/react-router/src/server/wrapSentryHandleRequest.ts index 1ac6349cd99e..6227c0693902 100644 --- a/packages/react-router/src/server/wrapSentryHandleRequest.ts +++ b/packages/react-router/src/server/wrapSentryHandleRequest.ts @@ -1,11 +1,10 @@ -import { HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; import { flushIfServerless, getActiveSpan, getCurrentScope, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, updateSpanName, } from '@sentry/core'; import type { AppLoadContext, EntryContext, RouterContextProvider } from 'react-router'; @@ -81,12 +80,12 @@ export function wrapSentryHandleRequest( if (isInstrumentationApiUsed()) { rootSpan.setAttributes({ [HTTP_ROUTE]: routeName, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }); } else { rootSpan.setAttributes({ [HTTP_ROUTE]: routeName, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', }); } diff --git a/packages/react/src/reactrouter-compat-utils/instrumentation.tsx b/packages/react/src/reactrouter-compat-utils/instrumentation.tsx index 3ee8e246216b..847ccfe295bd 100644 --- a/packages/react/src/reactrouter-compat-utils/instrumentation.tsx +++ b/packages/react/src/reactrouter-compat-utils/instrumentation.tsx @@ -18,7 +18,6 @@ import { PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, } from '@sentry/core'; import * as React from 'react'; @@ -49,7 +48,7 @@ import { setNavigationContext, transactionNameHasWildcard, } from './utils'; -import { SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; let _useEffect: UseEffect; let _useLocation: UseLocation; @@ -390,7 +389,7 @@ export function updateNavigationSpan( _enableAsyncRouteHandlers, ); - const currentSource = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + const currentSource = attributes[SENTRY_SEGMENT_NAME_SOURCE]; const isImprovement = name && (!currentName || // No current name - always set @@ -399,7 +398,7 @@ export function updateNavigationSpan( (currentSource === 'route' && source === 'route' && currentNameHasWildcard)); // Route → better route (only if current has wildcard) if (isImprovement) { activeRootSpan.updateName(name); - activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + activeRootSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); if (source === 'route') { activeRootSpan.setAttribute(URL_TEMPLATE, name); } @@ -728,7 +727,7 @@ export function createReactRouterV6CompatibleTracingIntegration( // once the router renders, which updates the span name then. name: hasSpanStreamingEnabled(client) ? PAGELOAD_SPAN_NAME_FALLBACK : initPathName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter${version ? `_v${version}` : ''}`, }, @@ -998,7 +997,7 @@ export function handleNavigation(opts: { } else { // Update existing real span from wildcard to parameterized route name trackedNav.span.updateName(name); - trackedNav.span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + trackedNav.span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); if (source === 'route') { trackedNav.span.setAttribute(URL_TEMPLATE, name); } @@ -1030,7 +1029,7 @@ export function handleNavigation(opts: { navigationSpan = startBrowserTracingNavigationSpan(client, { name: placeholderEntry.routeName, // Use placeholder's routeName in case it was updated attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter${version ? `_v${version}` : ''}`, ...(source === 'route' && { [URL_TEMPLATE]: placeholderEntry.routeName }), @@ -1139,7 +1138,7 @@ function updatePageloadTransaction({ const client = getClient(); const isUnparameterizedStreamedPageload = source !== 'route' && !!client && hasSpanStreamingEnabled(client); activeRootSpan.updateName(isUnparameterizedStreamedPageload ? PAGELOAD_SPAN_NAME_FALLBACK : name); - activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + activeRootSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); if (source === 'route') { activeRootSpan.setAttribute(URL_TEMPLATE, name); } @@ -1209,7 +1208,7 @@ function tryUpdateSpanNameBeforeEnd( allRoutes: Set, ): void { try { - const currentSource = spanJson.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] as string | undefined; + const currentSource = spanJson.attributes[SENTRY_SEGMENT_NAME_SOURCE] as string | undefined; if (currentSource === 'route' && currentName && !transactionNameHasWildcard(currentName)) { return; @@ -1242,7 +1241,7 @@ function tryUpdateSpanNameBeforeEnd( const isUnparameterizedStreamedPageload = spanType === 'pageload' && source !== 'route' && !!client && hasSpanStreamingEnabled(client); span.updateName(isUnparameterizedStreamedPageload ? PAGELOAD_SPAN_NAME_FALLBACK : name); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); if (source === 'route') { span.setAttribute(URL_TEMPLATE, name); } @@ -1287,7 +1286,7 @@ function patchSpanEnd( const spanJson = spanToJSON(span); const currentName = spanJson.name; - const currentSource = spanJson.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + const currentSource = spanJson.attributes[SENTRY_SEGMENT_NAME_SOURCE]; // Helper to clean up activeNavigationSpans after span ends const cleanupNavigationSpan = (): void => { diff --git a/packages/react/src/reactrouter.tsx b/packages/react/src/reactrouter.tsx index 42b25a866788..e76e76578cc2 100644 --- a/packages/react/src/reactrouter.tsx +++ b/packages/react/src/reactrouter.tsx @@ -13,14 +13,13 @@ import { PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, } from '@sentry/core'; import type { ReactElement } from 'react'; import * as React from 'react'; import { hoistNonReactStatics } from './hoist-non-react-statics'; import type { Action, Location } from './types'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; // We need to disable eslint no-explicit-any because any is required for the // react-router typings. @@ -165,7 +164,7 @@ function instrumentReactRouter( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.${instrumentationName}`, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: name }), }, }); @@ -181,7 +180,7 @@ function instrumentReactRouter( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.${instrumentationName}`, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: name }), }, }); @@ -240,7 +239,7 @@ export function withSentryRouting

, R extends React if (activeRootSpan) { activeRootSpan.updateName(route); activeRootSpan.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: route, }); } diff --git a/packages/react/src/reactrouterv3.ts b/packages/react/src/reactrouterv3.ts index e9a6208a1a58..5f44d9df6f2a 100644 --- a/packages/react/src/reactrouterv3.ts +++ b/packages/react/src/reactrouterv3.ts @@ -10,10 +10,9 @@ import { PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_OP, 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 { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } 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. @@ -71,7 +70,7 @@ export function reactRouterV3BrowserTracingIntegration( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: localName }), }, }); @@ -92,7 +91,7 @@ export function reactRouterV3BrowserTracingIntegration( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: localName }), }, }); diff --git a/packages/react/src/tanstackrouter.ts b/packages/react/src/tanstackrouter.ts index f79592599f74..0c6c2afa8cf1 100644 --- a/packages/react/src/tanstackrouter.ts +++ b/packages/react/src/tanstackrouter.ts @@ -7,13 +7,10 @@ import { } from '@sentry/browser'; import type { Integration } from '@sentry/core/browser'; import { filterCollectedUrl, hasSpanStreamingEnabled, PAGELOAD_SPAN_NAME_FALLBACK } from '@sentry/core'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core/browser'; import type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types'; import { + SENTRY_SEGMENT_NAME_SOURCE, PARAMS_KEY_BASE, URL_FULL, URL_PATH, @@ -73,7 +70,7 @@ export function tanstackRouterBrowserTracingIntegration( fallbackName: string, ): void => { span.updateName(match ? match.routeId : fallbackName); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, match ? 'route' : 'url'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, match ? 'route' : 'url'); span.setAttributes({ ...(match && { [URL_TEMPLATE]: match.routeId }), ...locationToSpanUrlAttributes(castRouterInstance, toLocation), @@ -101,7 +98,7 @@ export function tanstackRouterBrowserTracingIntegration( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), }, @@ -155,7 +152,7 @@ export function tanstackRouterBrowserTracingIntegration( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), }, diff --git a/packages/remix/src/client/performance.tsx b/packages/remix/src/client/performance.tsx index 4890eb31773b..c9d2ebc25a97 100644 --- a/packages/remix/src/client/performance.tsx +++ b/packages/remix/src/client/performance.tsx @@ -8,14 +8,13 @@ import { PAGELOAD_SPAN_NAME_FALLBACK, isNodeEnv, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import type { BrowserClient, browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/react'; import { getClient, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, WINDOW } from '@sentry/react'; import * as React from 'react'; import { DEBUG_BUILD } from '../utils/debug-build'; import { hasManifest, maybeParameterizeRemixRoute } from './remixRouteParameterization'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; export type Params = { readonly [key in Key]: string | undefined; @@ -104,7 +103,7 @@ export function startPageloadSpan(client: Client): void { op: 'pageload', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.remix', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: spanName }), }, }; @@ -128,7 +127,7 @@ function startNavigationSpan(matches: RouteMatch[], location: ReturnType op: 'navigation', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.remix', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [URL_TEMPLATE]: name }), }, }; @@ -189,7 +188,7 @@ export function withSentry

, R extends React.Co const client = getClient(); const isUnparameterizedStreamedPageload = source !== 'route' && !!client && hasSpanStreamingEnabled(client); transaction.updateName(isUnparameterizedStreamedPageload ? PAGELOAD_SPAN_NAME_FALLBACK : name); - transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + transaction.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); if (source === 'route') { transaction.setAttribute(URL_TEMPLATE, name); } diff --git a/packages/remix/src/cloudflare/index.ts b/packages/remix/src/cloudflare/index.ts index 6cecd2b0d442..76f36d25b4e5 100644 --- a/packages/remix/src/cloudflare/index.ts +++ b/packages/remix/src/cloudflare/index.ts @@ -108,7 +108,7 @@ export { zodErrorsIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToStaticSpanJSON, diff --git a/packages/remix/src/server/index.ts b/packages/remix/src/server/index.ts index c68743fa0dd5..93f57b033e36 100644 --- a/packages/remix/src/server/index.ts +++ b/packages/remix/src/server/index.ts @@ -84,7 +84,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setContext, setCurrentClient, setExtra, diff --git a/packages/remix/src/server/instrumentServer.ts b/packages/remix/src/server/instrumentServer.ts index 6880fa95707f..357d8739ad75 100644 --- a/packages/remix/src/server/instrumentServer.ts +++ b/packages/remix/src/server/instrumentServer.ts @@ -27,7 +27,6 @@ import { loadModule, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, spanToJSON, startSpan, @@ -41,7 +40,14 @@ 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 { CODE_FUNCTION_NAME, HTTP_ROUTE, SENTRY_OP, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + CODE_FUNCTION_NAME, + HTTP_ROUTE, + SENTRY_OP, + URL_FULL, + URL_PATH, +} from '@sentry/conventions/attributes'; import { WEB_SERVER_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; type AppData = unknown; @@ -181,7 +187,7 @@ function updateSpanWithRoute(args: DataFunctionArgs, build: ServerBuild): void { const newSpanName = currentSpanName?.startsWith(method) ? `${method} ${transactionName}` : transactionName; rootSpan.updateName(newSpanName); - rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + rootSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); if (source === 'route') { rootSpan.setAttribute(HTTP_ROUTE, transactionName); } @@ -356,7 +362,7 @@ function wrapRequestHandler ServerBuild | Promise const rootSpan = getRootSpan(parentSpan); rootSpan?.updateName(name); rootSpan?.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, ...(source === 'route' && { [HTTP_ROUTE]: name, }), @@ -380,13 +386,13 @@ function wrapRequestHandler ServerBuild | Promise const parentSpan = getActiveSpan(); const rootSpan = parentSpan && getRootSpan(parentSpan); rootSpan?.updateName(name); - rootSpan?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + rootSpan?.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); return startSpan( { name, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.remix', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', [URL_FULL]: filterCollectedUrl(url.href), [URL_PATH]: url.pathname, diff --git a/packages/remix/src/server/integrations/tracing-channel.ts b/packages/remix/src/server/integrations/tracing-channel.ts index b37c9eec28c0..4de3455e5239 100644 --- a/packages/remix/src/server/integrations/tracing-channel.ts +++ b/packages/remix/src/server/integrations/tracing-channel.ts @@ -8,7 +8,6 @@ import { parseStringToURLObject, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startInactiveSpan, waitForTracingChannelBinding, @@ -16,6 +15,7 @@ import { } from '@sentry/core'; import { bindTracingChannelToSpan } from '@sentry/server-utils'; import { + SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME, HTTP_METHOD, HTTP_ROUTE, @@ -133,7 +133,7 @@ function enrichActiveSpanWithRoute(result: unknown): void { // oxlint-disable-next-line typescript/no-deprecated const method = spanToJSON(span).attributes[HTTP_METHOD]; span.updateName(typeof method === 'string' ? `${method} ${route.path}` : route.path); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); } if (route?.id) { span.setAttribute(MATCH_ROUTE_ID, route.id); @@ -155,7 +155,7 @@ function subscribeRequestHandler(): void { [SENTRY_KIND]: 'server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', - ...(hasUrlName && { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' }), + ...(hasUrlName && { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' }), [CODE_FUNCTION_NAME]: 'requestHandler', ...requestAttributes, }, diff --git a/packages/replay-internal/src/replay.ts b/packages/replay-internal/src/replay.ts index 8d156dfcf51a..6d6ec213b653 100644 --- a/packages/replay-internal/src/replay.ts +++ b/packages/replay-internal/src/replay.ts @@ -1,6 +1,7 @@ /* eslint-disable max-lines */ // TODO: We might want to split this file up +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import type { ReplayRecordingMode, ReplayStopReason, Span } from '@sentry/core'; -import { getActiveSpan, getClient, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON } from '@sentry/core'; +import { getActiveSpan, getClient, getRootSpan, spanToJSON } from '@sentry/core'; import { EventType, record } from '@sentry/rrweb'; import { BUFFER_CHECKOUT_TIME, @@ -844,7 +845,7 @@ export class ReplayContainer implements ReplayContainerInterface { } const spanJson = spanToJSON(lastRootSpan); - const source = spanJson.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] as string | undefined; + const source = spanJson.attributes[SENTRY_SEGMENT_NAME_SOURCE] as string | undefined; if (!source || !['route', 'custom'].includes(source)) { return undefined; } diff --git a/packages/server-utils/src/integrations/amqplib.ts b/packages/server-utils/src/integrations/amqplib.ts index 2ce8b9d8fb91..62232b1e6493 100644 --- a/packages/server-utils/src/integrations/amqplib.ts +++ b/packages/server-utils/src/integrations/amqplib.ts @@ -6,7 +6,6 @@ import { defineIntegration, getTraceData, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, startInactiveSpan, timestampInSeconds, @@ -20,6 +19,7 @@ import { NETWORK_PROTOCOL_VERSION, SENTRY_KIND, SENTRY_OP, + SENTRY_SEGMENT_NAME_SOURCE, SERVER_ADDRESS, SERVER_PORT, URL_FULL, @@ -502,7 +502,7 @@ function startConsumeSpan(queue: string, msg: ConsumeMessage, channel: ChannelLi attributes: { [SENTRY_OP]: MESSAGING_QUEUE_PROCESS_SPAN_OP, [SENTRY_KIND]: 'consumer', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', ...getStoredConnectionAttributes(channel), [ATTR_MESSAGING_DESTINATION]: msg.fields?.exchange, // TODO(v11) remove this attribute [MESSAGING_DESTINATION_NAME]: msg.fields?.exchange, diff --git a/packages/server-utils/src/integrations/firebase/functions.ts b/packages/server-utils/src/integrations/firebase/functions.ts index 2b331896013f..3fe2d95c78ac 100644 --- a/packages/server-utils/src/integrations/firebase/functions.ts +++ b/packages/server-utils/src/integrations/firebase/functions.ts @@ -1,11 +1,16 @@ -import { FAAS_NAME, FAAS_TRIGGER, SENTRY_KIND, SENTRY_OP } from '@sentry/conventions/attributes'; +import { + FAAS_NAME, + FAAS_TRIGGER, + SENTRY_KIND, + SENTRY_OP, + SENTRY_SEGMENT_NAME_SOURCE, +} from '@sentry/conventions/attributes'; import { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op'; import type { SpanAttributes } from '@sentry/core'; import { captureException, flush, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, startSpanManual, } from '@sentry/core'; @@ -60,7 +65,7 @@ function wrapHandler(handler: Handler, triggerType: string): Handler { 'faas.provider': 'firebase', [SENTRY_KIND]: 'server', [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', }; if (process.env.GCLOUD_PROJECT) { diff --git a/packages/server-utils/src/integrations/graphql/utils.ts b/packages/server-utils/src/integrations/graphql/utils.ts index c92f10d6da93..ae95c1fcf308 100644 --- a/packages/server-utils/src/integrations/graphql/utils.ts +++ b/packages/server-utils/src/integrations/graphql/utils.ts @@ -1,6 +1,6 @@ -import { SENTRY_GRAPHQL_OPERATION } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_GRAPHQL_OPERATION } from '@sentry/conventions/attributes'; import type { Span, SpanAttributeValue } from '@sentry/core'; -import { getClient, isObjectLike, getRootSpan, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { getClient, isObjectLike, getRootSpan, spanToJSON } from '@sentry/core'; import type { GraphqlDocumentNode, GraphqlToken } from './types'; // Same key the OTel path uses, so renames stay consistent across both. @@ -45,9 +45,9 @@ export function renameRootSpanWithOperation(span: Span, operationType: string, o } // `updateName` stamps `source: 'custom'`, so re-set the original source afterwards to preserve it. - const source = rootSpanJson.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + const source = rootSpanJson.attributes[SENTRY_SEGMENT_NAME_SOURCE]; rootSpan.updateName(`${originalDescription} (${getGraphqlOperationNamesFromAttribute(operations)})`); - rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source as SpanAttributeValue); + rootSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source as SpanAttributeValue); } /** Format the accumulated operations for the root span name: up to 5 sorted names, then `+N`. */ diff --git a/packages/server-utils/src/integrations/redis/redis-cache.ts b/packages/server-utils/src/integrations/redis/redis-cache.ts index 8a52ae288c8d..ac3ae1bf8ec4 100644 --- a/packages/server-utils/src/integrations/redis/redis-cache.ts +++ b/packages/server-utils/src/integrations/redis/redis-cache.ts @@ -3,6 +3,7 @@ import { NET_PEER_PORT, NETWORK_PEER_ADDRESS, NETWORK_PEER_PORT, + SENTRY_SEGMENT_NAME_SOURCE, SERVER_ADDRESS, SERVER_PORT, } from '@sentry/conventions/attributes'; @@ -17,7 +18,6 @@ import { SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, SEMANTIC_ATTRIBUTE_CACHE_KEY, SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, truncate, } from '@sentry/core'; @@ -205,7 +205,7 @@ export function applyRedisCacheAttributes( const spanDescription = safeKey.join(', '); span.updateName(options.maxCacheKeyLength ? truncate(spanDescription, options.maxCacheKeyLength) : spanDescription); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, undefined); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, undefined); } type NestedArray = Array | T>; diff --git a/packages/server-utils/src/utils/setHttpServerSpanRouteAttribute.ts b/packages/server-utils/src/utils/setHttpServerSpanRouteAttribute.ts index a62f49374094..4af92e7e178f 100644 --- a/packages/server-utils/src/utils/setHttpServerSpanRouteAttribute.ts +++ b/packages/server-utils/src/utils/setHttpServerSpanRouteAttribute.ts @@ -1,5 +1,11 @@ -import { HTTP_METHOD, HTTP_REQUEST_METHOD, HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; -import { getActiveSpan, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON } from '@sentry/core'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + HTTP_METHOD, + HTTP_REQUEST_METHOD, + HTTP_ROUTE, + 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. @@ -27,5 +33,5 @@ export function setHttpServerSpanRouteAttribute(route: string): void { const method = attributes[HTTP_REQUEST_METHOD] || attributes[HTTP_METHOD] || 'GET'; rootSpan.setAttribute(HTTP_ROUTE, route); rootSpan.updateName(`${method} ${route}`); - rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + rootSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); } diff --git a/packages/solid/src/solidrouter.ts b/packages/solid/src/solidrouter.ts index 564e1e9b70ac..a2e3542c738f 100644 --- a/packages/solid/src/solidrouter.ts +++ b/packages/solid/src/solidrouter.ts @@ -7,6 +7,7 @@ import { startBrowserTracingNavigationSpan, } from '@sentry/browser'; import { + SENTRY_SEGMENT_NAME_SOURCE, PARAMS_KEY_BASE, URL_FULL, URL_PATH, @@ -18,7 +19,6 @@ import { getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, filterCollectedUrl, } from '@sentry/core'; import type { @@ -67,7 +67,7 @@ function handleNavigation(location: string): void { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.${framework}.solidrouter`, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }, isBackNavigation ? undefined : { url: getAbsoluteUrl(location) }, @@ -131,7 +131,7 @@ function withSentryRouterRoot(Root: Component): Component): Component( fallbackName: string, ): void => { span.updateName(match ? match.routeId : fallbackName); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, match ? 'route' : 'url'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, match ? 'route' : 'url'); span.setAttributes({ [URL_TEMPLATE]: match?.routeId, ...locationToSpanUrlAttributes(router, toLocation), @@ -96,7 +96,7 @@ export function tanstackRouterBrowserTracingIntegration( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.solid.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), }, @@ -152,7 +152,7 @@ export function tanstackRouterBrowserTracingIntegration( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), }, diff --git a/packages/solidstart/src/server/index.ts b/packages/solidstart/src/server/index.ts index 72cbcf7ad78c..69a289422403 100644 --- a/packages/solidstart/src/server/index.ts +++ b/packages/solidstart/src/server/index.ts @@ -88,7 +88,7 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, setContext, setCurrentClient, setExtra, diff --git a/packages/solidstart/src/server/withServerActionInstrumentation.ts b/packages/solidstart/src/server/withServerActionInstrumentation.ts index 9d9372e49c6c..8e11342ec747 100644 --- a/packages/solidstart/src/server/withServerActionInstrumentation.ts +++ b/packages/solidstart/src/server/withServerActionInstrumentation.ts @@ -4,9 +4,15 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, } from '@sentry/core'; -import { captureException, getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startSpan } from '@sentry/node'; +import { captureException, getActiveSpan, spanToJSON, startSpan } from '@sentry/node'; import { isRedirect } from './utils'; -import { HTTP_ROUTE, HTTP_TARGET, SENTRY_OP, URL_PATH } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + HTTP_ROUTE, + HTTP_TARGET, + SENTRY_OP, + URL_PATH, +} from '@sentry/conventions/attributes'; import { WEB_SERVER_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; import { setHttpServerSpanRouteAttribute } from '@sentry/server-utils'; @@ -45,7 +51,7 @@ export async function withServerActionInstrumentation { diff --git a/packages/sveltekit/src/client/load.ts b/packages/sveltekit/src/client/load.ts index bc95867e718a..16c54bc9106c 100644 --- a/packages/sveltekit/src/client/load.ts +++ b/packages/sveltekit/src/client/load.ts @@ -3,10 +3,9 @@ import { handleCallbackErrors, objectify, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, } from '@sentry/core'; -import { CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; import { GENERAL_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; import { captureException } from '@sentry/svelte'; import type { LoadEvent } from '@sveltejs/kit'; @@ -82,7 +81,7 @@ export function wrapLoadWithSentry any>(origLoad: T) [SENTRY_OP]: GENERAL_FUNCTION_SPAN_OP, [CODE_FUNCTION_NAME]: 'load', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeId ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeId ? 'route' : 'url', }, name: routeId ? routeId : event.url.pathname, }, diff --git a/packages/sveltekit/src/client/svelte4BrowserTracing.ts b/packages/sveltekit/src/client/svelte4BrowserTracing.ts index 818a8ffe2f61..2496ef817463 100644 --- a/packages/sveltekit/src/client/svelte4BrowserTracing.ts +++ b/packages/sveltekit/src/client/svelte4BrowserTracing.ts @@ -1,10 +1,5 @@ import type { Client, Span } from '@sentry/core'; -import { - hasSpanStreamingEnabled, - PAGELOAD_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core'; +import { hasSpanStreamingEnabled, PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { getCurrentScope, startBrowserTracingNavigationSpan, @@ -12,7 +7,7 @@ import { startInactiveSpan, WINDOW, } from '@sentry/svelte'; -import { SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; import type { Navigation, Page } from '@sveltejs/kit'; // eslint-disable-next-line typescript/no-deprecated import { navigating, page } from '$app/stores'; @@ -48,7 +43,7 @@ function _instrumentPageload(client: Client, pageStore: Readable): void { op: 'pageload', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }); if (!pageloadSpan) { @@ -64,7 +59,7 @@ function _instrumentPageload(client: Client, pageStore: Readable): void { if (routeId) { pageloadSpan.updateName(routeId); - pageloadSpan.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: routeId }); + pageloadSpan.setAttributes({ [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: routeId }); getCurrentScope().setTransactionName(routeId); } }); @@ -123,7 +118,7 @@ function _instrumentNavigations(client: Client, navigatingStore: Readable { if (routeId) { pageLoadSpan.updateName(routeId); - pageLoadSpan.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [URL_TEMPLATE]: routeId }); + pageLoadSpan.setAttributes({ [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: routeId }); getCurrentScope().setTransactionName(routeId); } }); @@ -103,7 +98,7 @@ function _instrumentNavigations(client: Client): void { op: 'navigation', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: parameterizedRouteDestination ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: parameterizedRouteDestination ? 'route' : 'url', ...(parameterizedRouteDestination && { [URL_TEMPLATE]: parameterizedRouteDestination }), ...navigationInfo, }, diff --git a/packages/sveltekit/src/server-common/handle.ts b/packages/sveltekit/src/server-common/handle.ts index 593524daae96..82ac28bf66a1 100644 --- a/packages/sveltekit/src/server-common/handle.ts +++ b/packages/sveltekit/src/server-common/handle.ts @@ -11,7 +11,6 @@ import { httpHeadersToSpanAttributes, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, spanToJSON, startSpan, @@ -24,7 +23,7 @@ import { import type { Handle, ResolveOptions } from '@sveltejs/kit'; import { DEBUG_BUILD } from '../common/debug-build'; import { getTracePropagationData, sendErrorToSentry } from './utils'; -import { HTTP_ROUTE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; export type SentryHandleOptions = { /** @@ -180,7 +179,7 @@ async function instrumentHandle( kitRootSpan.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeName ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeName ? 'route' : 'url', 'sveltekit.tracing.original_name': originalName, [URL_FULL]: (kitRootSpanAttributes[URL_FULL] as string | undefined) ?? filterCollectedUrl(event.url.href), [URL_PATH]: (kitRootSpanAttributes[URL_PATH] as string | undefined) ?? event.url.pathname, @@ -213,7 +212,7 @@ async function instrumentHandle( op: 'http.server', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeId ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeId ? 'route' : 'url', 'http.method': event.request.method, [URL_FULL]: filterCollectedUrl(event.url.href), [URL_PATH]: event.url.pathname, diff --git a/packages/sveltekit/src/server-common/load.ts b/packages/sveltekit/src/server-common/load.ts index a5f54fee65ca..594e52026464 100644 --- a/packages/sveltekit/src/server-common/load.ts +++ b/packages/sveltekit/src/server-common/load.ts @@ -1,11 +1,5 @@ -import { - addNonEnumerableProperty, - flushIfServerless, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - startSpan, -} from '@sentry/core'; -import { CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { addNonEnumerableProperty, flushIfServerless, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; import { WEB_SERVER_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; import type { LoadEvent, ServerLoadEvent } from '@sveltejs/kit'; import type { SentryWrappedFlag } from '../common/utils'; @@ -46,7 +40,7 @@ export function wrapLoadWithSentry any>(origLoad: T) [SENTRY_OP]: WEB_SERVER_FUNCTION_SPAN_OP, [CODE_FUNCTION_NAME]: 'load', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeId ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeId ? 'route' : 'url', }, name: routeId ? routeId : event.url.pathname, }, @@ -110,7 +104,7 @@ export function wrapServerLoadWithSentry any>(origSe [SENTRY_OP]: WEB_SERVER_FUNCTION_SPAN_OP, [CODE_FUNCTION_NAME]: 'load', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit.server', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeId ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeId ? 'route' : 'url', 'http.method': event.request.method, }, name: routeId ? routeId : event.url.pathname, diff --git a/packages/sveltekit/src/server-common/serverRoute.ts b/packages/sveltekit/src/server-common/serverRoute.ts index b72e0b831fb5..79f99cdffb95 100644 --- a/packages/sveltekit/src/server-common/serverRoute.ts +++ b/packages/sveltekit/src/server-common/serverRoute.ts @@ -1,10 +1,4 @@ -import { - addNonEnumerableProperty, - flushIfServerless, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - startSpan, -} from '@sentry/core'; +import { addNonEnumerableProperty, flushIfServerless, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; import { CODE_FUNCTION_NAME, HTTP_REQUEST_METHOD, SENTRY_OP } from '@sentry/conventions/attributes'; import { WEB_SERVER_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; import type { RequestEvent } from '@sveltejs/kit'; @@ -58,7 +52,6 @@ export function wrapServerRouteWithSentry( [SENTRY_OP]: WEB_SERVER_FUNCTION_SPAN_OP, [CODE_FUNCTION_NAME]: httpMethod, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', [HTTP_REQUEST_METHOD]: httpMethod, }, onlyIfParent: true, diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index 9d9040bfb9b4..afafbd7541da 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -85,7 +85,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setContext, setCurrentClient, setExtra, diff --git a/packages/sveltekit/src/worker/index.ts b/packages/sveltekit/src/worker/index.ts index 88f995a7212a..22927842682c 100644 --- a/packages/sveltekit/src/worker/index.ts +++ b/packages/sveltekit/src/worker/index.ts @@ -56,7 +56,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setContext, setCurrentClient, setExtra, diff --git a/packages/tanstackstart-react/src/server/globalMiddleware.ts b/packages/tanstackstart-react/src/server/globalMiddleware.ts index 7fca722e7cb9..394b750bb81f 100644 --- a/packages/tanstackstart-react/src/server/globalMiddleware.ts +++ b/packages/tanstackstart-react/src/server/globalMiddleware.ts @@ -1,14 +1,7 @@ -import { - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - addNonEnumerableProperty, - captureException, - getActiveSpan, - spanToJSON, - updateSpanName, -} from '@sentry/core'; +import { addNonEnumerableProperty, captureException, getActiveSpan, spanToJSON, updateSpanName } from '@sentry/core'; import type { SentryGlobalFunctionMiddleware, SentryGlobalRequestMiddleware } from '../common/types'; import { SENTRY_INTERNAL } from './middleware'; -import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; type ServerFnMeta = { id?: string; @@ -43,7 +36,7 @@ function createSentryFunctionMiddlewareHandler(mechanismType: string) { if (serverFnMeta?.name) { const method = spanData.name.split(' ')[0] || 'GET'; updateSpanName(activeSpan, `${method} /_serverFn/${serverFnMeta.name}`); - activeSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + activeSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); } if (serverFnMeta?.id) { activeSpan.setAttribute('tanstackstart.function.id', serverFnMeta.id); diff --git a/packages/tanstackstart-react/src/server/routeParametrization.ts b/packages/tanstackstart-react/src/server/routeParametrization.ts index 98883c79a8a5..8e39a05fcc57 100644 --- a/packages/tanstackstart-react/src/server/routeParametrization.ts +++ b/packages/tanstackstart-react/src/server/routeParametrization.ts @@ -1,10 +1,9 @@ -import { HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; import { escapeStringForRegex, getActiveSpan, getCurrentScope, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, updateSpanName, } from '@sentry/core'; @@ -61,6 +60,6 @@ export function updateSpanWithRouteParametrization(method: string, pathname: str const transactionName = `${method} ${matchedPattern}`; updateSpanName(rootSpan, transactionName); rootSpan.setAttribute(HTTP_ROUTE, matchedPattern); - rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + rootSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); getCurrentScope().setTransactionName(transactionName); } diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index 624914f59276..61e7baec6acc 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -85,7 +85,7 @@ export { consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToStaticSpanJSON, diff --git a/packages/vue/src/router.ts b/packages/vue/src/router.ts index 7c01ea2b2d59..a0d2affddf39 100644 --- a/packages/vue/src/router.ts +++ b/packages/vue/src/router.ts @@ -1,5 +1,6 @@ import { captureException, getAbsoluteUrl } from '@sentry/browser'; import { + SENTRY_SEGMENT_NAME_SOURCE, NAVIGATION_ROUTE_ID, PARAMS_KEY_BASE, SENTRY_OP, @@ -15,7 +16,6 @@ import { hasSpanStreamingEnabled, PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, } from '@sentry/core'; @@ -119,13 +119,13 @@ export function instrumentVueRouter( // Update the existing page load span with parametrized route information if (options.instrumentPageLoad && activePageLoadSpan) { const existingAttributes = spanToJSON(activePageLoadSpan).attributes; - if (existingAttributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== 'custom') { + if (existingAttributes[SENTRY_SEGMENT_NAME_SOURCE] !== 'custom') { // With span streaming, span names have to be low cardinality, so we can't fall back to the URL. const client = getClient(); const isUnparameterizedStreamedPageload = transactionSource === 'url' && !!client && hasSpanStreamingEnabled(client); activePageLoadSpan.updateName(isUnparameterizedStreamedPageload ? PAGELOAD_SPAN_NAME_FALLBACK : spanName); - activePageLoadSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, transactionSource); + activePageLoadSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, transactionSource); } // Set router attributes on the existing pageload transaction @@ -146,7 +146,7 @@ export function instrumentVueRouter( attributes: { ...attributes, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: transactionSource, + [SENTRY_SEGMENT_NAME_SOURCE]: transactionSource, }, }, getAbsoluteUrl(to.fullPath ?? to.path), diff --git a/packages/vue/src/tanstackrouter.ts b/packages/vue/src/tanstackrouter.ts index 4aa4bd1880e9..741f92d68ee9 100644 --- a/packages/vue/src/tanstackrouter.ts +++ b/packages/vue/src/tanstackrouter.ts @@ -6,6 +6,7 @@ import { WINDOW, } from '@sentry/browser'; import { + SENTRY_SEGMENT_NAME_SOURCE, PARAMS_KEY_BASE, URL_FULL, URL_PATH, @@ -18,7 +19,6 @@ import { PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, filterCollectedUrl, } from '@sentry/core'; import type { AnyRouter } from '@tanstack/vue-router'; @@ -77,7 +77,7 @@ export function tanstackRouterBrowserTracingIntegration( fallbackName: string, ): void => { span.updateName(match ? match.routeId : fallbackName); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, match ? 'route' : 'url'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, match ? 'route' : 'url'); span.setAttributes({ [URL_TEMPLATE]: match?.routeId, ...locationToSpanUrlAttributes(router, toLocation), @@ -102,7 +102,7 @@ export function tanstackRouterBrowserTracingIntegration( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), }, @@ -159,7 +159,7 @@ export function tanstackRouterBrowserTracingIntegration( attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: routeMatch ? 'route' : 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: routeMatch ? 'route' : 'url', ...(routeMatch && { [URL_TEMPLATE]: routeMatch.routeId }), ...routeMatchToParamSpanAttributes(routeMatch), }, From 702e79618b5078e9686fc50fd0c7d1c4cbef2587 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 14:19:31 +0200 Subject: [PATCH 02/13] ref: Re-export SENTRY_SEGMENT_NAME_SOURCE from remaining SDK entry points Restore a same-package migration path where SEMANTIC_ATTRIBUTE_SENTRY_SOURCE was previously public: browser, Remix server, and SvelteKit server/worker. Co-Authored-By: Cursor Grok 4.6 --- packages/browser/src/exports.ts | 1 + packages/remix/src/server/index.ts | 1 + packages/sveltekit/src/server/index.ts | 1 + packages/sveltekit/src/worker/index.ts | 1 + 4 files changed, 4 insertions(+) diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index 6cb5f41c60fa..d6d5b78f25f4 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -80,6 +80,7 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, + SENTRY_SEGMENT_NAME_SOURCE, } from '@sentry/core/browser'; export { WINDOW } from './helpers'; diff --git a/packages/remix/src/server/index.ts b/packages/remix/src/server/index.ts index 93f57b033e36..2ca9dd356a47 100644 --- a/packages/remix/src/server/index.ts +++ b/packages/remix/src/server/index.ts @@ -84,6 +84,7 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, + SENTRY_SEGMENT_NAME_SOURCE, setContext, setCurrentClient, setExtra, diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index afafbd7541da..ecff2143254c 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -85,6 +85,7 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, + SENTRY_SEGMENT_NAME_SOURCE, setContext, setCurrentClient, setExtra, diff --git a/packages/sveltekit/src/worker/index.ts b/packages/sveltekit/src/worker/index.ts index 22927842682c..696d1ff1809d 100644 --- a/packages/sveltekit/src/worker/index.ts +++ b/packages/sveltekit/src/worker/index.ts @@ -56,6 +56,7 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, + SENTRY_SEGMENT_NAME_SOURCE, setContext, setCurrentClient, setExtra, From 000ed7ef93f1995f455488f21e88f94696811f76 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 16:54:59 +0200 Subject: [PATCH 03/13] ref(core): Keep segment name-source helper off the public API Rename the helper to INTERNAL_setSegmentNameSourceIfSegment and drop 'segment' from the debug log so it is not a user-facing term. Co-Authored-By: Cursor Grok 4.6 --- docs/migration/v11-end-state.md | 2 +- packages/core/src/shared-exports.ts | 2 +- packages/core/src/tracing/sentrySpan.ts | 7 +++---- packages/core/src/trpc.ts | 4 ++-- packages/core/src/utils/spanUtils.ts | 4 ++-- packages/hono/src/shared/middlewareHandlers.ts | 4 ++-- packages/nextjs/src/common/utils/tracingUtils.ts | 4 ++-- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/docs/migration/v11-end-state.md b/docs/migration/v11-end-state.md index edea27607a0b..338a8d0e4674 100644 --- a/docs/migration/v11-end-state.md +++ b/docs/migration/v11-end-state.md @@ -639,7 +639,7 @@ Attribute availability remains runtime-dependent. For example, browser and Worke Span attributes now use the shared `@sentry/conventions` package under the hood. The deprecated `semanticAttributes` re-export was removed. Import span attribute constants from `@sentry/core` directly. `SEMANTIC_ATTRIBUTE_SENTRY_SOURCE` (`sentry.source`) was removed. Use `SENTRY_SEGMENT_NAME_SOURCE` (`sentry.segment.name.source`) instead. -`sentry.segment.name.source` is only set on segment spans. Setting it on a child span is a no-op: `setAttribute` ignores it, and a value passed in a child span's initial attributes is dropped when the span is linked to its parent. To set it defensively, use `setSegmentNameSourceIfSegment(span, source)` from `@sentry/core`, which no-ops unless `span` is the segment. +`sentry.segment.name.source` is only set on the root span. Setting it on a child span is a no-op: `setAttribute` ignores it, and a value passed in a child span's initial attributes is dropped when the span is linked to its parent. ### Span operation (`op`) changes diff --git a/packages/core/src/shared-exports.ts b/packages/core/src/shared-exports.ts index 8333f46cf796..0a460c82acbe 100644 --- a/packages/core/src/shared-exports.ts +++ b/packages/core/src/shared-exports.ts @@ -114,7 +114,7 @@ export { addChildSpanToSpan, spanTimeInputToSeconds, updateSpanName, - setSegmentNameSourceIfSegment, + INTERNAL_setSegmentNameSourceIfSegment, } from './utils/spanUtils'; export { _setSpanForScope as _INTERNAL_setSpanForScope } from './utils/spanOnScope'; export { parseSampleRate } from './utils/parseSampleRate'; diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index 3d01b17000f6..02a18015ff5b 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -35,7 +35,7 @@ import { getSpanDescendants, getStatusMessage, getStreamedSpanLinks, - setSegmentNameSourceIfSegment, + INTERNAL_setSegmentNameSourceIfSegment, spanIsSegment, spanTimeInputToSeconds, spanToStaticSpanJSON, @@ -181,8 +181,7 @@ export class SentrySpan implements Span { if (key === SENTRY_SEGMENT_NAME_SOURCE && value !== undefined && !spanIsSegment(this)) { DEBUG_BUILD && debug.warn( - `[Tracing] Ignoring \`${SENTRY_SEGMENT_NAME_SOURCE}\` on a non-segment span: the attribute is only valid on segment spans. ` + - 'Set it on the segment span instead, or use `setSegmentNameSourceIfSegment()`.', + `[Tracing] Ignoring \`${SENTRY_SEGMENT_NAME_SOURCE}\` on a child span: this attribute is only valid on the root span.`, ); return this; } @@ -237,7 +236,7 @@ export class SentrySpan implements Span { return this; } this._name = name; - setSegmentNameSourceIfSegment(this, 'custom'); + INTERNAL_setSegmentNameSourceIfSegment(this, 'custom'); return this; } diff --git a/packages/core/src/trpc.ts b/packages/core/src/trpc.ts index 230ef3a3e2f2..ffe7b45d7133 100644 --- a/packages/core/src/trpc.ts +++ b/packages/core/src/trpc.ts @@ -10,7 +10,7 @@ import { getClient, withIsolationScope } from './currentScopes'; import { captureException } from './exports'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; import { startSpanManual } from './tracing/trace'; -import { setSegmentNameSourceIfSegment } from './utils/spanUtils'; +import { INTERNAL_setSegmentNameSourceIfSegment } from './utils/spanUtils'; import { normalize } from './utils/normalize'; import { setNormalizationDepthOverrideHint } from './utils/normalizationHints'; @@ -107,7 +107,7 @@ export function trpcMiddleware(options: SentryTrpcMiddlewareOptions = {}) { async span => { // The procedure path names the segment only when tRPC is not nested in another span, // e.g. an incoming HTTP request span. - setSegmentNameSourceIfSegment(span, 'route'); + INTERNAL_setSegmentNameSourceIfSegment(span, 'route'); try { const nextResult = await next(); diff --git a/packages/core/src/utils/spanUtils.ts b/packages/core/src/utils/spanUtils.ts index c765bdecd705..9fe769198f45 100644 --- a/packages/core/src/utils/spanUtils.ts +++ b/packages/core/src/utils/spanUtils.ts @@ -494,14 +494,14 @@ export function updateSpanName(span: Span, name: string): void { span.setAttributes({ [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: name, }); - setSegmentNameSourceIfSegment(span, 'custom'); + INTERNAL_setSegmentNameSourceIfSegment(span, 'custom'); } /** * Sets `sentry.segment.name.source` only when `span` is the segment span. * No-op for child spans — the attribute must exclusively live on the segment. */ -export function setSegmentNameSourceIfSegment(span: Span, source: TransactionSource): void { +export function INTERNAL_setSegmentNameSourceIfSegment(span: Span, source: TransactionSource): void { if (spanIsSegment(span)) { span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); } diff --git a/packages/hono/src/shared/middlewareHandlers.ts b/packages/hono/src/shared/middlewareHandlers.ts index e0b6b6c28e54..ffba879603ea 100644 --- a/packages/hono/src/shared/middlewareHandlers.ts +++ b/packages/hono/src/shared/middlewareHandlers.ts @@ -5,7 +5,7 @@ import { getDefaultIsolationScope, getIsolationScope, getRootSpan, - setSegmentNameSourceIfSegment, + INTERNAL_setSegmentNameSourceIfSegment, updateSpanName, type Scope, winterCGRequestToRequestData, @@ -110,7 +110,7 @@ function updateSpanRouteName(isolationScope: Scope, context: Context): void { const rootSpan = getRootSpan(activeSpan); updateSpanName(rootSpan, routeName); - setSegmentNameSourceIfSegment(rootSpan, 'route'); + INTERNAL_setSegmentNameSourceIfSegment(rootSpan, 'route'); rootSpan.setAttribute(HTTP_ROUTE, route); } diff --git a/packages/nextjs/src/common/utils/tracingUtils.ts b/packages/nextjs/src/common/utils/tracingUtils.ts index 4c5de6b17d18..80027f6c021c 100644 --- a/packages/nextjs/src/common/utils/tracingUtils.ts +++ b/packages/nextjs/src/common/utils/tracingUtils.ts @@ -1,7 +1,7 @@ import { HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; import { WEB_SERVER_FUNCTION_SPAN_OP } from '@sentry/conventions/op'; import type { PropagationContext, RawAttributes, Span } from '@sentry/core'; -import { isObjectLike, Scope, setSegmentNameSourceIfSegment } from '@sentry/core'; +import { isObjectLike, Scope, INTERNAL_setSegmentNameSourceIfSegment } from '@sentry/core'; import { ATTR_NEXT_SEGMENT, ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../nextSpanAttributes'; const commonPropagationContextMap = new WeakMap(); @@ -114,5 +114,5 @@ export function maybeEnhanceServerComponentSpanName( }); // Usually a child of the request root span, in which case this no-ops and the root keeps the name // source it got from `handleOnSpanStart` / `enhanceHandleRequestRootSpan`. - setSegmentNameSourceIfSegment(activeSpan, 'route'); + INTERNAL_setSegmentNameSourceIfSegment(activeSpan, 'route'); } From f49fb866a368170bf60b4f6f3358c34abbea1073 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 18:10:25 +0200 Subject: [PATCH 04/13] ref(browser-utils): Import startIdleSpan from @sentry/core/browser The unguarded span API lint rule requires browser-facing code to use the browser entry point so span streaming is installed. Co-Authored-By: Cursor Grok 4.6 --- packages/browser-utils/src/performance/interactions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/browser-utils/src/performance/interactions.ts b/packages/browser-utils/src/performance/interactions.ts index b1af7b432025..77200cae59f2 100644 --- a/packages/browser-utils/src/performance/interactions.ts +++ b/packages/browser-utils/src/performance/interactions.ts @@ -16,8 +16,8 @@ import { getComponentName, getRootSpan, spanToJSON, - startIdleSpan, } from '@sentry/core'; +import { startIdleSpan } from '@sentry/core/browser'; import { DEBUG_BUILD } from '../debug-build'; import { htmlTreeAsString } from '../htmlTreeAsString'; import { addPerformanceInstrumentationHandler } from '../instrumentation/performanceObserver'; From 6c25b525f82f78843548e1c71d395c27f5183995 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 18:13:56 +0200 Subject: [PATCH 05/13] ref(angular): Drop name source on the router child span That span is always started under an active pageload or navigation root, so sentry.segment.name.source was stripped immediately. Co-Authored-By: Cursor Grok 4.6 --- packages/angular/src/tracing.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/angular/src/tracing.ts b/packages/angular/src/tracing.ts index 6fc69ef6a962..7cf83444d2ce 100644 --- a/packages/angular/src/tracing.ts +++ b/packages/angular/src/tracing.ts @@ -147,7 +147,6 @@ export class TraceService implements OnDestroy { // TODO(conventions): Replace `'router'` with the `router` span op constant once it is released in `@sentry/conventions`. [SENTRY_OP]: 'router', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular', - [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: strippedUrl, ...(navigationEvent.navigationTrigger && { navigationTrigger: navigationEvent.navigationTrigger, From 364f1b264f7001007343ebde932cceb209f28e7e Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 13:49:44 +0200 Subject: [PATCH 06/13] test: Update assertions for SENTRY_SEGMENT_NAME_SOURCE Align unit and E2E tests with segment-only sentry.segment.name.source. Fixes #22259 Co-Authored-By: Cursor Grok 4.6 --- .../public-api/beforeSendTransaction/init.js | 2 +- .../public-api/beforeSendTransaction/test.ts | 5 +- .../suites/public-api/startSpan/basic/test.ts | 9 ++-- .../public-api/startSpan/streamed/test.ts | 8 +-- .../navigation-aborting-pageload/test.ts | 6 +-- .../multiple-redirects/test.ts | 6 +-- .../pageload-redirect/test.ts | 6 +-- .../navigation-streamed/test.ts | 11 ++--- .../navigation/test.ts | 10 ++-- .../pageload-streamed/test.ts | 8 +-- .../pageload-update-txn-name/test.ts | 4 +- .../pageload-updateSpanName/test.ts | 4 +- .../pageload/test.ts | 4 +- .../reportPageLoaded-streamed/default/test.ts | 4 +- .../finalTimeout/test.ts | 4 +- .../navigation/test.ts | 4 +- .../reportPageLoaded/default/test.ts | 4 +- .../reportPageLoaded/finalTimeout/test.ts | 4 +- .../reportPageLoaded/navigation/test.ts | 4 +- .../tracing/dsc-txn-name-update/subject.js | 4 +- .../envelope-header-transaction-name/init.js | 4 +- .../suites/tracing/interactions/spans/test.ts | 5 -- .../web-vitals-inp-before-send-span/init.js | 2 +- .../metrics/web-vitals-inp-late/init.js | 2 +- .../metrics/web-vitals-inp-navigate/init.js | 2 +- .../web-vitals-inp-parametrized-late/init.js | 2 +- .../web-vitals-inp-parametrized/init.js | 2 +- .../tracing/metrics/web-vitals-inp/init.js | 2 +- .../fixtures/esbuild/telemetry.test.ts | 2 +- .../fixtures/rolldown/telemetry.test.ts | 2 +- .../fixtures/rollup3/telemetry.test.ts | 2 +- .../fixtures/rollup4/telemetry.test.ts | 2 +- .../fixtures/vite4/telemetry.test.ts | 2 +- .../fixtures/vite7/telemetry.test.ts | 2 +- .../fixtures/vite8/telemetry.test.ts | 2 +- .../fixtures/webpack5/telemetry.test.ts | 2 +- .../public-api/startSpan-streamed/test.ts | 5 +- .../suites/tracing/dsc-url-source/test.ts | 2 +- .../suites/tracing/scheduled/test.ts | 4 +- .../suites/tracing/workflow/test.ts | 6 +-- .../angular-17/tests/performance.test.ts | 14 +++--- .../angular-18/tests/performance.test.ts | 14 +++--- .../angular-19/tests/performance.test.ts | 14 +++--- .../angular-20/tests/performance.test.ts | 14 +++--- .../angular-21/tests/performance.test.ts | 14 +++--- .../angular-22/tests/performance.test.ts | 14 +++--- .../astro-4/tests/tracing.dynamic.test.ts | 18 +++---- .../astro-4/tests/tracing.static.test.ts | 2 +- .../astro-5/tests/tracing.dynamic.test.ts | 18 +++---- .../tests/tracing.serverIslands.test.ts | 4 +- .../astro-5/tests/tracing.static.test.ts | 2 +- .../tests/tracing.dynamic.test.ts | 18 +++---- .../astro-6/tests/tracing.dynamic.test.ts | 18 +++---- .../tests/tracing.serverIslands.test.ts | 4 +- .../astro-6/tests/tracing.static.test.ts | 2 +- .../astro-7/tests/advanced-routing.test.ts | 2 +- .../astro-7/tests/tracing.dynamic.test.ts | 18 +++---- .../tests/tracing.serverIslands.test.ts | 4 +- .../astro-7/tests/tracing.static.test.ts | 2 +- .../aws-serverless-layer/tests/layer.test.ts | 6 +-- .../aws-serverless/tests/npm.test.ts | 4 +- .../cloudflare-mcp/tests/index.test.ts | 2 +- .../tests/client-transactions.test.ts | 6 +-- .../tests/client-transactions.test.ts | 12 ++--- .../tests/server-transactions.test.ts | 10 ++-- .../tests/client-transactions.test.ts | 4 +- .../tests/client-transactions.test.ts | 4 +- .../default-browser/tests/performance.test.ts | 2 +- .../deno-streamed/tests/spans.test.ts | 2 +- .../tests/transactions.test.ts | 2 +- .../tests/transactions.test.ts | 2 +- .../ember-classic/tests/performance.test.ts | 16 ++---- .../ember-embroider/tests/performance.test.ts | 16 ++---- .../tests/sentry-performance.test.ts | 6 --- .../hono-4/tests/route-patterns.test.ts | 8 +-- .../nestjs-11/tests/transactions.test.ts | 2 +- .../nestjs-8/tests/transactions.test.ts | 2 +- .../nestjs-basic/tests/transactions.test.ts | 2 +- .../tests/events.test.ts | 2 +- .../tests/propagation.test.ts | 8 +-- .../nestjs-fastify/tests/transactions.test.ts | 2 +- .../tests/transactions.test.ts | 2 +- .../tests/transactions.test.ts | 2 +- .../tests/parameterized-routes.test.ts | 8 +-- .../routing-basepath-transaction.test.ts | 2 +- .../nextjs-15-intl/tests/i18n-routing.test.ts | 8 +-- .../nextjs-15/tests/i18n-routing.test.ts | 4 +- .../nextjs-15/tests/isr-routes.test.ts | 2 +- .../tests/parameterized-routes.test.ts | 8 +-- .../nextjs-15/tests/server-components.test.ts | 2 +- .../tests/parameterized-routes.test.ts | 8 +-- .../tests/server-components.test.ts | 2 +- .../tests/isr-routes.test.ts | 2 +- .../tests/parameterized-routes.test.ts | 8 +-- .../tests/server-components.test.ts | 2 +- .../tests/parameterized-routes.test.ts | 6 +-- .../trailing-slash-parameterization.test.ts | 10 ++-- .../nextjs-16/tests/isr-routes.test.ts | 2 +- .../nextjs-16/tests/middleware.test.ts | 1 - .../tests/parameterized-routes.test.ts | 8 +-- .../nextjs-16/tests/server-components.test.ts | 2 +- .../tests/server-components.test.ts | 2 +- .../nextjs-app-dir/tests/transactions.test.ts | 2 +- .../nextjs-orpc/tests/orpc-tracing.test.ts | 8 +-- .../tests/transactions.test.ts | 4 +- .../tests/server.test.ts | 2 +- .../tests/spans.test.ts | 2 +- .../tests/transactions.test.ts | 2 +- .../node-express/tests/transactions.test.ts | 2 +- .../node-fastify-3/tests/propagation.test.ts | 8 +-- .../node-fastify-3/tests/transactions.test.ts | 2 +- .../node-fastify-4/tests/propagation.test.ts | 8 +-- .../node-fastify-4/tests/transactions.test.ts | 2 +- .../node-fastify-5/tests/propagation.test.ts | 8 +-- .../node-fastify-5/tests/transactions.test.ts | 2 +- .../node-firebase/tests/functions.test.ts | 8 +-- .../node-hapi/tests/transactions.test.ts | 2 +- .../node-koa/tests/propagation.test.ts | 8 +-- .../node-koa/tests/transactions.test.ts | 2 +- .../tests/tracing.client.test.ts | 2 +- .../nuxt-3-min/tests/tracing.client.test.ts | 2 +- .../tests/tracing.client.test.ts | 2 +- .../nuxt-3/tests/middleware.test.ts | 21 ++++---- .../nuxt-3/tests/tracing.client.test.ts | 2 +- .../nuxt-4/tests/middleware.test.ts | 1 - .../nuxt-4/tests/tracing.client.test.ts | 4 +- .../nuxt-5/tests/middleware.test.ts | 1 - .../nuxt-5/tests/tracing.client.test.ts | 4 +- .../react-17/tests/transactions.test.ts | 4 +- .../tests/transactions.test.ts | 8 +-- .../tests/transactions.test.ts | 4 +- .../tests/transactions.test.ts | 4 +- .../react-router-5/tests/transactions.test.ts | 4 +- .../tests/transactions.test.ts | 24 ++++----- .../tests/transactions.test.ts | 4 +- .../react-router-6/tests/transactions.test.ts | 4 +- .../tests/transactions.test.ts | 12 ++--- .../tests/performance/lazy.server.test.ts | 2 +- .../performance/middleware.server.test.ts | 2 +- .../performance/navigation.client.test.ts | 12 ++--- .../tests/performance/pageload.client.test.ts | 2 +- .../performance/performance.server.test.ts | 4 +- .../performance/navigation.client.test.ts | 2 +- .../tests/performance/pageload.client.test.ts | 4 +- .../performance/navigation.client.test.ts | 8 +-- .../tests/performance/pageload.client.test.ts | 6 +-- .../performance/performance.server.test.ts | 4 +- .../tests/timeout-behaviour.test.ts | 10 ++-- .../tests/transactions.test.ts | 26 +++++----- .../tests/spans.test.ts | 4 +- .../tests/transactions.test.ts | 4 +- .../tests/transactions.test.ts | 12 ++--- .../performance/navigation.client.test.ts | 8 +-- .../tests/performance/pageload.client.test.ts | 6 +-- .../performance/performance.server.test.ts | 4 +- .../tests/transactions.test.ts | 4 +- .../tests/client-transactions.test.ts | 4 +- .../tests/routing-instrumentation.test.ts | 12 ++--- .../tests/performance.client.test.ts | 8 +-- .../tests/performance.server.test.ts | 8 +-- .../tests/performance.client.test.ts | 8 +-- .../tests/performance.server.test.ts | 8 +-- .../tests/performance.client.test.ts | 8 +-- .../tests/performance.server.test.ts | 8 +-- .../tests/performance.client.test.ts | 8 +-- .../tests/performance.server.test.ts | 8 +-- .../tests/performance.client.test.ts | 8 +-- .../tests/performance.server.test.ts | 8 +-- .../tests/tracing.server.test.ts | 1 - .../tests/tracing.test.ts | 6 +-- .../tests/performance.test.ts | 6 +-- .../sveltekit-2/tests/performance.test.ts | 6 +-- .../sveltekit-3/tests/tracing.server.test.ts | 1 - .../sveltekit-3/tests/tracing.test.ts | 6 +-- .../tests/routing-instrumentation.test.ts | 14 +++--- .../tests/transaction.test.ts | 2 - .../tests/transaction.test.ts | 2 - .../tsx-express/tests/transactions.test.ts | 2 +- .../vue-3/tests/performance.test.ts | 29 +++++++++-- .../tests/routing-instrumentation.test.ts | 12 ++--- .../express/tracing/updateName/scenario.mjs | 2 +- .../suites/express/tracing/updateName/test.ts | 7 +-- .../startSpan/basic-usage-streamed/test.ts | 5 +- .../public-api/startSpan/basic-usage/test.ts | 6 +-- .../updateName-method-streamed/scenario.ts | 10 ++-- .../updateName-method-streamed/test.ts | 4 +- .../startSpan/updateName-method/scenario.ts | 10 ++-- .../startSpan/updateName-method/test.ts | 4 +- .../scenario.ts | 10 ++-- .../updateSpanName-function-streamed/test.ts | 4 +- .../updateSpanName-function/scenario.ts | 10 ++-- .../startSpan/updateSpanName-function/test.ts | 4 +- .../dsc-txn-name-update/scenario-events.ts | 24 +++++---- .../dsc-txn-name-update/scenario-headers.ts | 24 +++++---- .../transaction-route/scenario.ts | 3 +- .../transaction-url/scenario.ts | 3 +- .../tracing/httpIntegration-streamed/test.ts | 2 +- .../suites/tracing/httpIntegration/test.ts | 4 +- packages/angular/test/tracing.test.ts | 17 +++---- packages/astro/test/server/middleware.test.ts | 8 +-- .../tracing/browserTracingIntegration.test.ts | 36 +++++++------- .../bun/test/integrations/bunserver.test.ts | 18 +++---- .../worker/instrumentEmail.test.ts | 2 +- .../worker/instrumentQueue.test.ts | 2 +- .../worker/instrumentScheduled.test.ts | 2 +- .../cloudflare/test/opentelemetry.test.ts | 6 +-- packages/cloudflare/test/request.test.ts | 2 +- packages/cloudflare/test/workflow.test.ts | 8 +-- .../http/server-subscription.test.ts | 2 +- .../mcp-server/semanticConventions.test.ts | 20 ++++---- .../transportInstrumentation.test.ts | 6 +-- .../tracing/dynamicSamplingContext.test.ts | 12 ++--- .../core/test/lib/tracing/idleSpan.test.ts | 4 +- .../core/test/lib/tracing/sentrySpan.test.ts | 6 +-- .../lib/tracing/spans/captureSpan.test.ts | 14 +++--- packages/core/test/lib/tracing/trace.test.ts | 39 ++++----------- packages/core/test/lib/trpc.test.ts | 11 ++++- .../core/test/lib/utils/spanUtils.test.ts | 6 +-- packages/core/test/lib/utils/url.test.ts | 40 +++++++++------ packages/deno/test/opentelemetry.test.ts | 6 +-- packages/elysia/test/withElysia.test.ts | 3 +- .../instrument-route-performance.test.ts | 1 - .../test/gcpfunction/cloud_event.test.ts | 18 +++---- .../test/gcpfunction/events.test.ts | 18 +++---- .../test/gcpfunction/http.test.ts | 8 +-- .../common/enhanceMiddlewareRootSpan.test.ts | 6 +-- .../test/common/liveRootSpanAdapter.test.ts | 14 ++---- .../edge/enhanceRunHandlerRootSpan.test.ts | 8 +-- .../pagesRouterInstrumentation.test.ts | 10 ++-- .../enhanceHandleRequestRootSpan.test.ts | 15 ++++-- packages/node/test/integration/scope.test.ts | 2 +- .../test/integration/transactions.test.ts | 21 ++++---- .../hooks/updateRouteBeforeResponse.test.ts | 12 ++--- .../test/integration/scope.test.ts | 2 +- .../test/integration/transactions.test.ts | 18 +++---- packages/opentelemetry/test/trace.test.ts | 33 ++++++------- .../opentelemetry/test/tracerProvider.test.ts | 2 +- .../createClientInstrumentation.test.ts | 20 ++++---- .../test/client/hydratedRouter.test.ts | 22 ++++----- .../react-router/test/client/utils.test.ts | 6 +-- .../createServerInstrumentation.test.ts | 7 ++- .../test/server/getMetaTagTransformer.test.ts | 1 - .../server/wrapSentryHandleRequest.test.ts | 8 ++- .../instrumentation.test.tsx | 28 +++++------ .../test/reactrouter-cross-usage.test.tsx | 23 +++++---- .../reactrouter-descendant-routes.test.tsx | 21 ++++---- packages/react/test/reactrouterv3.test.tsx | 13 +++-- packages/react/test/reactrouterv4.test.tsx | 27 +++++----- packages/react/test/reactrouterv5.test.tsx | 27 +++++----- packages/react/test/reactrouterv6.test.tsx | 49 +++++++++---------- packages/react/test/tanstackrouter.test.ts | 6 +-- .../remix/test/server/tracing-channel.test.ts | 4 +- .../test/ai/lib/tracing/workers-ai.test.ts | 4 +- packages/solid/test/solidrouter.test.tsx | 10 ++-- packages/solid/test/tanstackrouter.test.ts | 8 +-- .../test/client/solidrouter.test.tsx | 10 ++-- .../withServerActionInstrumentation.test.ts | 8 +-- .../client/browserTracingIntegration.test.ts | 12 ++--- packages/sveltekit/test/client/load.test.ts | 13 ++--- .../test/client/svelte5BrowserTracing.test.ts | 10 ++-- .../test/server-common/handle.test.ts | 17 ++----- .../sveltekit/test/server-common/load.test.ts | 15 +++--- .../test/server-common/serverRoute.test.ts | 3 -- packages/vue/test/router.test.ts | 22 ++++----- packages/vue/test/tanstackrouter.test.ts | 16 +++--- 265 files changed, 977 insertions(+), 1085 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/init.js b/dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/init.js index 475c1083d70c..e4206b38e808 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/init.js +++ b/dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/init.js @@ -15,7 +15,7 @@ Sentry.init({ transactionEvent.transaction_info.source = 'route'; transactionEvent.contexts.trace.data = { ...transactionEvent.contexts.trace.data, - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + ['sentry.segment.name.source']: 'route', }; } return transactionEvent; diff --git a/dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/test.ts b/dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/test.ts index e1850495b4ac..f5b5a96608f1 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/beforeSendTransaction/test.ts @@ -1,5 +1,6 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/browser'; + import type { Event } from '@sentry/core'; import { sentryTest } from '../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../utils/helpers'; @@ -26,6 +27,6 @@ sentryTest( expect(eventData.transaction_info?.source).toBe('custom'); // This stays the same but it has no effect on Relay. - expect(eventData.contexts?.trace?.data?.[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('route'); + expect(eventData.contexts?.trace?.data?.[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route'); }, ); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts index 735beba323e9..326c05a787f4 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts @@ -1,9 +1,6 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/browser'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, @@ -26,7 +23,7 @@ sentryTest( expect(attributes).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }); expect(transaction.transaction_info?.source).toBe('custom'); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/test.ts index c056f1846f11..c6c85d89bd02 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 @@ -6,13 +6,13 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE, } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { waitForStreamedSpanEnvelope } from '../../../../utils/spanUtils'; import { + SENTRY_SEGMENT_NAME_SOURCE, SENTRY_SEGMENT_ID, SENTRY_SEGMENT_NAME, SENTRY_SDK_NAME, @@ -255,11 +255,7 @@ sentryTest( type: 'string', value: 'test-span', }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { - type: 'string', - value: 'custom', - }, - 'sentry.segment.name.source': { + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'custom', }, 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..4791b010015b 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../utils/helpers'; @@ -46,14 +46,14 @@ sentryTest( expect(pageloadRequest.contexts?.trace?.data).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_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', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); 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 aa6ce06bee8c..8b512db6a4f9 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 @@ -3,11 +3,10 @@ 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 { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; sentryTest( 'creates a pageload and navigation root spans each with multiple navigation.redirect childspans', @@ -34,7 +33,7 @@ sentryTest( expect(pageloadRequest.contexts?.trace?.data).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'cancelled', }); @@ -57,7 +56,6 @@ sentryTest( data: { 'sentry.op': 'navigation.redirect', 'sentry.origin': 'auto.navigation.browser', - 'sentry.source': 'url', [URL_FULL]: expect.any(String), [URL_PATH]: 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 1b2d8d0b772e..b0d8a061fec8 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 @@ -3,11 +3,10 @@ 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 { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; sentryTest('creates a pageload root span with navigation.redirect childspan', async ({ getLocalTestUrl, page }) => { if (shouldSkipTracingTest()) { @@ -27,7 +26,7 @@ sentryTest('creates a pageload root span with navigation.redirect childspan', as expect(pageloadRequest.contexts?.trace?.data).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); @@ -53,7 +52,6 @@ sentryTest('creates a pageload root span with navigation.redirect childspan', as data: { 'sentry.op': 'navigation.redirect', 'sentry.origin': 'auto.navigation.browser', - 'sentry.source': 'url', [URL_FULL]: 'http://sentry-test.io/sub-page', [URL_PATH]: '/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 0c6ac7b569a0..a8ed2a8ad876 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 @@ -6,9 +6,8 @@ import { 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_SEGMENT_NAME_SOURCE, SENTRY_TRACE_LIFECYCLE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; import { @@ -154,10 +153,6 @@ sentryTest('starts a streamed navigation span on page navigation', async ({ brow type: 'string', value: '/index.html', }, - 'sentry.source': { - type: 'string', - value: 'url', - }, 'sentry.segment.name.source': { type: 'string', value: 'url', @@ -223,7 +218,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page }) type: 'integer', value: 1, }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url', }, @@ -248,7 +243,7 @@ sentryTest('handles pushState with full URL', async ({ getLocalTestUrl, page }) type: 'integer', value: 1, }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url', }, 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..30a457268d45 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,10 +1,10 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } 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, } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { @@ -43,14 +43,14 @@ sentryTest('should create a navigation transaction on page navigation', async ({ expect(pageloadRequest.contexts?.trace?.data).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_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', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); @@ -121,7 +121,7 @@ sentryTest('should handle pushState with full URL', async ({ getLocalTestUrl, pa expect(navigationRequest.contexts?.trace?.data).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); @@ -141,7 +141,7 @@ sentryTest('should handle pushState with full URL', async ({ getLocalTestUrl, pa expect(navigationRequest2.contexts?.trace?.data).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', ['sentry.idle_span_finish_reason']: 'idleTimeout', }); 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 4d56970482be..999bd1697d82 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 @@ -6,9 +6,9 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import { + SENTRY_SEGMENT_NAME_SOURCE, SENTRY_SEGMENT_ID, SENTRY_SEGMENT_NAME, SENTRY_SDK_NAME, @@ -161,11 +161,7 @@ sentryTest( type: 'string', value: 'Pageload', }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { - type: 'string', - value: 'url', - }, - 'sentry.segment.name.source': { + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url', }, 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..401b30e2a5fb 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import { type Event, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -29,7 +29,7 @@ sentryTest( expect(traceContextData).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', }); 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..f6c3282e30c8 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import { type Event, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -27,7 +27,7 @@ sentryTest( expect(traceContextData).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', }); 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..bd02b4799199 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; @@ -28,7 +28,7 @@ sentryTest('creates a pageload transaction with url as source', async ({ getLoca expect(traceContextData).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_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..d19476885c36 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import { SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON } from '@sentry/core'; import { sentryTest } from '../../../../../utils/fixtures'; @@ -28,7 +28,7 @@ sentryTest( expect(pageloadSpan.attributes).toMatchObject({ [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' }, + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url' }, [SEMANTIC_ATTRIBUTE_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..9983809f9947 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../../utils/helpers'; @@ -27,7 +27,7 @@ sentryTest( expect(pageloadSpan.attributes).toMatchObject({ [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' }, + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url' }, [SEMANTIC_ATTRIBUTE_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..e71f12c00993 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../../utils/helpers'; @@ -27,7 +27,7 @@ sentryTest( expect(pageloadSpan.attributes).toMatchObject({ [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' }, + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url' }, [SEMANTIC_ATTRIBUTE_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..ce539cbd6d4b 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; @@ -29,7 +29,7 @@ sentryTest( expect(traceContextData).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_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..90deb74d0f2b 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; @@ -29,7 +29,7 @@ sentryTest( expect(traceContextData).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_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..6b0bf8ceb8b8 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,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect } from '@playwright/test'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/browser'; import { sentryTest } from '../../../../../utils/fixtures'; import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../../utils/helpers'; @@ -29,7 +29,7 @@ sentryTest( expect(traceContextData).toMatchObject({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', ['sentry.idle_span_finish_reason']: 'cancelled', }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/subject.js b/dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/subject.js index 5d353d6bd1e5..96cae2fc66e5 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/subject.js +++ b/dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/subject.js @@ -6,7 +6,7 @@ const btnEndSpan = document.getElementById('btnEndSpan'); btnStartSpan.addEventListener('click', () => { Sentry.startSpanManual( - { name: 'test-root-span', attributes: { [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }, + { name: 'test-root-span', attributes: { ['sentry.segment.name.source']: 'url' } }, async span => { window.__traceId = span.spanContext().traceId; await new Promise(resolve => { @@ -22,7 +22,7 @@ btnUpdateName.addEventListener('click', () => { const span = Sentry.getActiveSpan(); const rootSpan = Sentry.getRootSpan(span); rootSpan.updateName(`updated-root-span-${++updateCnt}`); - rootSpan.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + rootSpan.setAttribute('sentry.segment.name.source', 'route'); }); btnMakeRequest.addEventListener('click', () => { diff --git a/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/init.js b/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/init.js index 5bd698959a78..66fe57da4d6f 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/init.js @@ -1,5 +1,5 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/browser'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/browser'; window.Sentry = Sentry; @@ -18,4 +18,4 @@ Sentry.addEventProcessor(event => { return event; }); -Sentry.getActiveSpan().setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'custom'); +Sentry.getActiveSpan().setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'custom'); diff --git a/dev-packages/browser-integration-tests/suites/tracing/interactions/spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/interactions/spans/test.ts index 20e86dda800f..183210356666 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/interactions/spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/interactions/spans/test.ts @@ -14,7 +14,6 @@ import { SENTRY_SDK_NAME, SENTRY_SDK_VERSION, SENTRY_TRACE_LIFECYCLE, - SENTRY_SOURCE, } from '@sentry/conventions/attributes'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; @@ -102,10 +101,6 @@ sentryTest('captures streamed interaction span tree. @firefox', async ({ browser type: 'string', value: 'Pageload', }, - [SENTRY_SOURCE]: { - type: 'string', - value: 'custom', - }, [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'url', diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-before-send-span/init.js b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-before-send-span/init.js index 5ea3f7b57bf2..5dd891ccc2f8 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-before-send-span/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-before-send-span/init.js @@ -34,6 +34,6 @@ const client = Sentry.getClient(); Sentry.startBrowserTracingPageLoadSpan(client, { name: 'test-url', attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + ['sentry.segment.name.source']: 'url', }, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/init.js b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/init.js index 1a1f0dc0f706..398edbd14fe2 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/init.js @@ -22,6 +22,6 @@ const client = Sentry.getClient(); Sentry.startBrowserTracingPageLoadSpan(client, { name: 'test-url', attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + ['sentry.segment.name.source']: 'url', }, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-navigate/init.js b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-navigate/init.js index 10dcee1b82fc..822c40214adb 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-navigate/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-navigate/init.js @@ -23,6 +23,6 @@ const client = Sentry.getClient(); Sentry.startBrowserTracingPageLoadSpan(client, { name: 'test-url', attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + ['sentry.segment.name.source']: 'url', }, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/init.js b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/init.js index 4b3f055897bd..4745a0f370de 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/init.js @@ -22,6 +22,6 @@ const client = Sentry.getClient(); Sentry.startBrowserTracingPageLoadSpan(client, { name: 'test-route', attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + ['sentry.segment.name.source']: 'route', }, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/init.js b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/init.js index f523edc16b6b..3adb365703b9 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/init.js @@ -23,6 +23,6 @@ const client = Sentry.getClient(); Sentry.startBrowserTracingPageLoadSpan(client, { name: 'test-route', attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + ['sentry.segment.name.source']: 'route', }, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/init.js b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/init.js index c4b2d42bc1b1..44acb2f6c147 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/init.js @@ -24,6 +24,6 @@ const client = Sentry.getClient(); Sentry.startBrowserTracingPageLoadSpan(client, { name: 'test-url', attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + ['sentry.segment.name.source']: 'url', }, }); diff --git a/dev-packages/bundler-plugin-integration-tests/fixtures/esbuild/telemetry.test.ts b/dev-packages/bundler-plugin-integration-tests/fixtures/esbuild/telemetry.test.ts index 82478066cfb5..6395a8728321 100644 --- a/dev-packages/bundler-plugin-integration-tests/fixtures/esbuild/telemetry.test.ts +++ b/dev-packages/bundler-plugin-integration-tests/fixtures/esbuild/telemetry.test.ts @@ -6,7 +6,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { expect(readOutputFiles()).toMatchInlineSnapshot(` { "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], - [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"esbuild","bundler-major-version":"28"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.segment.name.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"esbuild","bundler-major-version":"28"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", "telemetry.js": "(() => { diff --git a/dev-packages/bundler-plugin-integration-tests/fixtures/rolldown/telemetry.test.ts b/dev-packages/bundler-plugin-integration-tests/fixtures/rolldown/telemetry.test.ts index 86813c0d033d..88a82dc3e008 100644 --- a/dev-packages/bundler-plugin-integration-tests/fixtures/rolldown/telemetry.test.ts +++ b/dev-packages/bundler-plugin-integration-tests/fixtures/rolldown/telemetry.test.ts @@ -18,7 +18,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { //#endregion ", "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], - [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"4"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.segment.name.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"4"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } diff --git a/dev-packages/bundler-plugin-integration-tests/fixtures/rollup3/telemetry.test.ts b/dev-packages/bundler-plugin-integration-tests/fixtures/rollup3/telemetry.test.ts index 3ef9ef952ed1..970ebdaefd1d 100644 --- a/dev-packages/bundler-plugin-integration-tests/fixtures/rollup3/telemetry.test.ts +++ b/dev-packages/bundler-plugin-integration-tests/fixtures/rollup3/telemetry.test.ts @@ -9,7 +9,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00000000-0000-0000-0000-000000000000",e._sentryDebugIdIdentifier="sentry-dbid-00000000-0000-0000-0000-000000000000");}catch(e){}}();console.log("hello world"); ", "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], - [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"3"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.segment.name.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"3"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } diff --git a/dev-packages/bundler-plugin-integration-tests/fixtures/rollup4/telemetry.test.ts b/dev-packages/bundler-plugin-integration-tests/fixtures/rollup4/telemetry.test.ts index d084d265cc04..cfb27aee5b5e 100644 --- a/dev-packages/bundler-plugin-integration-tests/fixtures/rollup4/telemetry.test.ts +++ b/dev-packages/bundler-plugin-integration-tests/fixtures/rollup4/telemetry.test.ts @@ -9,7 +9,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00000000-0000-0000-0000-000000000000",e._sentryDebugIdIdentifier="sentry-dbid-00000000-0000-0000-0000-000000000000");}catch(e){}}();console.log("hello world"); ", "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], - [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"4"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.segment.name.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"4"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } diff --git a/dev-packages/bundler-plugin-integration-tests/fixtures/vite4/telemetry.test.ts b/dev-packages/bundler-plugin-integration-tests/fixtures/vite4/telemetry.test.ts index 926704d12c89..6f8d4de0de7a 100644 --- a/dev-packages/bundler-plugin-integration-tests/fixtures/vite4/telemetry.test.ts +++ b/dev-packages/bundler-plugin-integration-tests/fixtures/vite4/telemetry.test.ts @@ -17,7 +17,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { console.log("hello world"); ", "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], - [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"4"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.segment.name.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"4"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } diff --git a/dev-packages/bundler-plugin-integration-tests/fixtures/vite7/telemetry.test.ts b/dev-packages/bundler-plugin-integration-tests/fixtures/vite7/telemetry.test.ts index 2269881b7534..fb6a03910565 100644 --- a/dev-packages/bundler-plugin-integration-tests/fixtures/vite7/telemetry.test.ts +++ b/dev-packages/bundler-plugin-integration-tests/fixtures/vite7/telemetry.test.ts @@ -17,7 +17,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { console.log("hello world"); ", "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], - [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"7"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.segment.name.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"7"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } diff --git a/dev-packages/bundler-plugin-integration-tests/fixtures/vite8/telemetry.test.ts b/dev-packages/bundler-plugin-integration-tests/fixtures/vite8/telemetry.test.ts index 37054076aa14..d5e24152625f 100644 --- a/dev-packages/bundler-plugin-integration-tests/fixtures/vite8/telemetry.test.ts +++ b/dev-packages/bundler-plugin-integration-tests/fixtures/vite8/telemetry.test.ts @@ -18,7 +18,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { //#endregion ", "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], - [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"8"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.segment.name.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"8"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } diff --git a/dev-packages/bundler-plugin-integration-tests/fixtures/webpack5/telemetry.test.ts b/dev-packages/bundler-plugin-integration-tests/fixtures/webpack5/telemetry.test.ts index 2fd634b64054..b26f095092af 100644 --- a/dev-packages/bundler-plugin-integration-tests/fixtures/webpack5/telemetry.test.ts +++ b/dev-packages/bundler-plugin-integration-tests/fixtures/webpack5/telemetry.test.ts @@ -14,7 +14,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { /******/ })() ;", "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], - [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"webpack","bundler-major-version":"5"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","org_id":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true","sample_rand":"SAMPLE_RAND","sample_rate":"1"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.segment.name.source":"custom","sentry.sample_rate":1},"status":"ok","origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"webpack","bundler-major-version":"5"},"user":{},"sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"SDK_VERSION"}]}}]]], [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"SDK_VERSION"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } 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 f4c5334f8ab6..8c6b18c3931d 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 @@ -7,9 +7,9 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import { + SENTRY_SEGMENT_NAME_SOURCE, SENTRY_SDK_NAME, SENTRY_SDK_VERSION, SENTRY_SEGMENT_ID, @@ -199,9 +199,8 @@ it('sends a streamed span envelope with correct spans for a manually started spa [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName }, [SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'http.server' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'route' }, + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'route' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - 'sentry.segment.name.source': { type: 'string', value: 'route' }, 'server.address': { type: 'string', value: 'localhost', diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/dsc-url-source/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/dsc-url-source/test.ts index 9118790e0758..d0bfde77e4cc 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/dsc-url-source/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/dsc-url-source/test.ts @@ -43,7 +43,7 @@ it('omits the span name from the DSC for url-source spans when tracing is enable contexts: expect.objectContaining({ trace: expect.objectContaining({ op: 'http.server', - data: expect.objectContaining({ 'sentry.source': 'url' }), + data: expect.objectContaining({ 'sentry.segment.name.source': 'url' }), }), }), }), 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 32fa1c7eee00..a09128d28fc0 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts @@ -1,9 +1,9 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import type { Event } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, } from '@sentry/core'; import { createRunner } from '../../../runner'; @@ -29,7 +29,7 @@ it('Scheduled handler creates transaction with correct attributes', async ({ sig data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.scheduled', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, 'faas.cron': expect.any(String), 'faas.time': expect.any(String), 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 ca15d818dcd9..1224da14d358 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts @@ -1,8 +1,8 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } 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, } from '@sentry/core'; import { createRunner } from '../../../runner'; @@ -27,7 +27,7 @@ it('Workflow steps create transactions with correct attributes', async ({ signal data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, 'code.function.name': 'step-one', 'workflow.step.name': 'step-one', @@ -56,7 +56,7 @@ it('Workflow steps create transactions with correct attributes', async ({ signal data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, 'code.function.name': 'step-two', 'workflow.step.name': 'step-two', 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 f4094ec9a9cd..015724ff1f73 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 @@ -19,7 +19,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -56,7 +56,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -95,7 +95,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -115,7 +115,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -146,7 +146,7 @@ test('groups redirects within one navigation root span', async ({ page }) => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/456', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/456$/), @@ -183,7 +183,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/cancel', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/cancel$/), // url.template is not set because the navigation was cancelled before Angular fully resolved the route @@ -221,7 +221,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/non-existent', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/non-existent$/), // url.template is not set because the navigation failed before Angular fully resolved the route 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 834f124d2e17..1d53a30dd94a 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 @@ -19,7 +19,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -56,7 +56,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -95,7 +95,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -115,7 +115,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -146,7 +146,7 @@ test('groups redirects within one navigation root span', async ({ page }) => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/456', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/456$/), @@ -183,7 +183,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/cancel', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/cancel$/), // url.template is not set because the navigation was cancelled before Angular fully resolved the route @@ -221,7 +221,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/non-existent', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/non-existent$/), // url.template is not set because the navigation failed before Angular fully resolved the route 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 35a2bf09a45f..7cd070696079 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 @@ -19,7 +19,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -56,7 +56,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -95,7 +95,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -115,7 +115,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -146,7 +146,7 @@ test('groups redirects within one navigation root span', async ({ page }) => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/456', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/456$/), @@ -183,7 +183,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/cancel', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/cancel$/), // url.template is not set because the navigation was cancelled before Angular fully resolved the route @@ -221,7 +221,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/non-existent', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/non-existent$/), // url.template is not set because the navigation failed before Angular fully resolved the route 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 b3c641a8d35a..bf0ced00dcf9 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 @@ -19,7 +19,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -56,7 +56,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -95,7 +95,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -115,7 +115,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -146,7 +146,7 @@ test('groups redirects within one navigation root span', async ({ page }) => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/456', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/456$/), @@ -183,7 +183,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/cancel', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/cancel$/), // url.template is not set because the navigation was cancelled before Angular fully resolved the route @@ -221,7 +221,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/non-existent', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/non-existent$/), // url.template is not set because the navigation failed before Angular fully resolved the route 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 f9b554388e45..0df80bf87252 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 @@ -19,7 +19,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -56,7 +56,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -95,7 +95,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -115,7 +115,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -146,7 +146,7 @@ test('groups redirects within one navigation root span', async ({ page }) => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/456', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/456$/), @@ -183,7 +183,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/cancel', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/cancel$/), // url.template is not set because the navigation was cancelled before Angular fully resolved the route @@ -221,7 +221,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/non-existent', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/non-existent$/), // url.template is not set because the navigation failed before Angular fully resolved the route 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 05c5f2c3f278..9e2a39fa505b 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 @@ -19,7 +19,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -56,7 +56,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -95,7 +95,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.pageload.angular', data: { 'sentry.origin': 'auto.pageload.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/home/', 'url.path': '/home', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/home$/), @@ -115,7 +115,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/123$/), @@ -146,7 +146,7 @@ test('groups redirects within one navigation root span', async ({ page }) => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id/', 'url.path': '/users/456', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/456$/), @@ -183,7 +183,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/cancel', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/cancel$/), // url.template is not set because the navigation was cancelled before Angular fully resolved the route @@ -221,7 +221,7 @@ test.describe('finish routing span', () => { origin: 'auto.navigation.angular', data: { 'sentry.origin': 'auto.navigation.angular', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/non-existent', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/non-existent$/), // url.template is not set because the navigation failed before Angular fully resolved the route diff --git a/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.dynamic.test.ts b/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.dynamic.test.ts index 6c84e505f023..d04bd128dbab 100644 --- a/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.dynamic.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.dynamic.test.ts @@ -31,7 +31,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/test-ssr', 'url.path': '/test-ssr', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-ssr$/), @@ -78,7 +78,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/test-ssr'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -211,7 +211,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -228,7 +228,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/myUsername123'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -265,7 +265,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/api/user/myUsername123.json'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate', @@ -306,7 +306,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -322,7 +322,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/catchAll/hell0/whatever-do'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -363,7 +363,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -379,7 +379,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/settings'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', diff --git a/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.static.test.ts b/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.static.test.ts index f1cfcc78789c..4828f4555eb3 100644 --- a/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.static.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-4/tests/tracing.static.test.ts @@ -36,7 +36,7 @@ test.describe('tracing in static/pre-rendered routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/test-static', 'url.path': '/test-static', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-static$/), diff --git a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts index 26dbcb223683..849c17fb386a 100644 --- a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts @@ -31,7 +31,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/test-ssr', 'url.path': '/test-ssr', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-ssr$/), @@ -79,7 +79,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/test-ssr'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -214,7 +214,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user-page/[userId]', 'url.path': '/user-page/myUsername123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user-page\/myUsername123$/), @@ -234,7 +234,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/myUsername123'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -271,7 +271,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/api/user/myUsername123.json'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate', @@ -312,7 +312,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/catchAll/[...path]', 'url.path': '/catchAll/hell0/whatever-do', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/catchAll\/hell0\/whatever-do$/), @@ -331,7 +331,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/catchAll/hell0/whatever-do'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -372,7 +372,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user-page/settings', 'url.path': '/user-page/settings', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user-page\/settings$/), @@ -391,7 +391,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/settings'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', diff --git a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.serverIslands.test.ts b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.serverIslands.test.ts index 1416a706f971..ca1200df8b78 100644 --- a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.serverIslands.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.serverIslands.test.ts @@ -32,7 +32,7 @@ test.describe('tracing in static routes with server islands', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/server-island', 'url.path': '/server-island', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/server-island$/), @@ -72,7 +72,7 @@ test.describe('tracing in static routes with server islands', () => { data: expect.objectContaining({ 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', 'http.request.header.accept_language': 'en-US', diff --git a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.static.test.ts b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.static.test.ts index 8297dd2b08a5..b6d3bb6e7b50 100644 --- a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.static.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.static.test.ts @@ -36,7 +36,7 @@ test.describe('tracing in static/pre-rendered routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/test-static', 'url.path': '/test-static', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-static$/), diff --git a/dev-packages/e2e-tests/test-applications/astro-6-cf-workers/tests/tracing.dynamic.test.ts b/dev-packages/e2e-tests/test-applications/astro-6-cf-workers/tests/tracing.dynamic.test.ts index 15c456ed42dd..16269a10de0b 100644 --- a/dev-packages/e2e-tests/test-applications/astro-6-cf-workers/tests/tracing.dynamic.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-6-cf-workers/tests/tracing.dynamic.test.ts @@ -31,7 +31,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), op: 'pageload', origin: 'auto.pageload.astro', @@ -73,7 +73,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'br, gzip', 'http.request.header.accept_language': 'en-US', @@ -204,7 +204,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -221,7 +221,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'br, gzip', 'http.request.header.accept_language': 'en-US', @@ -256,7 +256,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.header.accept_encoding': 'br, gzip', }, }, @@ -292,7 +292,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -308,7 +308,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'br, gzip', 'http.request.header.accept_language': 'en-US', @@ -348,7 +348,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -364,7 +364,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'br, gzip', 'http.request.header.accept_language': 'en-US', diff --git a/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.dynamic.test.ts b/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.dynamic.test.ts index a8411e716a27..c5d5547afc76 100644 --- a/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.dynamic.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.dynamic.test.ts @@ -31,7 +31,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/test-ssr', 'url.path': '/test-ssr', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-ssr$/), @@ -79,7 +79,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/test-ssr'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -214,7 +214,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user-page/[userId]', 'url.path': '/user-page/myUsername123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user-page\/myUsername123$/), @@ -234,7 +234,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/myUsername123'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -272,7 +272,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/api/user/myUsername123.json'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate', @@ -313,7 +313,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/catchAll/[...path]', 'url.path': '/catchAll/hell0/whatever-do', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/catchAll\/hell0\/whatever-do$/), @@ -332,7 +332,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/catchAll/hell0/whatever-do'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -373,7 +373,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user-page/settings', 'url.path': '/user-page/settings', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user-page\/settings$/), @@ -392,7 +392,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/settings'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', diff --git a/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.serverIslands.test.ts b/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.serverIslands.test.ts index ce30defcd1fa..e8706f62544b 100644 --- a/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.serverIslands.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.serverIslands.test.ts @@ -32,7 +32,7 @@ test.describe('tracing in static routes with server islands', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/server-island', 'url.path': '/server-island', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/server-island$/), @@ -72,7 +72,7 @@ test.describe('tracing in static routes with server islands', () => { data: expect.objectContaining({ 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', 'http.request.header.accept_language': 'en-US', diff --git a/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.static.test.ts b/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.static.test.ts index 23a54221de50..02b4eaa333bb 100644 --- a/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.static.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-6/tests/tracing.static.test.ts @@ -36,7 +36,7 @@ test.describe('tracing in static/pre-rendered routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/test-static', 'url.path': '/test-static', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-static$/), diff --git a/dev-packages/e2e-tests/test-applications/astro-7/tests/advanced-routing.test.ts b/dev-packages/e2e-tests/test-applications/astro-7/tests/advanced-routing.test.ts index 6f16d9105f51..23ed815005f7 100644 --- a/dev-packages/e2e-tests/test-applications/astro-7/tests/advanced-routing.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-7/tests/advanced-routing.test.ts @@ -36,7 +36,7 @@ test.describe('astro 7 advanced routing (src/fetch.ts)', () => { op: 'http.server', origin: 'auto.http.astro', data: expect.objectContaining({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/myUsername123'), }), }); diff --git a/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.dynamic.test.ts b/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.dynamic.test.ts index 0865b6afe17b..863c844c6fcd 100644 --- a/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.dynamic.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.dynamic.test.ts @@ -31,7 +31,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), op: 'pageload', origin: 'auto.pageload.astro', @@ -76,7 +76,7 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/test-ssr'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -211,7 +211,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -228,7 +228,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/myUsername123'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -266,7 +266,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/api/user/myUsername123.json'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate', @@ -307,7 +307,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -323,7 +323,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/catchAll/hell0/whatever-do'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', @@ -364,7 +364,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -380,7 +380,7 @@ test.describe('parametrized vs static paths', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringContaining('/user-page/settings'), 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', diff --git a/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.serverIslands.test.ts b/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.serverIslands.test.ts index a8ddef968918..7ed40165ea6d 100644 --- a/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.serverIslands.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.serverIslands.test.ts @@ -32,7 +32,7 @@ test.describe('tracing in static routes with server islands', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), op: 'pageload', origin: 'auto.pageload.astro', @@ -69,7 +69,7 @@ test.describe('tracing in static routes with server islands', () => { data: expect.objectContaining({ 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.header.accept': expect.any(String), 'http.request.header.accept_encoding': 'gzip, deflate, br, zstd', 'http.request.header.accept_language': 'en-US', diff --git a/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.static.test.ts b/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.static.test.ts index a11221e03f68..b70f37f3953d 100644 --- a/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.static.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-7/tests/tracing.static.test.ts @@ -36,7 +36,7 @@ test.describe('tracing in static/pre-rendered routes', () => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.astro', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), op: 'pageload', origin: 'auto.pageload.astro', diff --git a/dev-packages/e2e-tests/test-applications/aws-serverless-layer/tests/layer.test.ts b/dev-packages/e2e-tests/test-applications/aws-serverless-layer/tests/layer.test.ts index 783e002f407f..b59043647ddc 100644 --- a/dev-packages/e2e-tests/test-applications/aws-serverless-layer/tests/layer.test.ts +++ b/dev-packages/e2e-tests/test-applications/aws-serverless-layer/tests/layer.test.ts @@ -36,7 +36,7 @@ test.describe('Lambda layer', () => { expect(transactionEvent.contexts?.trace).toEqual({ data: { 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'auto.otel.aws_lambda', 'sentry.op': 'function.aws', 'cloud.account.id': '012345678912', @@ -107,7 +107,7 @@ test.describe('Lambda layer', () => { expect(transactionEvent.contexts?.trace).toEqual({ data: { 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'auto.otel.aws_lambda', 'sentry.op': 'function.aws', 'cloud.account.id': '012345678912', @@ -233,7 +233,7 @@ test.describe('Lambda layer', () => { expect(transactionEvent.contexts?.trace).toEqual({ data: { 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'auto.otel.aws_lambda', 'sentry.op': 'function.aws', 'cloud.account.id': '012345678912', diff --git a/dev-packages/e2e-tests/test-applications/aws-serverless/tests/npm.test.ts b/dev-packages/e2e-tests/test-applications/aws-serverless/tests/npm.test.ts index 159d2c4afb34..cf35053e572f 100644 --- a/dev-packages/e2e-tests/test-applications/aws-serverless/tests/npm.test.ts +++ b/dev-packages/e2e-tests/test-applications/aws-serverless/tests/npm.test.ts @@ -22,7 +22,7 @@ test.describe('NPM package', () => { expect(transactionEvent.contexts?.trace).toEqual({ data: { 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'auto.otel.aws_lambda', 'sentry.op': 'function.aws', 'cloud.account.id': '012345678912', @@ -93,7 +93,7 @@ test.describe('NPM package', () => { expect(transactionEvent.contexts?.trace).toEqual({ data: { 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'auto.otel.aws_lambda', 'sentry.op': 'function.aws', 'cloud.account.id': '012345678912', diff --git a/dev-packages/e2e-tests/test-applications/cloudflare-mcp/tests/index.test.ts b/dev-packages/e2e-tests/test-applications/cloudflare-mcp/tests/index.test.ts index 84236339babf..9c9353833313 100644 --- a/dev-packages/e2e-tests/test-applications/cloudflare-mcp/tests/index.test.ts +++ b/dev-packages/e2e-tests/test-applications/cloudflare-mcp/tests/index.test.ts @@ -84,7 +84,7 @@ test('sends spans for MCP 2026-07-28 tool calls', async ({ baseURL }) => { expect(requestTrace?.status).toBe('ok'); expect(requestTrace?.data?.['sentry.origin']).toBe('auto.http.cloudflare'); expect(requestTrace?.data?.['sentry.op']).toBe('http.server'); - expect(requestTrace?.data?.['sentry.source']).toBe('url'); + expect(requestTrace?.data?.['sentry.segment.name.source']).toBe('url'); expect(requestTrace?.data?.['http.request.method']).toBe('POST'); expect(requestTrace?.data?.['url.path']).toBe('/mcp'); expect(requestTrace?.data?.['url.full']).toBe(url); diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/client-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/client-transactions.test.ts index ff773075f3fb..5082f1a07bdc 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/client-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/client-transactions.test.ts @@ -14,7 +14,7 @@ test('Sends a pageload transaction to Sentry', async ({ page }) => { expect(transactionEvent.contexts?.trace?.data).toEqual( expect.objectContaining({ 'sentry.origin': 'auto.pageload.remix', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), 'url.path': '/', 'url.template': '/', @@ -37,7 +37,7 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => { expect(transactionEvent).toBeDefined(); expect(transactionEvent.contexts?.trace?.data).toEqual( expect.objectContaining({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), 'url.path': '/user/5', 'url.template': '/user/:id', @@ -61,7 +61,7 @@ test('Sends a navigation transaction with parameterized route to Sentry', async expect(transactionEvent.transaction).toBe('/user/:id'); expect(transactionEvent.contexts?.trace?.data).toEqual( expect.objectContaining({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), 'url.path': '/user/5', 'url.template': '/user/:id', diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/client-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/client-transactions.test.ts index 30188a9d4ee8..15ac9f26f1ac 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/client-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/client-transactions.test.ts @@ -14,7 +14,7 @@ test('Sends a pageload transaction to Sentry', async ({ page }) => { expect(transactionEvent.contexts?.trace?.data).toEqual( expect.objectContaining({ 'sentry.origin': 'auto.pageload.remix', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), 'url.path': '/', 'url.template': '/', @@ -37,7 +37,7 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => { expect(transactionEvent).toBeDefined(); expect(transactionEvent.contexts?.trace?.data).toEqual( expect.objectContaining({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), 'url.path': '/user/5', 'url.template': '/user/:id', @@ -145,7 +145,7 @@ test('Pageload transaction is parameterized for a dynamic route', async ({ page const transactionEvent = await transactionPromise; - expect(transactionEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transactionEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Pageload transaction is parameterized for a 2-level nested route', async ({ page }) => { @@ -160,7 +160,7 @@ test('Pageload transaction is parameterized for a 2-level nested route', async ( const transactionEvent = await transactionPromise; - expect(transactionEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transactionEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Pageload transaction is parameterized for a deeply nested route', async ({ page }) => { @@ -175,7 +175,7 @@ test('Pageload transaction is parameterized for a deeply nested route', async ({ const transactionEvent = await transactionPromise; - expect(transactionEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transactionEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Pageload transaction is parameterized for a flat dot-notation route', async ({ page }) => { @@ -190,7 +190,7 @@ test('Pageload transaction is parameterized for a flat dot-notation route', asyn const transactionEvent = await transactionPromise; - expect(transactionEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transactionEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Reports a manually created transaction', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/server-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/server-transactions.test.ts index e6cb514a3c18..9c1ca00e5a32 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/server-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/server-transactions.test.ts @@ -112,7 +112,7 @@ test('Parameterizes a 2-level nested route on the server', async ({ page }) => { const transaction = await transactionPromise; - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(transaction.spans?.some(s => s.data?.['code.function.name'] === 'loader' && s.op === 'function')).toBe(true); }); @@ -125,7 +125,7 @@ test('Parameterizes a 3-level nested API route on the server', async ({ page }) const transaction = await transactionPromise; - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Parameterizes a deeply nested route on the server', async ({ page }) => { @@ -137,7 +137,7 @@ test('Parameterizes a deeply nested route on the server', async ({ page }) => { const transaction = await transactionPromise; - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Parameterizes a flat dot-notation route on the server', async ({ page }) => { @@ -149,7 +149,7 @@ test('Parameterizes a flat dot-notation route on the server', async ({ page }) = const transaction = await transactionPromise; - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Records action and loader spans on a parameterized action route', async ({ request }) => { @@ -192,7 +192,7 @@ test('Records loader spans on a deferred loader response', async ({ page }) => { const transaction = await transactionPromise; - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect( transaction.spans?.some( s => diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2-non-vite/tests/client-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-v2-non-vite/tests/client-transactions.test.ts index 93d47e335600..9e0d55a16fce 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2-non-vite/tests/client-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2-non-vite/tests/client-transactions.test.ts @@ -15,7 +15,7 @@ test('Sends a pageload transaction to Sentry', async ({ page }) => { expect.objectContaining({ // No manifest available (legacy app without the Sentry Vite plugin), so source falls back to 'route' // and url.template uses the route id instead of a parameterized URL path. - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), 'url.path': '/', 'url.template': 'routes/_index', @@ -38,7 +38,7 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => { expect(transactionEvent).toBeDefined(); expect(transactionEvent.contexts?.trace?.data).toEqual( expect.objectContaining({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), 'url.path': '/user/5', 'url.template': 'routes/user.$id', diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/client-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/client-transactions.test.ts index 0f60d08876c6..b84a44128200 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/client-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/client-transactions.test.ts @@ -13,7 +13,7 @@ test('Sends a pageload transaction to Sentry', async ({ page }) => { expect(transactionEvent).toBeDefined(); expect(transactionEvent.contexts?.trace?.data).toEqual( expect.objectContaining({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), 'url.path': '/', 'url.template': '/', @@ -36,7 +36,7 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => { expect(transactionEvent).toBeDefined(); expect(transactionEvent.contexts?.trace?.data).toEqual( expect.objectContaining({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), 'url.path': '/user/5', 'url.template': '/user/:id', diff --git a/dev-packages/e2e-tests/test-applications/default-browser/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/default-browser/tests/performance.test.ts index d73fd0f1dbb7..684005fdd1a6 100644 --- a/dev-packages/e2e-tests/test-applications/default-browser/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/default-browser/tests/performance.test.ts @@ -18,7 +18,7 @@ test('captures a pageload transaction', async ({ page }) => { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.browser', 'sentry.sample_rate': 1, - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.full': 'http://localhost:3030/', 'url.path': '/', }), diff --git a/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts b/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts index cb765ed3f41d..2cc20e2c5f8b 100644 --- a/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts +++ b/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts @@ -115,7 +115,7 @@ const SEGMENT_SPAN = { type: 'string', value: 'GET /test-sentry-span', }, - 'sentry.source': { + 'sentry.segment.name.source': { type: 'string', value: 'url', }, diff --git a/dev-packages/e2e-tests/test-applications/effect-3-browser/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/effect-3-browser/tests/transactions.test.ts index db2a1dc352a8..d2b67c5697ba 100644 --- a/dev-packages/e2e-tests/test-applications/effect-3-browser/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/effect-3-browser/tests/transactions.test.ts @@ -18,7 +18,7 @@ test('captures a pageload transaction', async ({ page }) => { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.browser', 'sentry.sample_rate': 1, - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', }), op: 'pageload', origin: 'auto.pageload.browser', diff --git a/dev-packages/e2e-tests/test-applications/effect-4-browser/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/effect-4-browser/tests/transactions.test.ts index 6bec97ca4d79..23087c719fef 100644 --- a/dev-packages/e2e-tests/test-applications/effect-4-browser/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/effect-4-browser/tests/transactions.test.ts @@ -18,7 +18,7 @@ test('captures a pageload transaction', async ({ page }) => { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.browser', 'sentry.sample_rate': 1, - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', }), op: 'pageload', origin: 'auto.pageload.browser', diff --git a/dev-packages/e2e-tests/test-applications/ember-classic/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/ember-classic/tests/performance.test.ts index ae1e00c3ffe4..141eb8cec968 100644 --- a/dev-packages/e2e-tests/test-applications/ember-classic/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/ember-classic/tests/performance.test.ts @@ -17,7 +17,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = origin: 'auto.pageload.ember', data: { 'sentry.origin': 'auto.pageload.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -52,7 +52,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) origin: 'auto.navigation.ember', data: { 'sentry.origin': 'auto.navigation.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/tracing', 'url.path': '/tracing', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/tracing$/), @@ -91,7 +91,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.pageload.ember', data: { 'sentry.origin': 'auto.pageload.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -111,7 +111,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.navigation.ember', data: { 'sentry.origin': 'auto.navigation.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/tracing', 'url.path': '/tracing', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/tracing$/), @@ -154,7 +154,7 @@ test('captures correct spans for navigation', async ({ page }) => { origin: 'auto.navigation.ember', data: { 'sentry.origin': 'auto.navigation.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/slow-loading-route', 'url.path': '/slow-loading-route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/slow-loading-route$/), @@ -209,7 +209,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'beforeModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -226,7 +225,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'beforeModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', @@ -246,7 +244,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'model', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -263,7 +260,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'model', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', @@ -283,7 +279,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'afterModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -300,7 +295,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'afterModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', diff --git a/dev-packages/e2e-tests/test-applications/ember-embroider/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/ember-embroider/tests/performance.test.ts index 45f5345e8003..4043b52dc04b 100644 --- a/dev-packages/e2e-tests/test-applications/ember-embroider/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/ember-embroider/tests/performance.test.ts @@ -17,7 +17,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = origin: 'auto.pageload.ember', data: { 'sentry.origin': 'auto.pageload.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -52,7 +52,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) origin: 'auto.navigation.ember', data: { 'sentry.origin': 'auto.navigation.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/tracing', 'url.path': '/tracing', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/tracing$/), @@ -91,7 +91,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.pageload.ember', data: { 'sentry.origin': 'auto.pageload.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -111,7 +111,7 @@ test('sends a navigation transaction even if the pageload span is still active', origin: 'auto.navigation.ember', data: { 'sentry.origin': 'auto.navigation.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/tracing', 'url.path': '/tracing', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/tracing$/), @@ -154,7 +154,7 @@ test('captures correct spans for navigation', async ({ page }) => { origin: 'auto.navigation.ember', data: { 'sentry.origin': 'auto.navigation.ember', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/slow-loading-route', 'url.path': '/slow-loading-route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/slow-loading-route$/), @@ -209,7 +209,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'beforeModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -226,7 +225,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'beforeModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', @@ -246,7 +244,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'model', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -263,7 +260,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'model', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', @@ -283,7 +279,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'afterModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -300,7 +295,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'afterModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', diff --git a/dev-packages/e2e-tests/test-applications/ember-strict-resolver/tests/sentry-performance.test.ts b/dev-packages/e2e-tests/test-applications/ember-strict-resolver/tests/sentry-performance.test.ts index a917bb72c3b0..7122e07a7746 100644 --- a/dev-packages/e2e-tests/test-applications/ember-strict-resolver/tests/sentry-performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/ember-strict-resolver/tests/sentry-performance.test.ts @@ -177,7 +177,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'beforeModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -194,7 +193,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'beforeModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', @@ -214,7 +212,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'model', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -231,7 +228,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'model', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', @@ -251,7 +247,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'afterModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route', op: 'function', @@ -268,7 +263,6 @@ test('captures correct spans for navigation', async ({ page }) => { 'code.function.name': 'afterModel', 'sentry.op': 'function', 'sentry.origin': 'auto.ui.ember', - 'sentry.source': 'custom', }, description: 'slow-loading-route.index', op: 'function', diff --git a/dev-packages/e2e-tests/test-applications/hono-4/tests/route-patterns.test.ts b/dev-packages/e2e-tests/test-applications/hono-4/tests/route-patterns.test.ts index 6bb9b81b4d74..58a661d3c7bc 100644 --- a/dev-packages/e2e-tests/test-applications/hono-4/tests/route-patterns.test.ts +++ b/dev-packages/e2e-tests/test-applications/hono-4/tests/route-patterns.test.ts @@ -23,7 +23,7 @@ test.describe('HTTP methods', () => { const transaction = await transactionPromise; expect(transaction.transaction).toBe(`${method} ${PREFIX}`); expect(transaction.contexts?.trace?.op).toBe('http.server'); - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); const spans = transaction.spans || []; const middlewareSpans = spans.filter(s => s.op === 'middleware'); @@ -45,7 +45,7 @@ test.describe('route registration styles', () => { const transaction = await transactionPromise; expect(transaction.transaction).toBe(`GET ${PREFIX}${path}`); expect(transaction.contexts?.trace?.op).toBe('http.server'); - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); const spans = transaction.spans || []; const middlewareSpans = spans.filter(s => s.op === 'middleware'); @@ -67,7 +67,7 @@ test.describe('route registration styles', () => { const transaction = await transactionPromise; expect(transaction.transaction).toBe(`POST ${PREFIX}${path}`); - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); const spans = transaction.spans || []; const middlewareSpans = spans.filter(s => s.op === 'middleware'); @@ -139,7 +139,7 @@ test('async handler sends transaction', async ({ baseURL }) => { const transaction = await transactionPromise; expect(transaction.transaction).toBe(`GET ${PREFIX}/async`); expect(transaction.contexts?.trace?.op).toBe('http.server'); - expect(transaction.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(transaction.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); const spans = transaction.spans || []; const middlewareSpans = spans.filter(s => s.op === 'middleware'); diff --git a/dev-packages/e2e-tests/test-applications/nestjs-11/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-11/tests/transactions.test.ts index d1e96aa3250e..17f40deee68b 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-11/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-11/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/nestjs-8/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-8/tests/transactions.test.ts index fe325e4408fb..767f5ca19489 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-8/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-8/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/transactions.test.ts index bce6acc1589a..3e5181de5e02 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/transactions.test.ts @@ -41,7 +41,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/events.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/events.test.ts index 5be068b5b037..419683ee25ad 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/events.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/events.test.ts @@ -34,7 +34,7 @@ test('Event emitter', async () => { span_id: expect.stringMatching(/[a-f0-9]{16}/), trace_id: expect.stringMatching(/[a-f0-9]{32}/), data: { - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.op': 'function', 'sentry.origin': 'auto.event.nestjs', }, diff --git a/dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/propagation.test.ts index aae5014d3366..2b90081054b0 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-distributed-tracing/tests/propagation.test.ts @@ -56,7 +56,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -101,7 +101,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', @@ -195,7 +195,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -240,7 +240,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: expect.objectContaining({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', diff --git a/dev-packages/e2e-tests/test-applications/nestjs-fastify/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-fastify/tests/transactions.test.ts index b2e6183942b6..fa104ba07382 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-fastify/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-fastify/tests/transactions.test.ts @@ -20,7 +20,7 @@ test.skip('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/nestjs-with-submodules-decorator/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-with-submodules-decorator/tests/transactions.test.ts index 63acafb5f5c7..67c06d9b1c85 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-with-submodules-decorator/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-with-submodules-decorator/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction from module', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/tests/transactions.test.ts index 6027586c497f..abde21c17f67 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-with-submodules/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction from module', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/tests/parameterized-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-14/tests/parameterized-routes.test.ts index f674e9f7279d..ce2ae23c075e 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/tests/parameterized-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/tests/parameterized-routes.test.ts @@ -19,7 +19,7 @@ test('should create a parameterized transaction when the `app` directory is used data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino$/), 'url.path': '/parameterized/cappuccino', 'url.template': '/parameterized/:one', @@ -61,7 +61,7 @@ test('should create a transaction named after the static route when the `app` di data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/static$/), 'url.path': '/parameterized/static', 'url.template': '/parameterized/static', @@ -103,7 +103,7 @@ test('should create a partially parameterized transaction when the `app` directo data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep$/), 'url.path': '/parameterized/cappuccino/beep', 'url.template': '/parameterized/:one/beep', @@ -146,7 +146,7 @@ test('should create a nested parameterized transaction when the `app` directory data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep\/espresso$/), 'url.path': '/parameterized/cappuccino/beep/espresso', 'url.template': '/parameterized/:one/beep/:two', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-basepath/tests/routing-basepath-transaction.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15-basepath/tests/routing-basepath-transaction.test.ts index 827b50927947..2ba15d2d6903 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-basepath/tests/routing-basepath-transaction.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-basepath/tests/routing-basepath-transaction.test.ts @@ -61,7 +61,7 @@ test('Creates a navigation transaction for basePath router with prefix', async ( expect(attributes).toMatchObject({ 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/my-app\/navigation\/42\/router-push$/), 'url.path': '/my-app/navigation/42/router-push', 'url.template': '/my-app/navigation/:param/router-push', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15-intl/tests/i18n-routing.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15-intl/tests/i18n-routing.test.ts index 0943df8c7216..60d535471180 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15-intl/tests/i18n-routing.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15-intl/tests/i18n-routing.test.ts @@ -16,7 +16,7 @@ test('should create consistent parameterized transaction for default locale with contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -38,7 +38,7 @@ test('should create consistent parameterized transaction for non-default locale contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -60,7 +60,7 @@ test('should parameterize locale root page correctly for default locale without contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, @@ -82,7 +82,7 @@ test('should parameterize locale root page correctly for non-default locale with contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/i18n-routing.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/i18n-routing.test.ts index fda0645fa1a3..57db1e528845 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/i18n-routing.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/i18n-routing.test.ts @@ -16,7 +16,7 @@ test('should create consistent parameterized transaction for i18n routes - local data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', @@ -43,7 +43,7 @@ test('should create consistent parameterized transaction for i18n routes - local data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/isr-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/isr-routes.test.ts index 215f6cbb0bfc..7b4731bb8393 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/isr-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/isr-routes.test.ts @@ -86,7 +86,7 @@ test('ISR route should be identified correctly in the route manifest', async ({ contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/parameterized-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/parameterized-routes.test.ts index ecaeb9747ddd..e6da9120878e 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/parameterized-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/parameterized-routes.test.ts @@ -19,7 +19,7 @@ test('should create a parameterized transaction when the `app` directory is used data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino$/), 'url.path': '/parameterized/cappuccino', 'url.template': '/parameterized/:one', @@ -61,7 +61,7 @@ test('should create a transaction named after the static route when the `app` di data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/static$/), 'url.path': '/parameterized/static', 'url.template': '/parameterized/static', @@ -103,7 +103,7 @@ test('should create a partially parameterized transaction when the `app` directo data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep$/), 'url.path': '/parameterized/cappuccino/beep', 'url.template': '/parameterized/:one/beep', @@ -146,7 +146,7 @@ test('should create a nested parameterized transaction when the `app` directory data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep\/espresso$/), 'url.path': '/parameterized/cappuccino/beep/espresso', 'url.template': '/parameterized/:one/beep/:two', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/server-components.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/server-components.test.ts index 1cc750a213e3..3415e6705be9 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/server-components.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/server-components.test.ts @@ -18,7 +18,7 @@ test('Sends a transaction for a request to app router with URL', async ({ page } 'sentry.op': 'http.server', 'sentry.origin': 'auto', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.method': 'GET', 'http.response.status_code': 200, 'http.route': '/parameterized/[one]/beep/[two]', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16-bun/tests/parameterized-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16-bun/tests/parameterized-routes.test.ts index 98ac069d5b3f..8d709a6534ed 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16-bun/tests/parameterized-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16-bun/tests/parameterized-routes.test.ts @@ -19,7 +19,7 @@ test('should create a parameterized transaction when the `app` directory is used data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', @@ -58,7 +58,7 @@ test('should create a transaction named after the static route when the `app` di data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/parameterized/static', }, op: 'pageload', @@ -98,7 +98,7 @@ test('should create a partially parameterized transaction when the `app` directo data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', @@ -138,7 +138,7 @@ test('should create a nested parameterized transaction when the `app` directory data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16-bun/tests/server-components.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16-bun/tests/server-components.test.ts index b5d88321b72f..5d1c580bc601 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16-bun/tests/server-components.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16-bun/tests/server-components.test.ts @@ -18,7 +18,7 @@ test('Sends a transaction for a request to app router with URL', async ({ page } 'sentry.op': 'http.server', 'sentry.origin': 'auto', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.method': 'GET', 'http.response.status_code': 200, 'http.route': '/parameterized/[one]/beep/[two]', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/isr-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/isr-routes.test.ts index b42d2cd61b93..74acbc681ace 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/isr-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/isr-routes.test.ts @@ -86,7 +86,7 @@ test('ISR route should be identified correctly in the route manifest', async ({ contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/parameterized-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/parameterized-routes.test.ts index 7f903d044ee2..a653b7201629 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/parameterized-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/parameterized-routes.test.ts @@ -19,7 +19,7 @@ test('should create a parameterized transaction when the `app` directory is used data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', @@ -58,7 +58,7 @@ test('should create a transaction named after the static route when the `app` di data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/parameterized/static', }, op: 'pageload', @@ -98,7 +98,7 @@ test('should create a partially parameterized transaction when the `app` directo data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', @@ -138,7 +138,7 @@ test('should create a nested parameterized transaction when the `app` directory data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/server-components.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/server-components.test.ts index 4aaebac51337..69b83669a630 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/server-components.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16-cf-workers/tests/server-components.test.ts @@ -19,7 +19,7 @@ test.skip('Sends a transaction for a request to app router with URL', async ({ p 'sentry.op': 'http.server', 'sentry.origin': 'auto', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.method': 'GET', 'http.response.status_code': 200, 'http.route': '/parameterized/[one]/beep/[two]', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16-streaming/tests/parameterized-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16-streaming/tests/parameterized-routes.test.ts index f7951bc3a355..d6c650ddfe1b 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16-streaming/tests/parameterized-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16-streaming/tests/parameterized-routes.test.ts @@ -12,7 +12,7 @@ test('should create a parameterized streamed span when the `app` directory is us expect(span.name).toBe('/parameterized/:one'); expect(span.trace_id).toMatch(/[a-f0-9]{32}/); - expect(span.attributes['sentry.source']?.value).toBe('route'); + expect(span.attributes['sentry.segment.name.source']?.value).toBe('route'); }); test('should create a streamed span named after the static route when the `app` directory is used', async ({ @@ -63,7 +63,7 @@ test('should create a partially parameterized streamed span when the `app` direc expect(span.name).toBe('/parameterized/:one/beep'); expect(span.trace_id).toMatch(/[a-f0-9]{32}/); - expect(span.attributes['sentry.source']?.value).toBe('route'); + expect(span.attributes['sentry.segment.name.source']?.value).toBe('route'); }); test('should create a nested parameterized streamed span when the `app` directory is used.', async ({ page }) => { @@ -77,5 +77,5 @@ test('should create a nested parameterized streamed span when the `app` director expect(span.name).toBe('/parameterized/:one/beep/:two'); expect(span.trace_id).toMatch(/[a-f0-9]{32}/); - expect(span.attributes['sentry.source']?.value).toBe('route'); + expect(span.attributes['sentry.segment.name.source']?.value).toBe('route'); }); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16-trailing-slash/tests/trailing-slash-parameterization.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16-trailing-slash/tests/trailing-slash-parameterization.test.ts index cb0c6e76f7e5..a3532c8d08fa 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16-trailing-slash/tests/trailing-slash-parameterization.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16-trailing-slash/tests/trailing-slash-parameterization.test.ts @@ -20,7 +20,7 @@ test('should create a correctly named pageload transaction for a static route', data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/static-page', }, op: 'pageload', @@ -50,7 +50,7 @@ test('should create a correctly named pageload transaction for a parameterized r data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', @@ -81,7 +81,7 @@ test('should create a correctly named pageload transaction for a static nested r data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/parameterized/static', }, op: 'pageload', @@ -109,7 +109,7 @@ test('should create a correctly named pageload transaction for the catch-all rou data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', @@ -136,7 +136,7 @@ test('should create a correctly named pageload transaction for the home page', a data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', }, op: 'pageload', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16/tests/isr-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16/tests/isr-routes.test.ts index 541cff9c064c..94d5863c9360 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16/tests/isr-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16/tests/isr-routes.test.ts @@ -86,7 +86,7 @@ test('ISR route should be identified correctly in the route manifest', async ({ contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, }, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16/tests/middleware.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16/tests/middleware.test.ts index 5711288d1422..964e913679f0 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16/tests/middleware.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16/tests/middleware.test.ts @@ -124,7 +124,6 @@ test('Should trace outgoing fetch requests inside middleware and create breadcru 'network.peer.port': 3030, 'sentry.kind': 'client', 'sentry.op': 'http.client', - 'sentry.source': 'url', 'sentry.origin': 'auto.http.otel.node_fetch', 'server.address': 'localhost', 'server.port': 3030, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16/tests/parameterized-routes.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16/tests/parameterized-routes.test.ts index afaf6c2a5601..a7ec71c894a4 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16/tests/parameterized-routes.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16/tests/parameterized-routes.test.ts @@ -19,7 +19,7 @@ test('should create a parameterized transaction when the `app` directory is used data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino$/), 'url.path': '/parameterized/cappuccino', 'url.template': '/parameterized/:one', @@ -61,7 +61,7 @@ test('should create a transaction named after the static route when the `app` di data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/static$/), 'url.path': '/parameterized/static', 'url.template': '/parameterized/static', @@ -103,7 +103,7 @@ test('should create a partially parameterized transaction when the `app` directo data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep$/), 'url.path': '/parameterized/cappuccino/beep', 'url.template': '/parameterized/:one/beep', @@ -146,7 +146,7 @@ test('should create a nested parameterized transaction when the `app` directory data: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep\/espresso$/), 'url.path': '/parameterized/cappuccino/beep/espresso', 'url.template': '/parameterized/:one/beep/:two', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-16/tests/server-components.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-16/tests/server-components.test.ts index da72685789c7..22cc59acd9d9 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-16/tests/server-components.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-16/tests/server-components.test.ts @@ -21,7 +21,7 @@ test('Sends a transaction for a request to app router with URL', async ({ page } 'sentry.op': 'http.server', 'sentry.origin': 'auto', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.method': 'GET', 'http.response.status_code': 200, 'http.route': '/parameterized/[one]/beep/[two]', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts index f30fc3de97d6..b2992a903d4d 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts @@ -18,7 +18,7 @@ test('Sends a transaction for a request to app router', async ({ page }) => { 'sentry.op': 'http.server', 'sentry.origin': 'auto', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.method': 'GET', 'http.response.status_code': 200, 'http.route': '/server-component/parameter/[...parameters]', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts index 8d89217eb395..769ef75ffb55 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts @@ -37,7 +37,7 @@ test('Sends a pageload transaction', async ({ page }) => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), 'url.path': '/', 'url.template': '/', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-tracing.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-tracing.test.ts index caceeb523a55..a77e2d5fb846 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-tracing.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-orpc/tests/orpc-tracing.test.ts @@ -21,7 +21,7 @@ test('should trace orpc server component', async ({ page }) => { data: { 'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'pageload', origin: 'auto.pageload.nextjs.app_router_instrumentation', @@ -34,7 +34,7 @@ test('should trace orpc server component', async ({ page }) => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.kind': 'server', 'http.response.status_code': 200, 'next.span_name': 'POST /rpc/[[...rest]]/route', @@ -77,7 +77,7 @@ test('should trace orpc client component', async ({ page }) => { data: { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.nextjs.app_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.previous_trace': expect.any(String), }, op: 'navigation', @@ -91,7 +91,7 @@ test('should trace orpc client component', async ({ page }) => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.kind': 'server', 'http.response.status_code': 200, 'next.span_name': 'POST /rpc/[[...rest]]/route', diff --git a/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/transactions.test.ts index 34c0afbb9110..6e507903ed26 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/transactions.test.ts @@ -37,7 +37,7 @@ test('Sends a pageload transaction', async ({ page }) => { data: expect.objectContaining({ 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), 'url.path': '/', 'url.template': '/', @@ -88,7 +88,7 @@ test('Sends a navigation transaction', async ({ page }) => { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.nextjs.pages_router_instrumentation', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), 'url.path': '/user/5', 'url.template': '/user/[id]', diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts index f3fb420bdf00..82425467ec4c 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts @@ -55,7 +55,7 @@ test('Should record a transaction for route with parameters', async ({ request } 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.otel.http', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), ); diff --git a/dev-packages/e2e-tests/test-applications/node-express-streaming/tests/spans.test.ts b/dev-packages/e2e-tests/test-applications/node-express-streaming/tests/spans.test.ts index 6632f1bff0f8..bb48067a21dd 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-streaming/tests/spans.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express-streaming/tests/spans.test.ts @@ -18,7 +18,7 @@ test('Sends streamed spans for an API route', async ({ baseURL }) => { expect(getSpanOp(rootSpan!)).toBe('http.server'); expect(rootSpan!.status).toBe('ok'); expect(rootSpan!.trace_id).toMatch(/[a-f0-9]{32}/); - expect(rootSpan!.attributes['sentry.source']?.value).toBe('route'); + expect(rootSpan!.attributes['sentry.segment.name.source']?.value).toBe('route'); expect(rootSpan!.attributes['sentry.origin']?.value).toBe('auto.http.otel.http'); expect(rootSpan!.attributes['http.response.status_code']?.value).toBe(200); diff --git a/dev-packages/e2e-tests/test-applications/node-express-v5/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-express-v5/tests/transactions.test.ts index 092667f79a4b..39d15fdea7d4 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-v5/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express-v5/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/node-express/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-express/tests/transactions.test.ts index 231e64954da4..f29afd0c3513 100644 --- a/dev-packages/e2e-tests/test-applications/node-express/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/node-fastify-3/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify-3/tests/propagation.test.ts index 34dc29cb8b6d..364622eb8f11 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify-3/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify-3/tests/propagation.test.ts @@ -56,7 +56,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -101,7 +101,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', @@ -195,7 +195,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -240,7 +240,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', diff --git a/dev-packages/e2e-tests/test-applications/node-fastify-3/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify-3/tests/transactions.test.ts index 9fb13b3e6973..c84893b3a860 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify-3/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify-3/tests/transactions.test.ts @@ -20,7 +20,7 @@ test.skip('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/node-fastify-4/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify-4/tests/propagation.test.ts index 8ee2382eab61..b322e7be7a96 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify-4/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify-4/tests/propagation.test.ts @@ -56,7 +56,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -101,7 +101,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', @@ -195,7 +195,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -240,7 +240,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', diff --git a/dev-packages/e2e-tests/test-applications/node-fastify-4/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify-4/tests/transactions.test.ts index 4156910cd152..1a54d84796c9 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify-4/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify-4/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/node-fastify-5/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify-5/tests/propagation.test.ts index fb5dab4a0dcb..315c069a6938 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify-5/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify-5/tests/propagation.test.ts @@ -56,7 +56,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -101,7 +101,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', @@ -195,7 +195,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -240,7 +240,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', diff --git a/dev-packages/e2e-tests/test-applications/node-fastify-5/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify-5/tests/transactions.test.ts index 37243a793771..113a9430627a 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify-5/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify-5/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/node-firebase/tests/functions.test.ts b/dev-packages/e2e-tests/test-applications/node-firebase/tests/functions.test.ts index ac9a520119df..a250d80bdb31 100644 --- a/dev-packages/e2e-tests/test-applications/node-firebase/tests/functions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-firebase/tests/functions.test.ts @@ -27,7 +27,7 @@ test.fixme('should only call the function once without any extra calls', async ( 'sentry.op': 'http.request', 'sentry.origin': 'auto.firebase.functions', 'sentry.sample_rate': expect.any(Number), - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.request', origin: 'auto.firebase.functions', @@ -104,7 +104,7 @@ test.fixme('should create a document and trigger onDocumentCreated and another w 'sentry.op': 'http.request', 'sentry.origin': 'auto.firebase.functions', 'sentry.sample_rate': expect.any(Number), - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.request', origin: 'auto.firebase.functions', @@ -123,7 +123,7 @@ test.fixme('should create a document and trigger onDocumentCreated and another w 'sentry.op': expect.any(String), 'sentry.origin': 'auto.firebase.functions', 'sentry.sample_rate': expect.any(Number), - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: expect.any(String), origin: 'auto.firebase.functions', @@ -142,7 +142,7 @@ test.fixme('should create a document and trigger onDocumentCreated and another w 'sentry.op': expect.any(String), 'sentry.origin': 'auto.firebase.functions', 'sentry.sample_rate': expect.any(Number), - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: expect.any(String), origin: 'auto.firebase.functions', diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts index 8eea53d68454..048d0987daae 100644 --- a/dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts @@ -14,7 +14,7 @@ test('Sends successful transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts index fe65fde61d4c..a0ca50024d5c 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts @@ -55,7 +55,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -100,7 +100,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', @@ -194,7 +194,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(outboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, @@ -239,7 +239,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { expect(inboundTransaction.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.kind': 'server', diff --git a/dev-packages/e2e-tests/test-applications/node-koa/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-koa/tests/transactions.test.ts index c32dd76dbbfe..57523b480fb6 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-koa/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.client.test.ts index ddbad70d31cc..9c0b8232b823 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) => contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'params.param': '1234', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.client.test.ts index 2906aec8c032..3ec93344c3e1 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.client.test.ts @@ -16,7 +16,7 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) => contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'params.param': '1234', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.client.test.ts index 62be945c4c02..bc5b2de99c5a 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) => contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'params.param': '1234', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/middleware.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/middleware.test.ts index 0ebd88e2ed18..d28984152184 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/middleware.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/middleware.test.ts @@ -45,7 +45,6 @@ test.describe('Server Middleware Instrumentation', () => { data: expect.objectContaining({ 'sentry.op': 'middleware', 'sentry.origin': 'auto.middleware.nuxt', - 'sentry.source': 'custom', 'http.request.method': 'GET', 'http.route': '/api/middleware-test', }), @@ -114,21 +113,21 @@ test.describe('Server Middleware Instrumentation', () => { // Verify the error event is associated with the correct transaction expect(errorEvent.transaction).toContain('GET /api/middleware-test'); - // Verify the error has the correct mechanism - expect(errorEvent.exception?.values?.[0]).toEqual( + const exception = errorEvent.exception?.values?.[0]; + expect(exception).toEqual( expect.objectContaining({ value: 'Auth middleware error', type: 'Error', - mechanism: expect.objectContaining({ - handled: false, - // Type changes depending on whether it is being wrapped by Nitro or not - // This is a timing problem, sometimes Nitro can capture the error first, and sometimes it can't - // If nitro captures the error first, the type will be 'chained' - // If Sentry captures the error first, the type will be 'auto.middleware.nuxt' - type: expect.stringMatching(/^(auto\.middleware\.nuxt|chained)$/), - }), }), ); + + // Type and handled change depending on whether Nitro wraps the error before Sentry sees it. + expect(exception?.mechanism?.type).toMatch(/^(auto\.middleware\.nuxt|chained)$/); + if (exception?.mechanism?.type === 'chained') { + expect(exception?.mechanism?.handled).toBe(true); + } else { + expect(exception?.mechanism?.handled).toBe(false); + } }); test('should create spans for onRequest and onBeforeResponse hooks', async ({ request }) => { diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.client.test.ts index 92289c2e936b..13994172dc32 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) => contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'params.param': '1234', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/middleware.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/middleware.test.ts index b24775e8db63..05188318e755 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/middleware.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/middleware.test.ts @@ -45,7 +45,6 @@ test.describe('Server Middleware Instrumentation', () => { data: expect.objectContaining({ 'sentry.op': 'middleware', 'sentry.origin': 'auto.middleware.nuxt', - 'sentry.source': 'custom', 'http.request.method': 'GET', 'http.route': '/api/middleware-test', }), diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.client.test.ts index d8c7966ed408..dce04b2f84b7 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) => contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'params.param': '1234', @@ -50,7 +50,7 @@ test('sends a navigation root span with a parameterized URL', async ({ page }) = contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.vue', 'sentry.op': 'navigation', 'params.param': '1234', diff --git a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/middleware.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/middleware.test.ts index ff4cdf76157b..2e2fb686a619 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/middleware.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/middleware.test.ts @@ -46,7 +46,6 @@ test.describe('Server Middleware Instrumentation', () => { data: expect.objectContaining({ 'sentry.op': 'middleware', 'sentry.origin': 'auto.middleware.nuxt', - 'sentry.source': 'custom', 'http.request.method': 'GET', 'http.route': '/api/middleware-test', }), diff --git a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.client.test.ts index 650d63731ab2..99e701fd25bc 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload root span with a parameterized URL', async ({ page }) => contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'params.param': '1234', @@ -50,7 +50,7 @@ test('sends a navigation root span with a parameterized URL', async ({ page }) = contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.vue', 'sentry.op': 'navigation', 'params.param': '1234', diff --git a/dev-packages/e2e-tests/test-applications/react-17/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-17/tests/transactions.test.ts index 752caf618f0b..2f0d922ea53b 100644 --- a/dev-packages/e2e-tests/test-applications/react-17/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-17/tests/transactions.test.ts @@ -16,7 +16,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -53,7 +53,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/user/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), diff --git a/dev-packages/e2e-tests/test-applications/react-create-browser-router/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-create-browser-router/tests/transactions.test.ts index e31cba74ecec..79737d920682 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-browser-router/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-create-browser-router/tests/transactions.test.ts @@ -30,7 +30,7 @@ test('Captures a pageload transaction', async ({ page }) => { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.react.reactrouter_v6', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -60,7 +60,7 @@ test('Captures a navigation transaction', async ({ page }) => { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react.reactrouter_v6', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/user/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), @@ -111,7 +111,7 @@ test('Captures a lazy pageload transaction', async ({ page }) => { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.react.reactrouter_v6', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/lazy-loaded-user/:id/:innerId', 'url.path': '/lazy-loaded-user/5/foo', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/lazy-loaded-user\/5\/foo$/), @@ -167,7 +167,7 @@ test('Captures a lazy navigation transaction', async ({ page }) => { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react.reactrouter_v6', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/lazy-loaded-user/:id/:innerId', 'url.path': '/lazy-loaded-user/5/foo', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/lazy-loaded-user\/5\/foo$/), diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts index 30616f8d5381..5479f1935c83 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts @@ -21,7 +21,7 @@ test('Captures a pageload transaction', async ({ page }) => { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.react.reactrouter_v6', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'performance.timeOrigin': expect.any(Number), 'performance.activationStart': expect.any(Number), 'lcp.renderTime': expect.any(Number), @@ -128,7 +128,7 @@ test('Captures a navigation transaction', async ({ page }) => { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react.reactrouter_v6', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/', 'url.full': expect.stringMatching(/^http:\/\/localhost:3030\/#\/user\/5$/), diff --git a/dev-packages/e2e-tests/test-applications/react-create-memory-router/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-create-memory-router/tests/transactions.test.ts index 8fff883df119..32e2d36cae8c 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-memory-router/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-create-memory-router/tests/transactions.test.ts @@ -27,7 +27,7 @@ test('Captures a pageload transaction', async ({ page }) => { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.react.reactrouter_v6', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -57,7 +57,7 @@ test('Captures a navigation transaction', async ({ page }) => { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react.reactrouter_v6', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-5/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-5/tests/transactions.test.ts index 14c0c47ae5da..7e053e5c9fb2 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-5/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-5/tests/transactions.test.ts @@ -16,7 +16,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter_v5', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -53,7 +53,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter_v5', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/user/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-descendant-routes/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-6-descendant-routes/tests/transactions.test.ts index 9e25f8d65d9d..61ee41d33301 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-descendant-routes/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-6-descendant-routes/tests/transactions.test.ts @@ -17,7 +17,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/views/:viewId/:detailId', 'url.path': '/projects/123/views/234/567', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/views\/234\/567$/), @@ -47,7 +47,7 @@ test('sends a pageload transaction with a parameterized URL - alternative route' op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/old-views/:viewId/:detailId', 'url.path': '/projects/234/old-views/234/567', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/234\/old-views\/234\/567$/), @@ -79,7 +79,7 @@ test('keeps the parent path prefix for a descendant route with non-wildcard nest op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/child/:id', 'url.path': '/child/abc123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/child\/abc123$/), @@ -111,7 +111,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -135,7 +135,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/views/:viewId/:detailId', 'url.path': '/projects/123/views/456/789', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/views\/456\/789$/), @@ -167,7 +167,7 @@ test('sends a navigation transaction with a parameterized URL - alternative rout op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -191,7 +191,7 @@ test('sends a navigation transaction with a parameterized URL - alternative rout op: 'navigation', origin: 'auto.navigation.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/old-views/:viewId/:detailId', 'url.path': '/projects/123/old-views/345/654', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/old-views\/345\/654$/), @@ -225,7 +225,7 @@ test('keeps the parent path prefix for a descendant route with non-wildcard nest op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -249,7 +249,7 @@ test('keeps the parent path prefix for a descendant route with non-wildcard nest op: 'navigation', origin: 'auto.navigation.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/child/:id', 'url.path': '/child/abc123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/child\/abc123$/), @@ -279,7 +279,7 @@ test('resolves deep wildcard chain with three levels of nesting - pageload', asy op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/workspace/:teamId/:memberId', 'url.path': '/workspace/team/u123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/workspace\/team\/u123$/), @@ -340,7 +340,7 @@ test('does not mix param names across independent descendant routers', async ({ op: 'navigation', origin: 'auto.navigation.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/bar/:barId', 'url.path': '/bar/456', }, @@ -376,7 +376,7 @@ test('resolves deep wildcard chain with three levels of nesting - navigation', a op: 'navigation', origin: 'auto.navigation.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/workspace/:teamId/:memberId', 'url.path': '/workspace/team/u123', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/workspace\/team\/u123$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/transactions.test.ts index 20a126396acf..4c5e65b25e4e 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/transactions.test.ts @@ -16,7 +16,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -53,7 +53,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/user/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-6/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-6/tests/transactions.test.ts index 204a86d3ea74..22f79766c400 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-6/tests/transactions.test.ts @@ -16,7 +16,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -53,7 +53,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter_v6', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/user/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-cross-usage/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-cross-usage/tests/transactions.test.ts index f0d82229770f..b9365417ce69 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-cross-usage/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-cross-usage/tests/transactions.test.ts @@ -17,7 +17,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/views/:viewId/:detailId', 'url.path': '/projects/123/views/234/567', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/views\/234\/567$/), @@ -47,7 +47,7 @@ test('sends a pageload transaction with a parameterized URL - alternative route' op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/old-views/:viewId/:detailId', 'url.path': '/projects/234/old-views/234/567', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/234\/old-views\/234\/567$/), @@ -79,7 +79,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -103,7 +103,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/views/:viewId/:detailId', 'url.path': '/projects/123/views/456/789', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/views\/456\/789$/), @@ -135,7 +135,7 @@ test('sends a navigation transaction with a parameterized URL - alternative rout op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -159,7 +159,7 @@ test('sends a navigation transaction with a parameterized URL - alternative rout op: 'navigation', origin: 'auto.navigation.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/old-views/:viewId/:detailId', 'url.path': '/projects/123/old-views/345/654', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/old-views\/345\/654$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/lazy.server.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/lazy.server.test.ts index a0198e13b2fb..956d45a6104e 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/lazy.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/lazy.server.test.ts @@ -28,7 +28,7 @@ test.describe('server - instrumentation API lazy loading', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.server', origin: 'auto.http.react_router.instrumentation_api', diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/middleware.server.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/middleware.server.test.ts index 3ec90edb4f37..8409d9f18b8f 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/middleware.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/middleware.server.test.ts @@ -24,7 +24,7 @@ test.describe('server - instrumentation API middleware', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.server', origin: 'auto.http.react_router.instrumentation_api', diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/navigation.client.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/navigation.client.test.ts index 51bf35781b3f..4e88fb275953 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/navigation.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/navigation.client.test.ts @@ -38,7 +38,7 @@ test.describe('client - hybrid navigation (instrumentation API span + legacy par op: 'navigation', origin: 'auto.navigation.react_router.instrumentation_api', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', @@ -79,7 +79,7 @@ test.describe('client - hybrid navigation (instrumentation API span + legacy par op: 'navigation', origin: 'auto.navigation.react_router.instrumentation_api', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', @@ -119,7 +119,7 @@ test.describe('client - hybrid navigation (instrumentation API span + legacy par op: 'navigation', origin: 'auto.navigation.react_router.instrumentation_api', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/sentry', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/sentry$/), @@ -214,7 +214,7 @@ test.describe('client - hybrid navigation (instrumentation API span + legacy par op: 'navigation', origin: 'auto.navigation.react_router.instrumentation_api', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.back', @@ -260,7 +260,7 @@ test.describe('client - instrumentation API navigation (upstream limitation)', ( data: { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', }, op: 'navigation', origin: 'auto.navigation.react_router.instrumentation_api', @@ -297,7 +297,7 @@ test.describe('client - instrumentation API navigation (upstream limitation)', ( data: { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', }, op: 'navigation', origin: 'auto.navigation.react_router.instrumentation_api', diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/pageload.client.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/pageload.client.test.ts index 795d222f14a4..cea034a2de01 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/pageload.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/pageload.client.test.ts @@ -49,7 +49,7 @@ test.describe('client - instrumentation API pageload', () => { trace: { op: 'pageload', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/some-param', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/some-param$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/performance.server.test.ts index d9a8b0b8f2ac..3d4c96e2b570 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/performance.server.test.ts @@ -20,7 +20,7 @@ test.describe('server - instrumentation API performance', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.server', origin: 'auto.http.react_router.instrumentation_api', @@ -71,7 +71,7 @@ test.describe('server - instrumentation API performance', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.server', origin: 'auto.http.react_router.instrumentation_api', diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework-spa/tests/performance/navigation.client.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework-spa/tests/performance/navigation.client.test.ts index 5c1b7c493e67..bbe7bf9a4907 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework-spa/tests/performance/navigation.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework-spa/tests/performance/navigation.client.test.ts @@ -29,7 +29,7 @@ test.describe('client - navigation performance', () => { data: { 'sentry.origin': 'auto.navigation.react_router', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/sentry', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/sentry$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework-spa/tests/performance/pageload.client.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework-spa/tests/performance/pageload.client.test.ts index 9598d8dbe17e..0c37841fcada 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework-spa/tests/performance/pageload.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework-spa/tests/performance/pageload.client.test.ts @@ -21,7 +21,7 @@ test.describe('client - pageload performance', () => { data: { 'sentry.origin': 'auto.pageload.react_router', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance', 'url.path': '/performance', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance$/), @@ -78,7 +78,7 @@ test.describe('client - pageload performance', () => { data: { 'sentry.origin': 'auto.pageload.react_router', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/sentry', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/sentry$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/navigation.client.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/navigation.client.test.ts index 6555db3766c3..59b2f8a9e038 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/navigation.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/navigation.client.test.ts @@ -28,7 +28,7 @@ test.describe('client - navigation performance', () => { data: { 'sentry.origin': 'auto.navigation.react_router', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/ssr', 'url.path': '/performance/ssr', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/ssr$/), @@ -87,7 +87,7 @@ test.describe('client - navigation performance', () => { op: 'navigation', origin: 'auto.navigation.react_router', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/object-nav', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/object-nav\?foo=bar$/), @@ -159,7 +159,7 @@ test.describe('client - navigation performance', () => { data: { 'sentry.origin': 'auto.navigation.react_router', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/sentry', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/sentry$/), @@ -225,7 +225,7 @@ test.describe('client - navigation performance', () => { op: 'navigation', origin: 'auto.navigation.react_router', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router', 'url.template': '/performance', diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/pageload.client.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/pageload.client.test.ts index f996989ccbf5..e3bea05a36ef 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/pageload.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/pageload.client.test.ts @@ -20,7 +20,7 @@ test.describe('client - pageload performance', () => { data: { 'sentry.origin': 'auto.pageload.react_router', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance', // react-router-serve 301-redirects the bare index route to a trailing slash 'url.path': '/performance/', @@ -77,7 +77,7 @@ test.describe('client - pageload performance', () => { data: { 'sentry.origin': 'auto.pageload.react_router', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/sentry', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/sentry$/), @@ -133,7 +133,7 @@ test.describe('client - pageload performance', () => { data: { 'sentry.origin': 'auto.pageload.react_router', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/static', // react-router-serve 301-redirects prerendered routes to a trailing slash 'url.path': '/performance/static/', diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/performance.server.test.ts index b4b23f2012ea..bcfe15e49c34 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/performance.server.test.ts @@ -20,7 +20,7 @@ test.describe('server - performance', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.request_handler', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.server', origin: 'auto.http.react_router.request_handler', @@ -71,7 +71,7 @@ test.describe('server - performance', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.request_handler', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.server', origin: 'auto.http.react_router.request_handler', diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/timeout-behaviour.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/timeout-behaviour.test.ts index 281ebc88e52c..7826d7ced00e 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/timeout-behaviour.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/timeout-behaviour.test.ts @@ -22,7 +22,7 @@ test('lazyRouteTimeout: Routes load within timeout window', async ({ page }) => // Should get full parameterized route expect(event.transaction).toBe('/deep/level2/level3/:id'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(event.contexts?.trace?.data?.['sentry.idle_span_finish_reason']).toBe('idleTimeout'); }); @@ -46,7 +46,7 @@ test('lazyRouteTimeout: Infinity timeout always waits for routes', async ({ page // Should wait for routes to load (up to finalTimeout) and get full route expect(event.transaction).toBe('/deep/level2/level3/:id'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(event.contexts?.trace?.data?.['sentry.idle_span_finish_reason']).toBe('idleTimeout'); }); @@ -69,7 +69,7 @@ test('idleTimeout: Captures all activity with increased timeout', async ({ page const event = await transactionPromise; expect(event.transaction).toBe('/deep/level2/level3/:id'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(event.contexts?.trace?.data?.['sentry.idle_span_finish_reason']).toBe('idleTimeout'); // Transaction should wait for full idle timeout (5+ seconds) @@ -99,7 +99,7 @@ test('idleTimeout: Finishes prematurely with low timeout', async ({ page }) => { expect(event.contexts?.trace?.data?.['sentry.idle_span_finish_reason']).toBe('idleTimeout'); expect(event.transaction).toBe('/deep/level2/level3/:id'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); // Transaction should finish quickly (< 200ms) const duration = event.timestamp! - event.start_timestamp; @@ -121,6 +121,6 @@ test('idleTimeout: Pageload on deeply nested route', async ({ page }) => { const pageloadEvent = await pageloadPromise; expect(pageloadEvent.transaction).toBe('/deep/level2/level3/:id'); - expect(pageloadEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(pageloadEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(pageloadEvent.contexts?.trace?.data?.['sentry.idle_span_finish_reason']).toBe('idleTimeout'); }); diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/transactions.test.ts index ff1a65bea2f0..59f33c1ac8cc 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-lazy-routes/tests/transactions.test.ts @@ -609,7 +609,7 @@ test('Creates pageload transaction with parameterized route for delayed lazy rou expect(pageloadEvent.transaction).toBe('/delayed-lazy/:id'); expect(pageloadEvent.contexts?.trace?.op).toBe('pageload'); - expect(pageloadEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(pageloadEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Creates navigation transaction with parameterized route for delayed lazy route', async ({ page }) => { @@ -636,7 +636,7 @@ test('Creates navigation transaction with parameterized route for delayed lazy r expect(navigationEvent.transaction).toBe('/delayed-lazy/:id'); expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); - expect(navigationEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(navigationEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Creates navigation transaction when navigating with query parameters from home to route', async ({ page }) => { @@ -669,7 +669,7 @@ test('Creates navigation transaction when navigating with query parameters from // Query parameters don't affect the transaction name (still /delayed-lazy/:id) expect(navigationEvent.transaction).toBe('/delayed-lazy/:id'); expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); - expect(navigationEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(navigationEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(navigationEvent.contexts?.trace?.status).toBe('ok'); }); @@ -703,7 +703,7 @@ test('Creates separate navigation transaction when changing only query parameter // Query-only navigation should create a navigation transaction expect(navigationEvent.transaction).toBe('/delayed-lazy/:id'); expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); - expect(navigationEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(navigationEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(navigationEvent.contexts?.trace?.status).toBe('ok'); }); @@ -790,7 +790,7 @@ test('Creates navigation transaction when changing only hash on same route', asy // Hash-only navigation should create a navigation transaction expect(navigationEvent.transaction).toBe('/delayed-lazy/:id'); expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); - expect(navigationEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(navigationEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(navigationEvent.contexts?.trace?.status).toBe('ok'); }); @@ -880,7 +880,7 @@ test('Creates navigation transaction when changing both query and hash on same r // Combined query + hash navigation should create a navigation transaction expect(navigationEvent.transaction).toBe('/delayed-lazy/:id'); expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); - expect(navigationEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(navigationEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); expect(navigationEvent.contexts?.trace?.status).toBe('ok'); }); @@ -914,7 +914,7 @@ test('Creates navigation transaction with correct name for slow lazy route', asy // Verify the transaction has the correct parameterized route name expect(navigationEvent.transaction).toBe('/slow-fetch/:id'); expect(navigationEvent.contexts?.trace?.op).toBe('navigation'); - expect(navigationEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(navigationEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Rapid navigation does not corrupt transaction names when lazy handlers resolve late', async ({ page }) => { @@ -993,7 +993,7 @@ test('Correctly names pageload transaction for slow lazy route with fetch', asyn // Verify the transaction has the correct parameterized route name expect(pageloadEvent.transaction).toBe('/slow-fetch/:id'); expect(pageloadEvent.contexts?.trace?.op).toBe('pageload'); - expect(pageloadEvent.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(pageloadEvent.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); // Verify the transaction contains a fetch span const spans = pageloadEvent.spans || []; @@ -1249,7 +1249,7 @@ test('Slow lazy route pageload with early span end still gets parameterized rout expect(event.transaction).toBe('/slow-fetch/:id'); expect(event.type).toBe('transaction'); expect(event.contexts?.trace?.op).toBe('pageload'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); const idleSpanFinishReason = event.contexts?.trace?.data?.['sentry.idle_span_finish_reason']; expect(['idleTimeout', 'externalFinish']).toContain(idleSpanFinishReason); @@ -1272,7 +1272,7 @@ test('Wildcard route pageload gets upgraded to parameterized route name (regress expect(event.transaction).toBe('/wildcard-lazy/:id'); expect(event.type).toBe('transaction'); expect(event.contexts?.trace?.op).toBe('pageload'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); // Regression: Navigation to slow lazy route should get parameterized name even if span ends early. @@ -1306,7 +1306,7 @@ test('Slow lazy route navigation with early span end still gets parameterized ro expect(event.transaction).toBe('/wildcard-lazy/:id'); expect(event.type).toBe('transaction'); expect(event.contexts?.trace?.op).toBe('navigation'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Captured navigation context is used instead of stale window.location during rapid navigation', async ({ @@ -1460,7 +1460,7 @@ test('Route manifest provides correct name when navigation span ends before lazy expect(event.transaction).toBe('/wildcard-lazy/:id'); expect(event.type).toBe('transaction'); expect(event.contexts?.trace?.op).toBe('navigation'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('Route manifest provides correct name when pageload span ends before lazy route resolves', async ({ page }) => { @@ -1481,7 +1481,7 @@ test('Route manifest provides correct name when pageload span ends before lazy r expect(event.transaction).toBe('/wildcard-lazy/:id'); expect(event.type).toBe('transaction'); expect(event.contexts?.trace?.op).toBe('pageload'); - expect(event.contexts?.trace?.data?.['sentry.source']).toBe('route'); + expect(event.contexts?.trace?.data?.['sentry.segment.name.source']).toBe('route'); }); test('GQL fetch span is attributed to the correct navigation transaction when navigating from index to lazy GQL page', async ({ diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-spa-streaming/tests/spans.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-spa-streaming/tests/spans.test.ts index 3cc5dd7c24f5..3cbba99622df 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-spa-streaming/tests/spans.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-spa-streaming/tests/spans.test.ts @@ -14,7 +14,7 @@ test('sends a pageload span with a parameterized URL', async ({ page }) => { expect(span.trace_id).toMatch(/[a-f0-9]{32}/); expect(span.status).toBe('ok'); expect(span.attributes['sentry.origin']?.value).toBe('auto.pageload.react.reactrouter_v7'); - expect(span.attributes['sentry.source']?.value).toBe('route'); + expect(span.attributes['sentry.segment.name.source']?.value).toBe('route'); expect(span.attributes['url.template']?.value).toBe('/'); expect(span.attributes['url.path']?.value).toBe('/'); expect(span.attributes['url.full']?.value).toMatch(/^https?:\/\/localhost:\d+\/$/); @@ -41,7 +41,7 @@ test('sends a navigation span with a parameterized URL', async ({ page }) => { expect(navigationSpan.trace_id).toMatch(/[a-f0-9]{32}/); expect(navigationSpan.status).toBe('ok'); expect(navigationSpan.attributes['sentry.origin']?.value).toBe('auto.navigation.react.reactrouter_v7'); - expect(navigationSpan.attributes['sentry.source']?.value).toBe('route'); + expect(navigationSpan.attributes['sentry.segment.name.source']?.value).toBe('route'); expect(navigationSpan.attributes['url.template']?.value).toBe('/user/:id'); expect(navigationSpan.attributes['url.path']?.value).toBe('/user/5'); expect(navigationSpan.attributes['url.full']?.value).toMatch(/^https?:\/\/localhost:\d+\/user\/5$/); diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-spa/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-spa/tests/transactions.test.ts index bc5e0d248a1b..81dc4d25d274 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-spa/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-spa/tests/transactions.test.ts @@ -16,7 +16,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -53,7 +53,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/user/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-8-cross-usage/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-8-cross-usage/tests/transactions.test.ts index 3aa5f002fe11..1865b8ca16c5 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-8-cross-usage/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-8-cross-usage/tests/transactions.test.ts @@ -17,7 +17,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/views/:viewId/:detailId', 'url.path': '/projects/123/views/234/567', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/views\/234\/567$/), @@ -47,7 +47,7 @@ test('sends a pageload transaction with a parameterized URL - alternative route' op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/old-views/:viewId/:detailId', 'url.path': '/projects/234/old-views/234/567', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/234\/old-views\/234\/567$/), @@ -79,7 +79,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -103,7 +103,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/views/:viewId/:detailId', 'url.path': '/projects/123/views/456/789', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/views\/456\/789$/), @@ -135,7 +135,7 @@ test('sends a navigation transaction with a parameterized URL - alternative rout op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -159,7 +159,7 @@ test('sends a navigation transaction with a parameterized URL - alternative rout op: 'navigation', origin: 'auto.navigation.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/projects/:projectId/old-views/:viewId/:detailId', 'url.path': '/projects/123/old-views/345/654', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/projects\/123\/old-views\/345\/654$/), diff --git a/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/navigation.client.test.ts b/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/navigation.client.test.ts index 6555db3766c3..59b2f8a9e038 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/navigation.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/navigation.client.test.ts @@ -28,7 +28,7 @@ test.describe('client - navigation performance', () => { data: { 'sentry.origin': 'auto.navigation.react_router', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/ssr', 'url.path': '/performance/ssr', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/ssr$/), @@ -87,7 +87,7 @@ test.describe('client - navigation performance', () => { op: 'navigation', origin: 'auto.navigation.react_router', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/object-nav', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/object-nav\?foo=bar$/), @@ -159,7 +159,7 @@ test.describe('client - navigation performance', () => { data: { 'sentry.origin': 'auto.navigation.react_router', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/sentry', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/sentry$/), @@ -225,7 +225,7 @@ test.describe('client - navigation performance', () => { op: 'navigation', origin: 'auto.navigation.react_router', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router', 'url.template': '/performance', diff --git a/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/pageload.client.test.ts b/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/pageload.client.test.ts index f996989ccbf5..e3bea05a36ef 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/pageload.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/pageload.client.test.ts @@ -20,7 +20,7 @@ test.describe('client - pageload performance', () => { data: { 'sentry.origin': 'auto.pageload.react_router', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance', // react-router-serve 301-redirects the bare index route to a trailing slash 'url.path': '/performance/', @@ -77,7 +77,7 @@ test.describe('client - pageload performance', () => { data: { 'sentry.origin': 'auto.pageload.react_router', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/with/:param', 'url.path': '/performance/with/sentry', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/performance\/with\/sentry$/), @@ -133,7 +133,7 @@ test.describe('client - pageload performance', () => { data: { 'sentry.origin': 'auto.pageload.react_router', 'sentry.op': 'pageload', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance/static', // react-router-serve 301-redirects prerendered routes to a trailing slash 'url.path': '/performance/static/', diff --git a/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/performance.server.test.ts index b4b23f2012ea..bcfe15e49c34 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/performance.server.test.ts @@ -20,7 +20,7 @@ test.describe('server - performance', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.request_handler', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.server', origin: 'auto.http.react_router.request_handler', @@ -71,7 +71,7 @@ test.describe('server - performance', () => { data: { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.request_handler', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, op: 'http.server', origin: 'auto.http.react_router.request_handler', diff --git a/dev-packages/e2e-tests/test-applications/react-router-8-spa/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-8-spa/tests/transactions.test.ts index 6ed194fcef13..d4f229597f6e 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-8-spa/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-8-spa/tests/transactions.test.ts @@ -16,7 +16,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = op: 'pageload', origin: 'auto.pageload.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -53,7 +53,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) op: 'navigation', origin: 'auto.navigation.react.reactrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/user/:id', 'url.path': '/user/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), diff --git a/dev-packages/e2e-tests/test-applications/remix-hydrogen/tests/client-transactions.test.ts b/dev-packages/e2e-tests/test-applications/remix-hydrogen/tests/client-transactions.test.ts index bde21cd3673a..776abb4fa806 100644 --- a/dev-packages/e2e-tests/test-applications/remix-hydrogen/tests/client-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/remix-hydrogen/tests/client-transactions.test.ts @@ -16,7 +16,7 @@ test('Sends a pageload transaction to Sentry', async ({ page }) => { contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), 'url.path': '/', 'url.template': '/', @@ -55,7 +55,7 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => { contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/), 'url.path': '/user/5', 'url.template': '/user/:id', diff --git a/dev-packages/e2e-tests/test-applications/solid-tanstack-router/tests/routing-instrumentation.test.ts b/dev-packages/e2e-tests/test-applications/solid-tanstack-router/tests/routing-instrumentation.test.ts index 7f140995199a..83690b4a4e5f 100644 --- a/dev-packages/e2e-tests/test-applications/solid-tanstack-router/tests/routing-instrumentation.test.ts +++ b/dev-packages/e2e-tests/test-applications/solid-tanstack-router/tests/routing-instrumentation.test.ts @@ -14,7 +14,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.solid.tanstack_router', 'sentry.op': 'pageload', 'url.path.parameter.postId': '456', @@ -58,7 +58,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.solid.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '2', @@ -92,7 +92,7 @@ test('sends a pageload transaction named after the resolved route when a redirec contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.solid.tanstack_router', 'sentry.op': 'pageload', 'url.path.parameter.postId': '1', @@ -135,7 +135,7 @@ test('sends a navigation transaction when a redirect is thrown in beforeLoad', a contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.solid.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '1', @@ -183,7 +183,7 @@ test('sends a navigation transaction for a normal navigation that happens after contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.solid.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '2', @@ -217,7 +217,7 @@ test('sends pageload transaction with web vitals measurements', async ({ page }) op: 'pageload', origin: 'auto.pageload.solid.tanstack_router', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/tests/performance.client.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-2/tests/performance.client.test.ts index 9052b6b1e179..b812500bc737 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-2/tests/performance.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-2/tests/performance.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload transaction', async ({ page }) => { op: 'pageload', origin: 'auto.pageload.browser', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -44,7 +44,7 @@ test('sends a navigation transaction with parametrized route', async ({ page }) op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/5$/), @@ -76,7 +76,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/6', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/6$/), @@ -104,7 +104,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/back-navigation', 'url.path': '/back-navigation', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/back-navigation$/), diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/tests/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-2/tests/performance.server.test.ts index 877620c48ebd..5324b427b8d7 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-2/tests/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-2/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_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart-2', transactionEvent => { @@ -22,7 +18,6 @@ test('sends a server action transaction on pageload', async ({ page }) => { data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, }), ]), @@ -47,7 +42,6 @@ test('sends a server action transaction on client navigation', async ({ page }) data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, }), ]), diff --git a/dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/tests/performance.client.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/tests/performance.client.test.ts index e0e395049468..5b23badf4e6b 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/tests/performance.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-dynamic-import/tests/performance.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload transaction', async ({ page }) => { op: 'pageload', origin: 'auto.pageload.browser', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -44,7 +44,7 @@ test('sends a navigation transaction with parametrized route', async ({ page }) op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/5$/), @@ -76,7 +76,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/6', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/6$/), @@ -104,7 +104,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/back-navigation', 'url.path': '/back-navigation', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/back-navigation$/), 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 932254b4c38d..6a332efd7d3f 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_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart-dynamic-import', transactionEvent => { @@ -22,7 +18,6 @@ test('sends a server action transaction on pageload', async ({ page }) => { data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, }), ]), @@ -47,7 +42,6 @@ test('sends a server action transaction on client navigation', async ({ page }) data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [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.client.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-spa/tests/performance.client.test.ts index 335179ad2e1c..feb729f22028 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-spa/tests/performance.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-spa/tests/performance.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload transaction', async ({ page }) => { op: 'pageload', origin: 'auto.pageload.browser', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -44,7 +44,7 @@ test('sends a navigation transaction with parametrized route', async ({ page }) op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/5$/), @@ -76,7 +76,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/6', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/6$/), @@ -104,7 +104,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/back-navigation', 'url.path': '/back-navigation', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/back-navigation$/), 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 810a5d4a8adb..f84e35ed97bb 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_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart-spa', transactionEvent => { @@ -22,7 +18,6 @@ test('sends a server action transaction on pageload', async ({ page }) => { data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, }), ]), @@ -47,7 +42,6 @@ test('sends a server action transaction on client navigation', async ({ page }) data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [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.client.test.ts b/dev-packages/e2e-tests/test-applications/solidstart-top-level-import/tests/performance.client.test.ts index 6d3618161e93..c67354349bf9 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-top-level-import/tests/performance.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-top-level-import/tests/performance.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload transaction', async ({ page }) => { op: 'pageload', origin: 'auto.pageload.browser', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -44,7 +44,7 @@ test('sends a navigation transaction with parametrized route', async ({ page }) op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/5$/), @@ -76,7 +76,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/6', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/6$/), @@ -104,7 +104,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/back-navigation', 'url.path': '/back-navigation', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/back-navigation$/), 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 1c747470f7f6..82a254827e06 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_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart-top-level-import', transactionEvent => { @@ -22,7 +18,6 @@ test('sends a server action transaction on pageload', async ({ page }) => { data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, }), ]), @@ -47,7 +42,6 @@ test('sends a server action transaction on client navigation', async ({ page }) data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, }), ]), diff --git a/dev-packages/e2e-tests/test-applications/solidstart/tests/performance.client.test.ts b/dev-packages/e2e-tests/test-applications/solidstart/tests/performance.client.test.ts index aec390512674..dabf85785aab 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart/tests/performance.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart/tests/performance.client.test.ts @@ -15,7 +15,7 @@ test('sends a pageload transaction', async ({ page }) => { op: 'pageload', origin: 'auto.pageload.browser', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -44,7 +44,7 @@ test('sends a navigation transaction with parametrized route', async ({ page }) op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/5', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/5$/), @@ -76,7 +76,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path': '/users/6', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/users\/6$/), @@ -104,7 +104,7 @@ test('updates the transaction when using the back button', async ({ page }) => { op: 'navigation', origin: 'auto.navigation.solidstart.solidrouter', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/back-navigation', 'url.path': '/back-navigation', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/back-navigation$/), 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 956c78a08fcc..a70ed673de0b 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_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/solidstart'; test('sends a server action transaction on pageload', async ({ page }) => { const transactionPromise = waitForTransaction('solidstart', transactionEvent => { @@ -22,7 +18,6 @@ test('sends a server action transaction on pageload', async ({ page }) => { data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', }, }), ]), @@ -47,7 +42,6 @@ test('sends a server action transaction on client navigation', async ({ page }) data: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', [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 90f60315bddb..c8708815203e 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 @@ -85,7 +85,6 @@ test('server pageload request span has nested request span for sub request', asy 'url.path': '/api/users', 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.sveltekit', - 'sentry.source': 'route', 'sveltekit.is_data_request': false, 'sveltekit.is_sub_request': true, 'sveltekit.tracing.original_name': 'sveltekit.handle.root', diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-kit-tracing/tests/tracing.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-kit-tracing/tests/tracing.test.ts index cf00c80f778c..a9e8cd2ba449 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-kit-tracing/tests/tracing.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-kit-tracing/tests/tracing.test.ts @@ -308,7 +308,7 @@ test('captures one navigation transaction per redirect', async ({ page }) => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/redirect1', @@ -348,7 +348,7 @@ test('captures one navigation transaction per redirect', async ({ page }) => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/redirect2', @@ -388,7 +388,7 @@ test('captures one navigation transaction per redirect', async ({ page }) => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/users/[id]', diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.test.ts index 3043c6ab80b7..b4d2f5698354 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.test.ts @@ -301,7 +301,7 @@ test.describe('performance events', () => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/redirect1', @@ -341,7 +341,7 @@ test.describe('performance events', () => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/redirect2', @@ -381,7 +381,7 @@ test.describe('performance events', () => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/users/[id]', diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.test.ts index 51a3ca20579b..1580e70eb3e0 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.test.ts @@ -301,7 +301,7 @@ test.describe('performance events', () => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/redirect1', @@ -341,7 +341,7 @@ test.describe('performance events', () => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/redirect2', @@ -381,7 +381,7 @@ test.describe('performance events', () => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/users/[id]', 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 ecedbad4214c..8c6bfe1c3fc1 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 @@ -84,7 +84,6 @@ test('server pageload request span has nested request span for sub request', asy 'url.full': 'https://localhost:3030/api/users', 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.sveltekit', - 'sentry.source': 'route', 'sveltekit.is_data_request': false, 'sveltekit.is_sub_request': true, 'sveltekit.tracing.original_name': 'sveltekit.handle.root', diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-3/tests/tracing.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-3/tests/tracing.test.ts index 0489d76f73e6..ad3c8961ce05 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-3/tests/tracing.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-3/tests/tracing.test.ts @@ -285,7 +285,7 @@ test('captures one navigation transaction per redirect', async ({ page }) => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/redirect1', @@ -322,7 +322,7 @@ test('captures one navigation transaction per redirect', async ({ page }) => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/redirect2', @@ -359,7 +359,7 @@ test('captures one navigation transaction per redirect', async ({ page }) => { data: { 'sentry.origin': 'auto.navigation.sveltekit', 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.sveltekit.navigation.type': 'link', 'sentry.sveltekit.navigation.from': '/', 'sentry.sveltekit.navigation.to': '/users/[id]', diff --git a/dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts b/dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts index 60c4bd8fd1e3..a38ffa1e68c4 100644 --- a/dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts +++ b/dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts @@ -16,7 +16,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.react.tanstack_router', 'sentry.op': 'pageload', 'url.path.parameter.postId': '456', @@ -55,7 +55,7 @@ test('sends pageload transaction with web vitals measurements', async ({ page }) op: 'pageload', origin: 'auto.pageload.react.tanstack_router', data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/', 'url.path': '/', 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/), @@ -108,7 +108,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.react.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '2', @@ -148,7 +148,7 @@ test('sends a pageload transaction with resolved URL attrs after same-route redi contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.react.tanstack_router', 'sentry.op': 'pageload', 'url.path.parameter.postId': '2', @@ -184,7 +184,7 @@ test('sends a pageload transaction named after the resolved route when a redirec contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.react.tanstack_router', 'sentry.op': 'pageload', 'url.path.parameter.postId': '1', @@ -225,7 +225,7 @@ test('sends a navigation transaction when a redirect is thrown in beforeLoad', a contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.react.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '1', @@ -277,7 +277,7 @@ test('sends a navigation transaction for a normal navigation that happens after contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.react.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '2', diff --git a/dev-packages/e2e-tests/test-applications/tanstackstart-react-cloudflare/tests/transaction.test.ts b/dev-packages/e2e-tests/test-applications/tanstackstart-react-cloudflare/tests/transaction.test.ts index 91b3130ff0dc..8bdb0dbc9d7b 100644 --- a/dev-packages/e2e-tests/test-applications/tanstackstart-react-cloudflare/tests/transaction.test.ts +++ b/dev-packages/e2e-tests/test-applications/tanstackstart-react-cloudflare/tests/transaction.test.ts @@ -31,7 +31,6 @@ test('Sends a server function transaction with span from wrapFetchWithSentry', a data: { 'sentry.op': 'function', 'sentry.origin': 'auto.function.tanstackstart.server', - 'sentry.source': 'route', 'tanstackstart.function.id': expect.any(String), 'tanstackstart.function.filename': 'src/routes/test-serverFn.tsx', }, @@ -70,7 +69,6 @@ test('Sends a server function transaction for a nested server function with manu data: { 'sentry.op': 'function', 'sentry.origin': 'auto.function.tanstackstart.server', - 'sentry.source': 'route', 'tanstackstart.function.id': expect.any(String), 'tanstackstart.function.filename': 'src/routes/test-serverFn.tsx', }, diff --git a/dev-packages/e2e-tests/test-applications/tanstackstart-react/tests/transaction.test.ts b/dev-packages/e2e-tests/test-applications/tanstackstart-react/tests/transaction.test.ts index 87dfcf45edd8..65b15b9ff42a 100644 --- a/dev-packages/e2e-tests/test-applications/tanstackstart-react/tests/transaction.test.ts +++ b/dev-packages/e2e-tests/test-applications/tanstackstart-react/tests/transaction.test.ts @@ -33,7 +33,6 @@ test('Sends a server function transaction with auto-instrumentation', async ({ p data: { 'sentry.op': 'function', 'sentry.origin': 'auto.function.tanstackstart.server', - 'sentry.source': 'route', 'tanstackstart.function.id': expect.any(String), 'tanstackstart.function.filename': 'src/routes/test-serverFn.tsx', }, @@ -73,7 +72,6 @@ test('Sends a server function transaction for a nested server function only if i data: { 'sentry.op': 'function', 'sentry.origin': 'auto.function.tanstackstart.server', - 'sentry.source': 'route', 'tanstackstart.function.id': expect.any(String), 'tanstackstart.function.filename': 'src/routes/test-serverFn.tsx', }, diff --git a/dev-packages/e2e-tests/test-applications/tsx-express/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/tsx-express/tests/transactions.test.ts index 49f520d27707..501849f38e60 100644 --- a/dev-packages/e2e-tests/test-applications/tsx-express/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/tsx-express/tests/transactions.test.ts @@ -15,7 +15,7 @@ test('Sends an API route transaction', async ({ baseURL }) => { expect(transactionEvent.contexts?.trace).toEqual({ data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.http.otel.http', 'sentry.op': 'http.server', 'sentry.sample_rate': 1, diff --git a/dev-packages/e2e-tests/test-applications/vue-3/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/vue-3/tests/performance.test.ts index 876a154cdecb..aa9c4b576612 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/vue-3/tests/performance.test.ts @@ -17,7 +17,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'params.id': '456', @@ -56,7 +56,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.vue', 'sentry.op': 'navigation', 'params.id': '123', @@ -88,7 +88,7 @@ test('sends a pageload transaction with a nested route URL', async ({ page }) => contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'params.id': '123', @@ -120,7 +120,7 @@ test('sends a pageload transaction with a route name as transaction name if avai contexts: { trace: { data: { - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'auto.pageload.vue', 'sentry.op': 'pageload', 'navigation.route.id': 'AboutView', @@ -150,6 +150,27 @@ test('sends a lifecycle span for the root and for each tracked component only', const rootSpan = await transactionPromise; + expect(rootSpan).toMatchObject({ + contexts: { + trace: { + data: { + 'sentry.segment.name.source': 'route', + 'sentry.origin': 'auto.pageload.vue', + 'sentry.op': 'pageload', + 'url.template': '/components', + 'url.path': '/components', + 'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/components$/), + }, + op: 'pageload', + origin: 'auto.pageload.vue', + }, + }, + transaction: '/components', + transaction_info: { + source: 'route', + }, + }); + const uiSpans = (rootSpan.spans || []).filter(span => span.origin === 'auto.ui.vue'); const uiSpanDescriptions = uiSpans.map(span => span.description).sort(); diff --git a/dev-packages/e2e-tests/test-applications/vue-tanstack-router/tests/routing-instrumentation.test.ts b/dev-packages/e2e-tests/test-applications/vue-tanstack-router/tests/routing-instrumentation.test.ts index 7ede26b00295..32aaef7f900a 100644 --- a/dev-packages/e2e-tests/test-applications/vue-tanstack-router/tests/routing-instrumentation.test.ts +++ b/dev-packages/e2e-tests/test-applications/vue-tanstack-router/tests/routing-instrumentation.test.ts @@ -17,7 +17,7 @@ test('sends pageload transaction with web vitals measurements', async ({ page }) origin: 'auto.pageload.vue.tanstack_router', data: { 'sentry.origin': 'auto.pageload.vue.tanstack_router', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.op': 'pageload', 'url.template': '/', 'url.path': '/', @@ -63,7 +63,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) = contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue.tanstack_router', 'sentry.op': 'pageload', 'url.path.parameter.postId': '456', @@ -108,7 +108,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page }) contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.vue.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '2', @@ -142,7 +142,7 @@ test('sends a pageload transaction named after the resolved route when a redirec contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.pageload.vue.tanstack_router', 'sentry.op': 'pageload', 'url.path.parameter.postId': '1', @@ -185,7 +185,7 @@ test('sends a navigation transaction when a redirect is thrown in beforeLoad', a contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.vue.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '1', @@ -233,7 +233,7 @@ test('sends a navigation transaction for a normal navigation that happens after contexts: { trace: { data: { - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.navigation.vue.tanstack_router', 'sentry.op': 'navigation', 'url.path.parameter.postId': '2', diff --git a/dev-packages/node-integration-tests/suites/express/tracing/updateName/scenario.mjs b/dev-packages/node-integration-tests/suites/express/tracing/updateName/scenario.mjs index 75afbdbf42fe..1ce6eb4833c9 100644 --- a/dev-packages/node-integration-tests/suites/express/tracing/updateName/scenario.mjs +++ b/dev-packages/node-integration-tests/suites/express/tracing/updateName/scenario.mjs @@ -29,7 +29,7 @@ app.get('/test/:id/updateSpanNameAndSource', (_req, res) => { const span = Sentry.getActiveSpan(); const rootSpan = Sentry.getRootSpan(span); Sentry.updateSpanName(rootSpan, 'new-name'); - rootSpan.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'component'); + rootSpan.setAttribute('sentry.segment.name.source', 'component'); res.send({ response: 'response 4' }); }); diff --git a/dev-packages/node-integration-tests/suites/express/tracing/updateName/test.ts b/dev-packages/node-integration-tests/suites/express/tracing/updateName/test.ts index 5585d8d45bec..f48b97265f59 100644 --- a/dev-packages/node-integration-tests/suites/express/tracing/updateName/test.ts +++ b/dev-packages/node-integration-tests/suites/express/tracing/updateName/test.ts @@ -1,5 +1,6 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/node'; + import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createCjsTests } from '../../../../utils/runner'; @@ -40,7 +41,7 @@ describe('express tracing - updateName', () => { contexts: { trace: { op: 'http.server', - data: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom' }, + data: { [SENTRY_SEGMENT_NAME_SOURCE]: 'custom' }, }, }, }); @@ -66,7 +67,7 @@ describe('express tracing - updateName', () => { contexts: { trace: { op: 'http.server', - data: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component' }, + data: { [SENTRY_SEGMENT_NAME_SOURCE]: 'component' }, }, }, }); 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 a3168e455c57..5dd0357c1a3a 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 @@ -6,9 +6,9 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import { + SENTRY_SEGMENT_NAME_SOURCE, SENTRY_SEGMENT_ID, SENTRY_SEGMENT_NAME, SENTRY_SDK_NAME, @@ -154,8 +154,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'custom' }, - 'sentry.segment.name.source': { type: 'string', value: 'custom' }, + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'custom' }, 'process.runtime.engine.name': { type: 'string', value: 'v8' }, 'process.runtime.engine.version': { type: 'string', value: expect.any(String) }, 'app.start_time': { type: 'string', value: expect.any(String) }, diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage/test.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage/test.ts index ea02312afd43..d616c04c457d 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage/test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/node'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { afterAll, expect, test } from 'vitest'; import { cleanupChildProcesses, createRunner } from '../../../../utils/runner'; @@ -16,7 +16,7 @@ test('sends a manually started root span with source custom', async () => { trace: { span_id: expect.any(String), trace_id: expect.any(String), - data: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom' }, + data: { [SENTRY_SEGMENT_NAME_SOURCE]: 'custom' }, }, }, }, @@ -35,7 +35,7 @@ test("doesn't change the name for manually started spans even if attributes trig trace: { span_id: expect.any(String), trace_id: expect.any(String), - data: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom' }, + data: { [SENTRY_SEGMENT_NAME_SOURCE]: 'custom' }, }, }, }, diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method-streamed/scenario.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method-streamed/scenario.ts index 2cbbaef888ae..1d3485112fc3 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method-streamed/scenario.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method-streamed/scenario.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -9,11 +10,8 @@ Sentry.init({ transport: loggingTransport, }); -Sentry.startSpan( - { name: 'test_span', attributes: { [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }, - (span: Sentry.Span) => { - span.updateName('new name'); - }, -); +Sentry.startSpan({ name: 'test_span', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }, (span: Sentry.Span) => { + span.updateName('new name'); +}); void Sentry.flush(); diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method-streamed/test.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method-streamed/test.ts index 258c37d65b4c..fb913fb24559 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method-streamed/test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/node'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { afterAll, test } from 'vitest'; import { cleanupChildProcesses, createRunner } from '../../../../utils/runner'; @@ -17,7 +17,7 @@ test('updates the span name when calling `span.updateName` (streamed)', async () attributes: { // `updateName` marks the name as explicitly chosen, so the source becomes `custom`, // overriding the `url` source set at span start (a stale `url` no longer describes the name). - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'custom' }, + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'custom' }, }, }, ], diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method/scenario.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method/scenario.ts index 6223664b1603..803576fd46a7 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method/scenario.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method/scenario.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -9,9 +10,6 @@ Sentry.init({ transport: loggingTransport, }); -Sentry.startSpan( - { name: 'test_span', attributes: { [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }, - (span: Sentry.Span) => { - span.updateName('new name'); - }, -); +Sentry.startSpan({ name: 'test_span', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }, (span: Sentry.Span) => { + span.updateName('new name'); +}); diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method/test.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method/test.ts index 74c0f5b8f7ea..5db29cd032dc 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateName-method/test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/node'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { afterAll, expect, test } from 'vitest'; import { cleanupChildProcesses, createRunner } from '../../../../utils/runner'; @@ -18,7 +18,7 @@ test('updates the span name when calling `span.updateName`', async () => { trace: { span_id: expect.any(String), trace_id: expect.any(String), - data: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom' }, + data: { [SENTRY_SEGMENT_NAME_SOURCE]: 'custom' }, }, }, }, diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function-streamed/scenario.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function-streamed/scenario.ts index 93d653d107aa..cd85685fb5e6 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function-streamed/scenario.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function-streamed/scenario.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -9,11 +10,8 @@ Sentry.init({ transport: loggingTransport, }); -Sentry.startSpan( - { name: 'test_span', attributes: { [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }, - (span: Sentry.Span) => { - Sentry.updateSpanName(span, 'new name'); - }, -); +Sentry.startSpan({ name: 'test_span', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }, (span: Sentry.Span) => { + Sentry.updateSpanName(span, 'new name'); +}); void Sentry.flush(); diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function-streamed/test.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function-streamed/test.ts index ace2f0ca0d76..7479790f0c25 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function-streamed/test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/node'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { afterAll, test } from 'vitest'; import { cleanupChildProcesses, createRunner } from '../../../../utils/runner'; @@ -15,7 +15,7 @@ test('updates the span name and source when calling `updateSpanName` (streamed)' name: 'new name', is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { type: 'string', value: 'custom' }, + [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'custom' }, }, }, ], diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function/scenario.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function/scenario.ts index 3d1e0385bdd7..21aa4865c4aa 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function/scenario.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function/scenario.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -9,9 +10,6 @@ Sentry.init({ transport: loggingTransport, }); -Sentry.startSpan( - { name: 'test_span', attributes: { [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }, - (span: Sentry.Span) => { - Sentry.updateSpanName(span, 'new name'); - }, -); +Sentry.startSpan({ name: 'test_span', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }, (span: Sentry.Span) => { + Sentry.updateSpanName(span, 'new name'); +}); diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function/test.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function/test.ts index 49149d0ed7ec..0c8ae9ef706b 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/updateSpanName-function/test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/node'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { afterAll, expect, test } from 'vitest'; import { cleanupChildProcesses, createRunner } from '../../../../utils/runner'; @@ -16,7 +16,7 @@ test('updates the span name and source when calling `updateSpanName`', async () trace: { span_id: expect.any(String), trace_id: expect.any(String), - data: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom' }, + data: { [SENTRY_SEGMENT_NAME_SOURCE]: 'custom' }, }, }, }, diff --git a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-events.ts b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-events.ts index 3bf75d5e761a..be9bb6c12b5b 100644 --- a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-events.ts +++ b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-events.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -11,21 +12,18 @@ Sentry.init({ }); // eslint-disable-next-line @typescript-eslint/no-floating-promises -Sentry.startSpan( - { name: 'initial-name', attributes: { [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }, - async span => { - Sentry.captureMessage('message-1'); +Sentry.startSpan({ name: 'initial-name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }, async span => { + Sentry.captureMessage('message-1'); - span.updateName('updated-name-1'); - span.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + span.updateName('updated-name-1'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); - Sentry.captureMessage('message-2'); + Sentry.captureMessage('message-2'); - span.updateName('updated-name-2'); - span.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'custom'); + span.updateName('updated-name-2'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'custom'); - Sentry.captureMessage('message-3'); + Sentry.captureMessage('message-3'); - span.end(); - }, -); + span.end(); +}); diff --git a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-headers.ts b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-headers.ts index a83e73d18faf..4dfae58a9059 100644 --- a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-headers.ts +++ b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/scenario-headers.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -12,23 +13,20 @@ Sentry.init({ import * as http from 'http'; // eslint-disable-next-line @typescript-eslint/no-floating-promises -Sentry.startSpan( - { name: 'initial-name', attributes: { [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }, - async span => { - await makeHttpRequest(`${process.env.SERVER_URL}/api/v0`); +Sentry.startSpan({ name: 'initial-name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }, async span => { + await makeHttpRequest(`${process.env.SERVER_URL}/api/v0`); - span.updateName('updated-name-1'); - span.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + span.updateName('updated-name-1'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); - await makeHttpRequest(`${process.env.SERVER_URL}/api/v1`); + await makeHttpRequest(`${process.env.SERVER_URL}/api/v1`); - span.updateName('updated-name-2'); - span.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'custom'); - await makeHttpRequest(`${process.env.SERVER_URL}/api/v2`); + span.updateName('updated-name-2'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'custom'); + await makeHttpRequest(`${process.env.SERVER_URL}/api/v2`); - span.end(); - }, -); + span.end(); +}); function makeHttpRequest(url: string): Promise { return new Promise(resolve => { 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 00e6e552116f..eca137f87160 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_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -18,7 +19,7 @@ Sentry.startSpan( 'http.method': 'GET', 'http.route': '/route', [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }, }, () => { diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/scenario.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/scenario.ts index 09dbe516ce30..7cde093c1402 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_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; @@ -18,7 +19,7 @@ Sentry.startSpan( 'http.method': 'GET', 'http.route': '/route', [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.server', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }, () => { 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..8e0d97fdd026 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 @@ -19,7 +19,7 @@ describe('httpIntegration-streamed', () => { expect(serverSpan).toBeDefined(); expect(serverSpan?.is_segment).toBe(true); expect(serverSpan?.name).toBe('GET /test'); - expect(serverSpan?.attributes['sentry.source']).toEqual({ type: 'string', value: 'route' }); + expect(serverSpan?.attributes['sentry.segment.name.source']).toEqual({ type: 'string', value: 'route' }); expect(serverSpan?.attributes['sentry.segment.name.source']).toEqual({ type: 'string', value: 'route' }); }, }) 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 8357f50daa4c..e1646b2ca5e0 100644 --- a/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts @@ -91,7 +91,7 @@ describe('httpIntegration', () => { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.otel.http', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', [URL_FULL]: `http://localhost:${port}/test?a=1&b=2`, [URL_PATH]: '/test', ...getCommonHttpRequestHeaders(), @@ -138,7 +138,7 @@ describe('httpIntegration', () => { 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.otel.http', 'sentry.sample_rate': 1, - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', [URL_FULL]: `http://localhost:${port}/test?a=1&b=2`, [URL_PATH]: '/test', 'http.request.header.content_length': '9', diff --git a/packages/angular/test/tracing.test.ts b/packages/angular/test/tracing.test.ts index a460c5afb68a..b1ffa5451728 100644 --- a/packages/angular/test/tracing.test.ts +++ b/packages/angular/test/tracing.test.ts @@ -1,14 +1,9 @@ import type { ActivatedRouteSnapshot } from '@angular/router'; -import { - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - SentrySpan, - spanToJSON, -} from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentrySpan, spanToJSON } from '@sentry/core'; import { describe, it } from 'vitest'; import { browserTracingIntegration, init, TraceDirective } from '../src/index'; import { _updateSpanAttributesForParametrizedUrl, getParameterizedRouteFromSnapshot } from '../src/tracing'; -import { URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { expect } from 'vitest'; describe('browserTracingIntegration', () => { @@ -78,7 +73,7 @@ describe('Angular Tracing', () => { const route = '/users/:id/'; const url = '/users/123/'; const span = new SentrySpan({ name: 'initial-span-name' }); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'url'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'url'); _updateSpanAttributesForParametrizedUrl(route, url, span); @@ -86,7 +81,7 @@ describe('Angular Tracing', () => { expect.objectContaining({ attributes: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.undefined.angular', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: route, // URL_FULL is resolved against jsdom's http://localhost origin [URL_FULL]: expect.stringContaining('/users/123/'), @@ -103,7 +98,7 @@ describe('Angular Tracing', () => { const route = '/users/:id/'; const url = '/users/123/'; const span = new SentrySpan({ name: 'initial-span-name' }); - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'sample-source'); + span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'sample-source'); _updateSpanAttributesForParametrizedUrl(route, url, span); @@ -111,7 +106,7 @@ describe('Angular Tracing', () => { expect.objectContaining({ attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'sample-source', + [SENTRY_SEGMENT_NAME_SOURCE]: 'sample-source', }, name: 'initial-span-name', }), diff --git a/packages/astro/test/server/middleware.test.ts b/packages/astro/test/server/middleware.test.ts index 83c87ca09a22..7568d855f468 100644 --- a/packages/astro/test/server/middleware.test.ts +++ b/packages/astro/test/server/middleware.test.ts @@ -1,6 +1,6 @@ -import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; import type { Client, Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; + import * as SentryCore from '@sentry/core'; import * as SentryNode from '@sentry/node'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -119,7 +119,7 @@ describe('sentryMiddleware', () => { method: 'GET', [URL_FULL]: 'https://mydomain.io/users/123/details', [URL_PATH]: '/users/123/details', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SentryCore.SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD]: 'GET', 'http.route': '/users/[id]/details', }, @@ -157,7 +157,7 @@ describe('sentryMiddleware', () => { method: 'GET', [URL_FULL]: 'http://localhost:1234/a%xx', [URL_PATH]: 'a%xx', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SentryCore.SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD]: 'GET', }, name: 'GET a%xx', diff --git a/packages/browser/test/tracing/browserTracingIntegration.test.ts b/packages/browser/test/tracing/browserTracingIntegration.test.ts index 4273889340f5..a6e214503d30 100644 --- a/packages/browser/test/tracing/browserTracingIntegration.test.ts +++ b/packages/browser/test/tracing/browserTracingIntegration.test.ts @@ -11,7 +11,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, spanIsSampled, spanToJSON, @@ -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 { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; const oldTextEncoder = global.window.TextEncoder; const oldTextDecoder = global.window.TextDecoder; @@ -177,7 +176,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/', [URL_PATH]: '/', }, @@ -266,7 +265,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/', [URL_PATH]: '/', }, @@ -299,7 +298,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/test', [URL_PATH]: '/test', [PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE]: `${span?.spanContext().traceId}-${span?.spanContext().spanId}-1`, @@ -342,7 +341,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/test2', [URL_PATH]: '/test2', [PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE]: `${span2?.spanContext().traceId}-${span2?.spanContext().spanId}-1`, @@ -387,7 +386,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: 'https://example.com/', [URL_PATH]: '/', }, @@ -421,7 +420,6 @@ describe('browserTracingIntegration', () => { attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation.redirect', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.browser', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', [URL_FULL]: 'https://example.com/test', [URL_PATH]: '/test', }, @@ -482,7 +480,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [URL_FULL]: 'https://example.com/', [URL_PATH]: '/', }, @@ -558,7 +556,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [URL_FULL]: 'https://example.com/', [URL_PATH]: '/', testy: 'yes', @@ -726,14 +724,14 @@ describe('browserTracingIntegration', () => { startBrowserTracingPageLoadSpan(client, { name: 'test span', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }); const pageloadSpan = getActiveSpan(); expect(spanToJSON(pageloadSpan!).name).toBe('changed'); - expect(spanToJSON(pageloadSpan!).attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('custom'); + expect(spanToJSON(pageloadSpan!).attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('custom'); }); it('sets source to "custom" if name is changed in-place in beforeStartSpan', () => { @@ -758,14 +756,14 @@ describe('browserTracingIntegration', () => { startBrowserTracingPageLoadSpan(client, { name: 'test span', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }); const pageloadSpan = getActiveSpan(); expect(spanToJSON(pageloadSpan!).name).toBe('changed'); - expect(spanToJSON(pageloadSpan!).attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('custom'); + expect(spanToJSON(pageloadSpan!).attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('custom'); }); describe('startBrowserTracingNavigationSpan', () => { @@ -819,7 +817,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE]: expect.stringMatching(/[a-f0-9]{32}-[a-f0-9]{16}-1/), [URL_FULL]: 'https://example.com/', [URL_PATH]: '/', @@ -876,7 +874,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [URL_FULL]: 'https://example.com/', [URL_PATH]: '/', testy: 'yes', @@ -973,7 +971,7 @@ describe('browserTracingIntegration', () => { const pageloadSpan = getActiveSpan(); expect(spanToJSON(pageloadSpan!).name).toBe('changed'); - expect(spanToJSON(pageloadSpan!).attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('custom'); + expect(spanToJSON(pageloadSpan!).attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('custom'); }); it('sets the navigation span name on `scope.transactionName`', () => { @@ -1031,7 +1029,7 @@ describe('browserTracingIntegration', () => { const navigationSpan = startBrowserTracingNavigationSpan(client, { name: 'mySpan', - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route' }, + attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route' }, }); const propCtxBeforeEnd = getCurrentScope().getPropagationContext(); @@ -1073,7 +1071,7 @@ describe('browserTracingIntegration', () => { const navigationSpan = startBrowserTracingNavigationSpan(client, { name: 'mySpan', - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route' }, + attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route' }, }); const propCtxBeforeEnd = getCurrentScope().getPropagationContext(); diff --git a/packages/bun/test/integrations/bunserver.test.ts b/packages/bun/test/integrations/bunserver.test.ts index 70b053eea2ef..92ce85e21e5f 100644 --- a/packages/bun/test/integrations/bunserver.test.ts +++ b/packages/bun/test/integrations/bunserver.test.ts @@ -61,7 +61,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'GET', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.query': 'id=123', 'url.path': '/users', 'url.full': `http://localhost:${port}/users?id=123`, @@ -105,7 +105,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'POST', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/', 'url.full': `http://localhost:${port}/`, 'url.port': port.toString(), @@ -224,7 +224,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'POST', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/test', 'url.full': `http://localhost:${port}/api/test`, 'url.port': port.toString(), @@ -301,7 +301,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'GET', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/users/:id', 'url.path.parameter.id': '123', 'url.path': '/users/123', @@ -340,7 +340,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'GET', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/api/*', 'url.path': '/api/users/123', 'url.full': `http://localhost:${port}/api/users/123`, @@ -405,7 +405,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'GET', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/api/posts', }), op: 'http.server', @@ -442,7 +442,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'POST', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/api/posts', }), op: 'http.server', @@ -474,7 +474,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'PUT', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/api/posts', }), op: 'http.server', @@ -506,7 +506,7 @@ describe('Bun Serve Integration', () => { attributes: expect.objectContaining({ 'sentry.origin': 'auto.http.bun.serve', 'http.request.method': 'DELETE', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/api/posts', }), op: 'http.server', diff --git a/packages/cloudflare/test/instrumentations/worker/instrumentEmail.test.ts b/packages/cloudflare/test/instrumentations/worker/instrumentEmail.test.ts index ff524a76fa8f..c6879d04b035 100644 --- a/packages/cloudflare/test/instrumentations/worker/instrumentEmail.test.ts +++ b/packages/cloudflare/test/instrumentations/worker/instrumentEmail.test.ts @@ -265,7 +265,7 @@ describe('instrumentEmail', () => { 'sentry.op': 'function', 'faas.trigger': 'email', 'sentry.sample_rate': 1, - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', }, op: 'function', origin: 'auto.faas.cloudflare.email', diff --git a/packages/cloudflare/test/instrumentations/worker/instrumentQueue.test.ts b/packages/cloudflare/test/instrumentations/worker/instrumentQueue.test.ts index 66bf3077c39e..c322ea62331d 100644 --- a/packages/cloudflare/test/instrumentations/worker/instrumentQueue.test.ts +++ b/packages/cloudflare/test/instrumentations/worker/instrumentQueue.test.ts @@ -284,7 +284,7 @@ describe('instrumentQueue', () => { 'messaging.batch.message_count': batch.messages.length, 'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts - 1, 0), 'sentry.sample_rate': 1, - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', }, op: 'queue.process', origin: 'auto.faas.cloudflare.queue', diff --git a/packages/cloudflare/test/instrumentations/worker/instrumentScheduled.test.ts b/packages/cloudflare/test/instrumentations/worker/instrumentScheduled.test.ts index 2597441d249e..ef34e9bcdb0c 100644 --- a/packages/cloudflare/test/instrumentations/worker/instrumentScheduled.test.ts +++ b/packages/cloudflare/test/instrumentations/worker/instrumentScheduled.test.ts @@ -261,7 +261,7 @@ describe('instrumentScheduled', () => { 'faas.time': expect.any(String), 'faas.trigger': 'timer', 'sentry.sample_rate': 1, - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', }, op: 'function', origin: 'auto.faas.cloudflare.scheduled', diff --git a/packages/cloudflare/test/opentelemetry.test.ts b/packages/cloudflare/test/opentelemetry.test.ts index 68726f824139..574e935ff5a7 100644 --- a/packages/cloudflare/test/opentelemetry.test.ts +++ b/packages/cloudflare/test/opentelemetry.test.ts @@ -77,7 +77,7 @@ describe('opentelemetry compatibility', () => { expect(transactionEvent?.contexts?.trace?.data).toEqual({ 'sentry.origin': 'manual', 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }); expect(transactionEvent2?.spans?.length).toBe(1); @@ -85,7 +85,7 @@ describe('opentelemetry compatibility', () => { expect(transactionEvent2?.contexts?.trace?.data).toEqual({ 'sentry.origin': 'manual', 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'test.attribute': 'test', }); @@ -131,7 +131,7 @@ describe('opentelemetry compatibility', () => { expect(transactionEvent?.contexts?.trace?.data).toEqual({ 'sentry.origin': 'manual', 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }); expect(transactionEvent?.spans).toEqual([ diff --git a/packages/cloudflare/test/request.test.ts b/packages/cloudflare/test/request.test.ts index 44587f6224de..c678512c4557 100644 --- a/packages/cloudflare/test/request.test.ts +++ b/packages/cloudflare/test/request.test.ts @@ -594,7 +594,7 @@ describe('withSentry', () => { data: { 'sentry.origin': 'auto.http.cloudflare', 'sentry.op': 'http.server', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'http.request.method': 'GET', 'url.full': 'https://example.com/', 'server.address': 'example.com', diff --git a/packages/cloudflare/test/workflow.test.ts b/packages/cloudflare/test/workflow.test.ts index 2578c1e0343d..2b05f8bb5b5d 100644 --- a/packages/cloudflare/test/workflow.test.ts +++ b/packages/cloudflare/test/workflow.test.ts @@ -160,7 +160,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { data: expect.objectContaining({ 'sentry.origin': 'auto.faas.cloudflare.workflow', 'sentry.op': 'function', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', 'sentry.sample_rate': 1, }), op: 'function', @@ -406,7 +406,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { data: expect.objectContaining({ 'sentry.origin': 'auto.faas.cloudflare.workflow', 'sentry.op': 'function', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', 'sentry.sample_rate': 1, }), op: 'function', @@ -483,7 +483,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { data: expect.objectContaining({ 'sentry.origin': 'auto.faas.cloudflare.workflow', 'sentry.op': 'function', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', 'sentry.sample_rate': 1, }), op: 'function', @@ -526,7 +526,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { data: expect.objectContaining({ 'sentry.origin': 'auto.faas.cloudflare.workflow', 'sentry.op': 'function', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', 'sentry.sample_rate': 1, }), op: 'function', 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 f957422885b0..609cd7b343a3 100644 --- a/packages/core/test/lib/integrations/http/server-subscription.test.ts +++ b/packages/core/test/lib/integrations/http/server-subscription.test.ts @@ -124,7 +124,7 @@ describe('getHttpServerSubscriptions', () => { 'sentry.kind': 'server', 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.server', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', [URL_FULL]: expect.stringMatching(/\/users\/42\?foo=bar$/), [URL_PATH]: '/users/42', [SERVER_ADDRESS]: '127.0.0.1', 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 d90fe023f89e..b2515888e073 100644 --- a/packages/core/test/lib/integrations/mcp-server/semanticConventions.test.ts +++ b/packages/core/test/lib/integrations/mcp-server/semanticConventions.test.ts @@ -62,7 +62,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.request.argument.location': '"Seattle, WA"', 'sentry.op': 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }); }); @@ -94,7 +94,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.request.argument.uri': '"file:///docs/api.md"', 'sentry.op': 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }); }); @@ -126,7 +126,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.request.argument.name': '"analyze-code"', 'sentry.op': 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }); }); @@ -154,7 +154,7 @@ describe('MCP Server Semantic Conventions', () => { 'network.protocol.version': '2.0', 'sentry.op': 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, expect.any(Function), @@ -194,7 +194,7 @@ describe('MCP Server Semantic Conventions', () => { // Sentry-specific 'sentry.op': 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), }), ); @@ -231,7 +231,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.logging.message': 'Addition completed: 2 + 5 = 7', 'sentry.op': 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, expect.any(Function), @@ -262,7 +262,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.cancelled.reason': 'user_requested', 'sentry.op': 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), }), expect.any(Function), @@ -296,7 +296,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.progress.message': 'Processing files...', 'sentry.op': 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), }), expect.any(Function), @@ -324,7 +324,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.resource.protocol': 'file', 'sentry.op': 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), }), expect.any(Function), @@ -348,7 +348,7 @@ describe('MCP Server Semantic Conventions', () => { 'mcp.method.name': 'notifications/tools/list_changed', 'sentry.op': 'mcp.notification.server_to_client', 'sentry.origin': 'auto.mcp.notification', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), }), expect.any(Function), 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 92fec69f90bf..ebc0e591e8ad 100644 --- a/packages/core/test/lib/integrations/mcp-server/transportInstrumentation.test.ts +++ b/packages/core/test/lib/integrations/mcp-server/transportInstrumentation.test.ts @@ -283,7 +283,7 @@ describe('MCP Server Transport Instrumentation', () => { 'mcp.request.argument.path': '"/tmp/data.txt"', 'sentry.op': 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }); }); @@ -435,7 +435,7 @@ describe('MCP Server Transport Instrumentation', () => { 'mcp.request.argument.input': '"test"', 'sentry.op': 'mcp.server', 'sentry.origin': 'auto.function.mcp_server', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), }); }); @@ -884,7 +884,7 @@ describe('MCP Server Transport Instrumentation', () => { 'mcp.method.name': 'notifications/tools/list_changed', 'sentry.op': 'mcp.notification.client_to_server', 'sentry.origin': 'auto.mcp.notification', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }, }, expect.any(Function), diff --git a/packages/core/test/lib/tracing/dynamicSamplingContext.test.ts b/packages/core/test/lib/tracing/dynamicSamplingContext.test.ts index 34a0f1bcd55c..acca0d540088 100644 --- a/packages/core/test/lib/tracing/dynamicSamplingContext.test.ts +++ b/packages/core/test/lib/tracing/dynamicSamplingContext.test.ts @@ -3,7 +3,6 @@ import { getClient, registerExternalPropagationContext, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '../../../src'; import { DEFAULT_ENVIRONMENT } from '../../../src/constants'; @@ -19,6 +18,7 @@ import { freezeDscOnSpan, getDynamicSamplingContextFromClient } from '../../../s import type { Span, SpanContextData } from '../../../src/types/span'; import type { TransactionSource } from '../../../src/types/transaction'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; describe('getDynamicSamplingContextFromSpan', () => { beforeEach(() => { @@ -105,7 +105,7 @@ describe('getDynamicSamplingContextFromSpan', () => { // Setting the attribute should overwrite the computed values rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, 0.56); - rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + rootSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, 'route'); const dynamicSamplingContext = getDynamicSamplingContextFromSpan(rootSpan); @@ -147,7 +147,7 @@ describe('getDynamicSamplingContextFromSpan', () => { name: 'tx', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 0.56, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }, sampled: true, }); @@ -172,7 +172,7 @@ describe('getDynamicSamplingContextFromSpan', () => { const rootSpan = new SentrySpan({ name: 'tx', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 0.56, }, }); @@ -188,11 +188,11 @@ describe('getDynamicSamplingContextFromSpan', () => { const rootSpan = startInactiveSpan({ name: 'tx', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source, + [SENTRY_SEGMENT_NAME_SOURCE]: source, }, }); - rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source); + rootSpan.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, source); const dsc = getDynamicSamplingContextFromSpan(rootSpan); diff --git a/packages/core/test/lib/tracing/idleSpan.test.ts b/packages/core/test/lib/tracing/idleSpan.test.ts index 4dbe2236f42d..db5ce74667a4 100644 --- a/packages/core/test/lib/tracing/idleSpan.test.ts +++ b/packages/core/test/lib/tracing/idleSpan.test.ts @@ -8,7 +8,6 @@ import { getIsolationScope, getTraceData, SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE, SentryNonRecordingSpan, SentrySpan, @@ -24,6 +23,7 @@ import type { Event } from '../../../src/types/event'; import type { Span } from '../../../src/types/span'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; import { resetGlobals } from '../../testutils'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; const dsn = 'https://123@sentry.io/42'; @@ -179,7 +179,7 @@ describe('startIdleSpan', () => { // Mirrors a browser pageload/navigation span, whose name is the URL path. const idleSpan = startIdleSpan({ name: '/users/123e4567-e89b-12d3-a456-426614174000', - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' }, + attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' }, }); expect(idleSpan).toBeInstanceOf(SentryNonRecordingSpan); diff --git a/packages/core/test/lib/tracing/sentrySpan.test.ts b/packages/core/test/lib/tracing/sentrySpan.test.ts index 8263401cee25..a38ebe5c1ffe 100644 --- a/packages/core/test/lib/tracing/sentrySpan.test.ts +++ b/packages/core/test/lib/tracing/sentrySpan.test.ts @@ -4,7 +4,6 @@ import { setCurrentClient } from '../../../src/sdk'; import { SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '../../../src/semanticAttributes'; import { SentrySpan } from '../../../src/tracing/sentrySpan'; import { SPAN_STATUS_ERROR } from '../../../src/tracing/spanstatus'; @@ -16,6 +15,7 @@ import type { Span, SpanJSON } from '../../../src/types/span'; import { getRootSpan, spanToStaticSpanJSON, TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED } from '../../../src/utils/spanUtils'; import { timestampInSeconds } from '../../../src/utils/time'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; function childSpansOf(span: Span): Set { return (span as unknown as { _sentryChildSpans?: Set })._sentryChildSpans ?? new Set(); @@ -40,14 +40,14 @@ describe('SentrySpan', () => { it('sets the source to custom when calling updateName', () => { const span = new SentrySpan({ name: 'original name', - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' }, + attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' }, }); span.updateName('new name'); const spanJson = spanToStaticSpanJSON(span); expect(spanJson.description).toEqual('new name'); - expect(spanJson.data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toEqual('custom'); + expect(spanJson.data[SENTRY_SEGMENT_NAME_SOURCE]).toEqual('custom'); }); it('sets the source to custom when calling updateName on a span without a source', () => { diff --git a/packages/core/test/lib/tracing/spans/captureSpan.test.ts b/packages/core/test/lib/tracing/spans/captureSpan.test.ts index 93d029f6a206..90b6dd3f2145 100644 --- a/packages/core/test/lib/tracing/spans/captureSpan.test.ts +++ b/packages/core/test/lib/tracing/spans/captureSpan.test.ts @@ -9,7 +9,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_RELEASE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SDK_INTEGRATIONS, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_USER_EMAIL, SEMANTIC_ATTRIBUTE_USER_ID, SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS, @@ -28,10 +27,11 @@ import { scopeContextsToSpanAttributes } from '../../../../src/tracing/spans/sco import type { TestClientOptions } from '../../../mocks/client'; import { getDefaultTestClientOptions, TestClient } from '../../../mocks/client'; import { - SENTRY_SEGMENT_ID, - SENTRY_SEGMENT_NAME, SENTRY_SDK_NAME, SENTRY_SDK_VERSION, + SENTRY_SEGMENT_ID, + SENTRY_SEGMENT_NAME, + SENTRY_SEGMENT_NAME_SOURCE, SENTRY_TRACE_LIFECYCLE, } from '@sentry/conventions/attributes'; @@ -101,7 +101,7 @@ describe('captureSpan', () => { value: 'custom', type: 'string', }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { + [SENTRY_SEGMENT_NAME_SOURCE]: { value: 'custom', type: 'string', }, @@ -201,7 +201,7 @@ describe('captureSpan', () => { value: 'custom', type: 'string', }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { + [SENTRY_SEGMENT_NAME_SOURCE]: { value: 'custom', type: 'string', }, @@ -301,7 +301,7 @@ describe('captureSpan', () => { value: 'custom', type: 'string', }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { + [SENTRY_SEGMENT_NAME_SOURCE]: { value: 'custom', type: 'string', }, @@ -368,7 +368,7 @@ describe('captureSpan', () => { [SENTRY_SEGMENT_NAME]: { value: 'my-span', type: 'string' }, [SENTRY_SEGMENT_ID]: { value: span.spanContext().spanId, type: 'string' }, ['sentry.segment.name.source']: { value: 'custom', type: 'string' }, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: { value: 'custom', type: 'string' }, + [SENTRY_SEGMENT_NAME_SOURCE]: { value: 'custom', type: 'string' }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { value: '1.0.0', type: 'string' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { value: 'staging', type: 'string' }, [SENTRY_SDK_NAME]: { value: 'sentry.javascript.browser', type: 'string' }, diff --git a/packages/core/test/lib/tracing/trace.test.ts b/packages/core/test/lib/tracing/trace.test.ts index 2157cd154429..e36effb86317 100644 --- a/packages/core/test/lib/tracing/trace.test.ts +++ b/packages/core/test/lib/tracing/trace.test.ts @@ -8,7 +8,6 @@ import { Scope, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setAsyncContextStrategy, setCurrentClient, spanToJSON, @@ -34,6 +33,7 @@ import { getActiveSpan, getRootSpan, getSpanDescendants, spanIsSampled } from '. import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; import { SUPPRESS_TRACING_KEY } from '../../../src/tracing/constants'; import { resetGlobals } from '../../testutils'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; const enum Type { Sync = 'sync', @@ -196,7 +196,7 @@ describe('startSpan', () => { attributes: { 'sentry.origin': 'auto.http.browser', 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', ...(isError && { 'sentry.status.message': 'internal_error' }), }, name: 'GET users/[id]', @@ -289,7 +289,7 @@ describe('startSpan', () => { const span = startSpan( { name: '/users/123e4567-e89b-12d3-a456-426614174000', - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' }, + attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' }, }, span => span, ); @@ -564,7 +564,7 @@ describe('startSpan', () => { expect(outerTransaction?.contexts).toEqual({ trace: { data: { - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, @@ -590,7 +590,7 @@ describe('startSpan', () => { expect(innerTransaction?.contexts).toEqual({ trace: { data: { - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, @@ -782,27 +782,6 @@ describe('startSpan', () => { }); }); - it('passes a `sentry.op` attribute to the tracesSampler when `op` is set', () => { - tracesSampler.mockReturnValueOnce(true); - - const options = getDefaultTestClientOptions({ tracesSampler }); - client = new TestClient(options); - setCurrentClient(client); - client.init(); - - startSpan({ name: 'outer', op: 'test.op', attributes: { test1: 'aa' } }, () => {}); - - expect(tracesSampler).toHaveBeenLastCalledWith({ - parentSampled: undefined, - name: 'outer', - attributes: { - 'sentry.op': 'test.op', - test1: 'aa', - }, - inheritOrSampleWith: expect.any(Function), - }); - }); - it.each([false, 0])('returns a negative sampling decision if tracesSampler returns %s', tracesSamplerResult => { tracesSampler.mockReturnValueOnce(tracesSamplerResult); @@ -1165,7 +1144,7 @@ describe('startSpanManual', () => { expect(outerTransaction?.contexts).toEqual({ trace: { data: { - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, @@ -1191,7 +1170,7 @@ describe('startSpanManual', () => { expect(innerTransaction?.contexts).toEqual({ trace: { data: { - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, @@ -1628,7 +1607,7 @@ describe('startInactiveSpan', () => { expect(outerTransaction?.contexts).toEqual({ trace: { data: { - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, @@ -1654,7 +1633,7 @@ describe('startInactiveSpan', () => { expect(innerTransaction?.contexts).toEqual({ trace: { data: { - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, diff --git a/packages/core/test/lib/trpc.test.ts b/packages/core/test/lib/trpc.test.ts index 15c445bdd99c..9d476605152d 100644 --- a/packages/core/test/lib/trpc.test.ts +++ b/packages/core/test/lib/trpc.test.ts @@ -22,6 +22,7 @@ describe('trpcMiddleware', () => { const mockSpan = { end: vi.fn(), + setAttribute: vi.fn(), } as unknown as Span; const mockScope = { @@ -62,7 +63,6 @@ describe('trpcMiddleware', () => { attributes: { 'sentry.op': 'rpc', 'sentry.origin': 'auto.rpc.trpc', - 'sentry.source': 'route', 'rpc.system.name': 'trpc', 'rpc.method': 'test.procedure', 'trpc.procedure_path': 'test.procedure', @@ -74,6 +74,15 @@ describe('trpcMiddleware', () => { ); }); + test('sets the segment name source when the tRPC span is the segment', async () => { + const middleware = trpcMiddleware(); + const next = vi.fn().mockResolvedValue({ ok: true }); + + await middleware({ path: 'test.procedure', type: 'query', next }); + + expect(mockSpan.setAttribute).toHaveBeenCalledWith('sentry.segment.name.source', 'route'); + }); + test('captures error when next() returns error result', async () => { const middleware = trpcMiddleware(); const error = new Error('Test error'); diff --git a/packages/core/test/lib/utils/spanUtils.test.ts b/packages/core/test/lib/utils/spanUtils.test.ts index 1bf33e490207..c31d4e432b97 100644 --- a/packages/core/test/lib/utils/spanUtils.test.ts +++ b/packages/core/test/lib/utils/spanUtils.test.ts @@ -5,7 +5,6 @@ import { Scope, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_STATUS_MESSAGE, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE, SentryNonRecordingSpan, @@ -42,6 +41,7 @@ import { updateSpanName, } from '../../../src/utils/spanUtils'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; function createMockedOtelSpan({ spanId, @@ -942,10 +942,10 @@ describe('addChildSpanToSpan', () => { describe('updateSpanName', () => { it('updates the span name and source', () => { - const span = new SentrySpan({ name: 'old-name', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }); + const span = new SentrySpan({ name: 'old-name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }); updateSpanName(span, 'new-name'); const spanJSON = spanToJSON(span); expect(spanJSON.name).toBe('new-name'); - expect(spanJSON.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('custom'); + expect(spanJSON.attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('custom'); }); }); diff --git a/packages/core/test/lib/utils/url.test.ts b/packages/core/test/lib/utils/url.test.ts index 9f42966b5625..ad073e49a393 100644 --- a/packages/core/test/lib/utils/url.test.ts +++ b/packages/core/test/lib/utils/url.test.ts @@ -427,12 +427,22 @@ describe('getSanitizedUrlStringFromUrlObject', () => { }); describe('getHttpSpanDetailsFromUrlObject', () => { + it.each([ + ['no route name', undefined], + ['a route name', '/api/users/:id'], + ])('does not set a segment name source on client spans with %s', (_, routeName) => { + const urlObject = parseStringToURLObject('https://example.com/api/users/1')!; + const [, attributes] = getHttpSpanDetailsFromUrlObject(urlObject, 'client', 'test-origin', undefined, routeName); + + expect(attributes).not.toHaveProperty('sentry.segment.name.source'); + }); + it('handles undefined URL object', () => { const [name, attributes] = getHttpSpanDetailsFromUrlObject(undefined, 'server', 'test-origin'); expect(name).toBe('GET /'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', }); }); @@ -442,7 +452,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/users', 'url.full': '/api/users', }); @@ -454,7 +464,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/users', 'url.query': 'q=test', 'url.fragment': 'section', @@ -470,7 +480,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('POST /api/users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/users', 'url.full': 'https://example.com/api/users', 'server.address': 'example.com', @@ -491,7 +501,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/users/:id'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/api/users', 'url.full': 'https://example.com/api/users', 'server.address': 'example.com', @@ -506,7 +516,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/', 'url.full': 'https://example.com/', 'server.address': 'example.com', @@ -520,7 +530,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/users', 'url.full': 'https://example.com:8080/api/users', 'server.address': 'example.com', @@ -535,7 +545,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('PUT /api/users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/users', 'url.full': 'https://example.com:3000/api/users', 'server.address': 'example.com', @@ -557,7 +567,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('PATCH /api/users/:id'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/api/users/123', 'url.full': 'https://example.com/api/users/123', 'server.address': 'example.com', @@ -579,7 +589,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/search'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/api/search', 'url.query': 'q=test&page=1', 'url.full': 'https://example.com/api/search?q=test&page=1', @@ -601,7 +611,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/docs'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.path': '/api/docs', 'url.fragment': 'section-1', 'url.full': 'https://example.com/api/docs#section-1', @@ -617,7 +627,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/users', 'url.full': 'https://user:pass@example.com/api/users', 'server.address': 'example.com', @@ -631,7 +641,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/users', 'url.full': 'https://192.168.1.1:8080/api/users', 'server.address': '192.168.1.1', @@ -646,7 +656,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /api/users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/api/users', 'url.full': 'https://[2001:db8::1]:8080/api/users', 'server.address': '[2001:db8::1]', @@ -661,7 +671,7 @@ describe('getHttpSpanDetailsFromUrlObject', () => { expect(name).toBe('GET /users'); expect(attributes).toEqual({ 'sentry.origin': 'test-origin', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/users', 'url.full': 'https://api.example.com/users', 'server.address': 'api.example.com', diff --git a/packages/deno/test/opentelemetry.test.ts b/packages/deno/test/opentelemetry.test.ts index 0af5adc99d22..12349ea6a78a 100644 --- a/packages/deno/test/opentelemetry.test.ts +++ b/packages/deno/test/opentelemetry.test.ts @@ -88,14 +88,14 @@ Deno.test('should capture spans emitted via @opentelemetry/api', async () => { assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.deno_tracer'], true); assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.origin'], 'manual'); assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.sample_rate'], 1); - assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.source'], 'custom'); + assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.segment.name.source'], 'custom'); assertEquals(transactionEvent2?.spans?.length, 1); assertEquals(transactionEvent2?.transaction, 'test 2'); assertEquals(transactionEvent2?.contexts?.trace?.data?.['sentry.deno_tracer'], true); assertEquals(transactionEvent2?.contexts?.trace?.data?.['sentry.origin'], 'manual'); assertEquals(transactionEvent2?.contexts?.trace?.data?.['sentry.sample_rate'], 1); - assertEquals(transactionEvent2?.contexts?.trace?.data?.['sentry.source'], 'custom'); + assertEquals(transactionEvent2?.contexts?.trace?.data?.['sentry.segment.name.source'], 'custom'); assertEquals(transactionEvent2?.contexts?.trace?.data?.['test.attribute'], 'test'); const childSpan = transactionEvent2?.spans?.[0]; @@ -135,7 +135,7 @@ Deno.test('opentelemetry spans should interop with Sentry spans', async () => { assertEquals(transactionEvent?.transaction, 'sentry span'); assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.origin'], 'manual'); assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.sample_rate'], 1); - assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.source'], 'custom'); + assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.segment.name.source'], 'custom'); // Note: Sentry-created spans don't have the deno_tracer marker assertEquals(transactionEvent?.contexts?.trace?.data?.['sentry.deno_tracer'], undefined); diff --git a/packages/elysia/test/withElysia.test.ts b/packages/elysia/test/withElysia.test.ts index 751a8175be33..db42a65d3fe4 100644 --- a/packages/elysia/test/withElysia.test.ts +++ b/packages/elysia/test/withElysia.test.ts @@ -34,6 +34,7 @@ const mockGetClient = vi.fn(() => ({ on: vi.fn(), })); const mockRootSpan = { + setAttribute: vi.fn(), setAttributes: vi.fn(), updateName: vi.fn(), }; @@ -109,7 +110,7 @@ describe('withElysia', () => { }); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', [HTTP_ROUTE]: '/users/:id', }); }); diff --git a/packages/ember/tests/instrument-route-performance.test.ts b/packages/ember/tests/instrument-route-performance.test.ts index bbd2db964a13..3f0bee0321fb 100644 --- a/packages/ember/tests/instrument-route-performance.test.ts +++ b/packages/ember/tests/instrument-route-performance.test.ts @@ -7,7 +7,6 @@ vi.mock('@sentry/browser', () => ({ })); vi.mock('@sentry/core', () => ({ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', })); describe('instrumentRoutePerformance', () => { diff --git a/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts b/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts index c71d83a6b684..444177ac1beb 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts @@ -1,6 +1,6 @@ -import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { wrapCloudEventFunction } from '../../src/gcpfunction/cloud_events'; import type { CloudEventFunction, CloudEventFunctionWithCallback } from '../../src/gcpfunction/general'; @@ -78,7 +78,7 @@ describe('wrapCloudEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'cloud_event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', }, }; @@ -104,7 +104,7 @@ describe('wrapCloudEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'cloud_event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', }, }; @@ -131,7 +131,7 @@ describe('wrapCloudEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'cloud_event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', }, }; @@ -169,7 +169,7 @@ describe('wrapCloudEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'cloud_event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', }, }; @@ -207,7 +207,7 @@ describe('wrapCloudEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'cloud_event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', }, }; @@ -230,7 +230,7 @@ describe('wrapCloudEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'cloud_event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', }, }; @@ -267,7 +267,7 @@ describe('wrapCloudEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'cloud_event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', }, }; diff --git a/packages/google-cloud-serverless/test/gcpfunction/events.test.ts b/packages/google-cloud-serverless/test/gcpfunction/events.test.ts index a01eed799e95..1845b60de5ed 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/events.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/events.test.ts @@ -1,7 +1,7 @@ -import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { Event } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { wrapEventFunction } from '../../src/gcpfunction/events'; import type { EventFunction, EventFunctionWithCallback } from '../../src/gcpfunction/general'; @@ -74,7 +74,7 @@ describe('wrapEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', }, }; @@ -97,7 +97,7 @@ describe('wrapEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', }, }; @@ -125,7 +125,7 @@ describe('wrapEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', }, }; @@ -152,7 +152,7 @@ describe('wrapEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', }, }; @@ -177,7 +177,7 @@ describe('wrapEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', }, }; @@ -200,7 +200,7 @@ describe('wrapEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', }, }; @@ -224,7 +224,7 @@ describe('wrapEventFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'event', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', }, }; diff --git a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts index 77e9c28516b7..cd99090faf91 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts @@ -1,7 +1,7 @@ -import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { Integration } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { beforeEach, describe, expect, type MockInstance, test, vi } from 'vitest'; import type { HttpFunction, Request, Response } from '../../src/gcpfunction/general'; import { wrapHttpFunction } from '../../src/gcpfunction/http'; @@ -97,7 +97,7 @@ describe('GCPFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'http', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', }, }; @@ -121,7 +121,7 @@ describe('GCPFunction', () => { attributes: { [SENTRY_OP]: FUNCTION_GCP, [FAAS_TRIGGER]: 'http', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', }, }; diff --git a/packages/nextjs/test/common/enhanceMiddlewareRootSpan.test.ts b/packages/nextjs/test/common/enhanceMiddlewareRootSpan.test.ts index 3a76ff9bff8e..019d9274d120 100644 --- a/packages/nextjs/test/common/enhanceMiddlewareRootSpan.test.ts +++ b/packages/nextjs/test/common/enhanceMiddlewareRootSpan.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { describe, expect, it } from 'vitest'; import { enhanceMiddlewareRootSpan } from '../../src/common/enhanceMiddlewareRootSpan'; import { ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../../src/common/nextSpanAttributes'; @@ -19,7 +19,7 @@ function makeSpan(attributes: Record, name?: string) { }, getName: () => currentName, getOp: () => currentOp, - getSource: () => attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE], + getSource: () => attributes[SENTRY_SEGMENT_NAME_SOURCE], }; } @@ -106,7 +106,7 @@ describe('enhanceMiddlewareRootSpan', () => { { [ATTR_NEXT_SPAN_TYPE]: 'Middleware.execute', [ATTR_NEXT_SPAN_NAME]: 'middleware GET /foo', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, 'middleware GET /foo', ); diff --git a/packages/nextjs/test/common/liveRootSpanAdapter.test.ts b/packages/nextjs/test/common/liveRootSpanAdapter.test.ts index b424150a8fe0..cd2f7a9fcac3 100644 --- a/packages/nextjs/test/common/liveRootSpanAdapter.test.ts +++ b/packages/nextjs/test/common/liveRootSpanAdapter.test.ts @@ -1,9 +1,5 @@ -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - SentrySpan, - spanToStaticSpanJSON, -} from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SentrySpan, spanToStaticSpanJSON } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { createLiveRootSpanAdapter } from '../../src/common/utils/liveRootSpanAdapter'; @@ -22,7 +18,7 @@ describe('createLiveRootSpanAdapter', () => { it('renames the span without stamping source=custom (preserves an existing source)', () => { const span = new SentrySpan({ name: 'original', - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route' }, + attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'route' }, }); const adapter = createLiveRootSpanAdapter(span); @@ -31,7 +27,7 @@ describe('createLiveRootSpanAdapter', () => { const json = spanToStaticSpanJSON(span); expect(json.description).toBe('GET /users/[id]'); // `span.updateName` would normally set source to `custom`; the adapter must keep `route`. - expect(json.data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('route'); + expect(json.data[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route'); }); it('does not introduce a source when the span has none', () => { @@ -42,6 +38,6 @@ describe('createLiveRootSpanAdapter', () => { const json = spanToStaticSpanJSON(span); expect(json.description).toBe('GET /users'); - expect(json.data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBeUndefined(); + expect(json.data[SENTRY_SEGMENT_NAME_SOURCE]).toBeUndefined(); }); }); diff --git a/packages/nextjs/test/edge/enhanceRunHandlerRootSpan.test.ts b/packages/nextjs/test/edge/enhanceRunHandlerRootSpan.test.ts index 3d8b1da8de74..1cf9f9e0d358 100644 --- a/packages/nextjs/test/edge/enhanceRunHandlerRootSpan.test.ts +++ b/packages/nextjs/test/edge/enhanceRunHandlerRootSpan.test.ts @@ -1,5 +1,5 @@ -import { HTTP_REQUEST_METHOD } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_REQUEST_METHOD } from '@sentry/conventions/attributes'; + import { describe, expect, it } from 'vitest'; import { enhanceRunHandlerRootSpan } from '../../src/edge/enhanceRunHandlerRootSpan'; import { ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../../src/common/nextSpanAttributes'; @@ -34,7 +34,7 @@ describe('enhanceRunHandlerRootSpan', () => { expect(getName()).toBe('middleware GET'); expect(getOp()).toBeUndefined(); - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBeUndefined(); + expect(span.attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBeUndefined(); }); it('does nothing when the span name is not a pages api route', () => { @@ -63,7 +63,7 @@ describe('enhanceRunHandlerRootSpan', () => { expect(getName()).toBe('POST /api/edge-endpoint'); expect(getOp()).toBe('http.server'); - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('route'); + expect(span.attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route'); }); it('falls back to GET when no http method attribute is present', () => { diff --git a/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts b/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts index c735cacfa7f0..356d7d3db092 100644 --- a/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts +++ b/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts @@ -128,7 +128,7 @@ describe('pagesRouterInstrumentPageLoad', () => { attributes: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', [URL_TEMPLATE]: '/[user]/posts/[id]', user: 'chargome', id: '1337', @@ -152,7 +152,7 @@ describe('pagesRouterInstrumentPageLoad', () => { attributes: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', [URL_TEMPLATE]: '/some-page', }, }, @@ -168,7 +168,7 @@ describe('pagesRouterInstrumentPageLoad', () => { attributes: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', [URL_TEMPLATE]: '/', }, }, @@ -184,7 +184,7 @@ describe('pagesRouterInstrumentPageLoad', () => { attributes: { 'sentry.op': 'pageload', 'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', }, }, ], @@ -334,7 +334,7 @@ describe('pagesRouterInstrumentNavigation', () => { attributes: { 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.nextjs.pages_router_instrumentation', - 'sentry.source': expectedTransactionSource, + 'sentry.segment.name.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 de4b8c7f6f15..c25f9d79e650 100644 --- a/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts +++ b/packages/nextjs/test/server/enhanceHandleRequestRootSpan.test.ts @@ -1,5 +1,10 @@ -import { HTTP_RESPONSE_STATUS_CODE, HTTP_ROUTE, HTTP_STATUS_CODE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + HTTP_RESPONSE_STATUS_CODE, + HTTP_ROUTE, + HTTP_STATUS_CODE, +} from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { ATTR_NEXT_ROUTE, ATTR_NEXT_SPAN_NAME, ATTR_NEXT_SPAN_TYPE } from '../../src/common/nextSpanAttributes'; import { TRANSACTION_ATTR_SENTRY_ROUTE_BACKFILL } from '../../src/common/span-attributes-with-logic-attached'; @@ -47,7 +52,7 @@ describe('enhanceHandleRequestRootSpan', () => { expect(getOp()).toBe('http.server'); expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]).toBe('http.server'); expect(getName()).toBe('GET /api/users/[id]'); - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('route'); + expect(span.attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route'); expect(span.attributes[ATTR_NEXT_ROUTE]).toBe('/api/users/[id]'); expect(span.attributes[HTTP_ROUTE]).toBe('/api/users/[id]'); }); @@ -138,7 +143,7 @@ describe('enhanceHandleRequestRootSpan', () => { expect(getName()).toBe('GET /posts/[slug]'); expect(span.attributes[HTTP_ROUTE]).toBe('/posts/[slug]'); - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('route'); + expect(span.attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route'); }); it('does not apply the backfill for the special GET /_app transaction', () => { @@ -169,7 +174,7 @@ describe('enhanceHandleRequestRootSpan', () => { expect(getName()).toBe('middleware POST'); expect(getOp()).toBe('middleware'); - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toBe('route'); + expect(span.attributes[SENTRY_SEGMENT_NAME_SOURCE]).toBe('route'); }); it('writes the middleware op into attributes when the adapter mirrors op writes (streamed shape)', () => { diff --git a/packages/node/test/integration/scope.test.ts b/packages/node/test/integration/scope.test.ts index 56d5fba1d0d3..0572224bc360 100644 --- a/packages/node/test/integration/scope.test.ts +++ b/packages/node/test/integration/scope.test.ts @@ -106,7 +106,7 @@ describe('Integration | Scope', () => { trace: { data: { 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'sentry.sample_rate': 1, }, span_id: spanId, diff --git a/packages/node/test/integration/transactions.test.ts b/packages/node/test/integration/transactions.test.ts index bdf22083aa30..a4bf5e3281ff 100644 --- a/packages/node/test/integration/transactions.test.ts +++ b/packages/node/test/integration/transactions.test.ts @@ -1,6 +1,7 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { context, trace, TraceFlags } from '@opentelemetry/api'; import type { ErrorEvent, TransactionEvent } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import * as Sentry from '../../src'; import { cleanupOtel, mockSdkInit } from '../helpers/mockSdkInit'; @@ -36,7 +37,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', }, }, @@ -77,7 +78,7 @@ describe('Integration | Transactions', () => { data: { 'sentry.op': 'test op', 'sentry.origin': 'auto.test', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', 'sentry.sample_rate': 1, 'test.outer': 'test value', }, @@ -166,7 +167,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', }, }, @@ -231,7 +232,7 @@ describe('Integration | Transactions', () => { data: { 'sentry.op': 'test op', 'sentry.origin': 'auto.test', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', 'test.outer': 'test value', 'sentry.sample_rate': 1, }, @@ -269,7 +270,7 @@ describe('Integration | Transactions', () => { data: { 'sentry.op': 'test op b', 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'test.outer': 'test value b', 'sentry.sample_rate': 1, }, @@ -373,7 +374,7 @@ describe('Integration | Transactions', () => { trace: { data: { 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'test.outer': 'test value', 'sentry.sample_rate': 1, }, @@ -408,7 +409,7 @@ describe('Integration | Transactions', () => { trace: { data: { 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', 'test.outer': 'test value b', 'sentry.sample_rate': 1, }, @@ -458,7 +459,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', }, }, @@ -481,7 +482,7 @@ describe('Integration | Transactions', () => { data: { 'sentry.op': 'test op', 'sentry.origin': 'auto.test', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', }, op: 'test op', span_id: expect.stringMatching(/[a-f0-9]{16}/), diff --git a/packages/nuxt/test/runtime/hooks/updateRouteBeforeResponse.test.ts b/packages/nuxt/test/runtime/hooks/updateRouteBeforeResponse.test.ts index 1e77f9ecb2c0..fec51364d935 100644 --- a/packages/nuxt/test/runtime/hooks/updateRouteBeforeResponse.test.ts +++ b/packages/nuxt/test/runtime/hooks/updateRouteBeforeResponse.test.ts @@ -1,9 +1,5 @@ -import { - getActiveSpan, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - SentrySpan, -} from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { getActiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, SentrySpan } from '@sentry/core'; import { afterEach, describe, expect, it, type Mock, vi } from 'vitest'; import { updateRouteBeforeResponse } from '../../../src/runtime/hooks/updateRouteBeforeResponse'; @@ -44,7 +40,7 @@ describe('updateRouteBeforeResponse', () => { }, } as never); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith('http.route', '/users/:id'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith('params.id', '123'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith('url.path.parameter.id', '123'); @@ -66,7 +62,7 @@ describe('updateRouteBeforeResponse', () => { }, } as never); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith('http.route', '/users/:id'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith('params.id', '123'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith('url.path.parameter.id', '123'); diff --git a/packages/opentelemetry/test/integration/scope.test.ts b/packages/opentelemetry/test/integration/scope.test.ts index c5ee9a9ed2c7..7e9b520df289 100644 --- a/packages/opentelemetry/test/integration/scope.test.ts +++ b/packages/opentelemetry/test/integration/scope.test.ts @@ -108,7 +108,7 @@ describe('Integration | Scope', () => { data: { 'sentry.origin': 'manual', 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, span_id: spanId, status: 'ok', diff --git a/packages/opentelemetry/test/integration/transactions.test.ts b/packages/opentelemetry/test/integration/transactions.test.ts index 0f8544591b60..4ff73f163f0c 100644 --- a/packages/opentelemetry/test/integration/transactions.test.ts +++ b/packages/opentelemetry/test/integration/transactions.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } 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'; @@ -5,7 +6,6 @@ import type { Event, TransactionEvent } from '@sentry/core'; import { addBreadcrumb, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setTag, startInactiveSpan, startSpan, @@ -43,7 +43,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', }, }, @@ -84,7 +84,7 @@ describe('Integration | Transactions', () => { data: { 'sentry.op': 'test op', 'sentry.origin': 'auto.test', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', 'sentry.sample_rate': 1, 'test.outer': 'test value', }, @@ -169,7 +169,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, span => { @@ -233,7 +233,7 @@ describe('Integration | Transactions', () => { data: { 'sentry.op': 'test op', 'sentry.origin': 'auto.test', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', 'test.outer': 'test value', 'sentry.sample_rate': 1, }, @@ -273,7 +273,7 @@ describe('Integration | Transactions', () => { 'sentry.origin': 'manual', 'test.outer': 'test value b', 'sentry.sample_rate': 1, - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, op: 'test op b', span_id: expect.stringMatching(/[a-f0-9]{16}/), @@ -325,7 +325,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, () => { @@ -346,7 +346,7 @@ describe('Integration | Transactions', () => { data: { 'sentry.op': 'test op', 'sentry.origin': 'auto.test', - 'sentry.source': 'task', + 'sentry.segment.name.source': 'task', }, op: 'test op', span_id: expect.stringMatching(/[a-f0-9]{16}/), @@ -439,7 +439,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, () => { diff --git a/packages/opentelemetry/test/trace.test.ts b/packages/opentelemetry/test/trace.test.ts index 452ce2b481d9..1b967dfc051a 100644 --- a/packages/opentelemetry/test/trace.test.ts +++ b/packages/opentelemetry/test/trace.test.ts @@ -1,7 +1,7 @@ /* eslint-disable typescript/no-deprecated */ import type { Span, TimeInput } from '@opentelemetry/api'; import { context, ROOT_CONTEXT, trace, TraceFlags } from '@opentelemetry/api'; -import { SENTRY_KIND } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_KIND } from '@sentry/conventions/attributes'; import type { Event, Scope } from '@sentry/core'; import { getCapturedScopesOnSpan, @@ -13,7 +13,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON, startInactiveSpan, startSpan, @@ -214,7 +213,7 @@ describe('trace', () => { expect(getSpanAttributes(span)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }); }, ); @@ -224,14 +223,14 @@ describe('trace', () => { name: 'outer', op: 'my-op', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', }, }, span => { expect(span).toBeDefined(); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'my-op', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, @@ -260,7 +259,7 @@ describe('trace', () => { expect(getSpanAttributes(span)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1', test2: 2, [SENTRY_KIND]: 'client', @@ -461,7 +460,7 @@ describe('trace', () => { data: { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, span_id: expect.stringMatching(/[a-f0-9]{16}/), trace_id: expect.stringMatching(/[a-f0-9]{32}/), @@ -485,7 +484,7 @@ describe('trace', () => { expect(innerTransaction?.contexts?.trace).toEqual({ data: { 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, parent_span_id: innerParentSpanId, span_id: expect.stringMatching(/[a-f0-9]{16}/), @@ -611,14 +610,14 @@ describe('trace', () => { expect(getSpanAttributes(span)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }); const span2 = startInactiveSpan({ name: 'outer', op: 'my-op', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', }, }); @@ -626,7 +625,7 @@ describe('trace', () => { expect(span2).toBeDefined(); expect(getSpanAttributes(span2)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', + [SENTRY_SEGMENT_NAME_SOURCE]: 'task', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'my-op', }); @@ -651,7 +650,7 @@ describe('trace', () => { expect(getSpanAttributes(span)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1', test2: 2, [SENTRY_KIND]: 'client', @@ -789,7 +788,7 @@ describe('trace', () => { data: { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, span_id: expect.stringMatching(/[a-f0-9]{16}/), trace_id: expect.stringMatching(/[a-f0-9]{32}/), @@ -813,7 +812,7 @@ describe('trace', () => { expect(innerTransaction?.contexts?.trace).toEqual({ data: { 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, parent_span_id: innerParentSpanId, span_id: expect.stringMatching(/[a-f0-9]{16}/), @@ -984,7 +983,7 @@ describe('trace', () => { expect(getSpanAttributes(span)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1', test2: 2, [SENTRY_KIND]: 'client', @@ -1174,7 +1173,7 @@ describe('trace', () => { data: { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, span_id: expect.stringMatching(/[a-f0-9]{16}/), trace_id: expect.stringMatching(/[a-f0-9]{32}/), @@ -1198,7 +1197,7 @@ describe('trace', () => { expect(innerTransaction?.contexts?.trace).toEqual({ data: { 'sentry.origin': 'manual', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, parent_span_id: innerParentSpanId, span_id: expect.stringMatching(/[a-f0-9]{16}/), diff --git a/packages/opentelemetry/test/tracerProvider.test.ts b/packages/opentelemetry/test/tracerProvider.test.ts index 88fb10f102d2..878c878a1af1 100644 --- a/packages/opentelemetry/test/tracerProvider.test.ts +++ b/packages/opentelemetry/test/tracerProvider.test.ts @@ -31,7 +31,7 @@ describe('SentryTracerProvider', () => { 'sentry.sample_rate': 1, 'db.system.name': 'postgresql', 'db.statement': 'SELECT * FROM users', - 'sentry.source': 'custom', + 'sentry.segment.name.source': 'custom', }, name: 'SELECT users', parent_span_id: undefined, diff --git a/packages/react-router/test/client/createClientInstrumentation.test.ts b/packages/react-router/test/client/createClientInstrumentation.test.ts index 8a5b697a7567..9bc1adec80af 100644 --- a/packages/react-router/test/client/createClientInstrumentation.test.ts +++ b/packages/react-router/test/client/createClientInstrumentation.test.ts @@ -29,7 +29,6 @@ vi.mock('@sentry/core', async () => { GLOBAL_OBJ: globalThis, SEMANTIC_ATTRIBUTE_SENTRY_OP: 'sentry.op', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', }; }); @@ -117,7 +116,7 @@ describe('createSentryClientInstrumentation', () => { { name: '/about', attributes: expect.objectContaining({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', @@ -187,7 +186,7 @@ describe('createSentryClientInstrumentation', () => { { name: '/items/123', attributes: expect.objectContaining({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'router.navigate', @@ -474,7 +473,7 @@ describe('createSentryClientInstrumentation', () => { { name: '/current-page', attributes: expect.objectContaining({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': expectedType, @@ -484,7 +483,7 @@ describe('createSentryClientInstrumentation', () => { ); expect(mockNavigationSpan.updateName).toHaveBeenCalledWith(destination); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': destination, 'url.full': `https://example.com${destination}`, }); @@ -526,7 +525,7 @@ describe('createSentryClientInstrumentation', () => { await hooks.navigate(mockCallNavigate, { currentUrl: '/current-page', to: -1 }); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/previous-page', 'url.full': 'https://example.com/previous-page', }); @@ -744,7 +743,7 @@ describe('createSentryClientInstrumentation', () => { { name: '/current-page', attributes: expect.objectContaining({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'sentry.op': 'navigation', 'sentry.origin': 'auto.navigation.react_router.instrumentation_api', 'navigation.type': 'browser.popstate', @@ -794,7 +793,7 @@ describe('createSentryClientInstrumentation', () => { // Only ONE span created (not two - no duplicate from popstate) expect(browser.startBrowserTracingNavigationSpan).toHaveBeenCalledTimes(1); expect(mockNavigationSpan.setAttributes).toHaveBeenLastCalledWith({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/previous-page', 'url.full': 'https://example.com/previous-page', }); @@ -924,7 +923,10 @@ describe('navigation root parameterization', () => { }); expect(core.updateSpanName).toHaveBeenCalledWith(mockRootSpan, '/users/:id'); - expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ 'sentry.source': 'route', 'url.template': '/users/:id' }); + expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ + 'sentry.segment.name.source': 'route', + 'url.template': '/users/:id', + }); }); it('does not rename the root span when the route has no pattern', async () => { diff --git a/packages/react-router/test/client/hydratedRouter.test.ts b/packages/react-router/test/client/hydratedRouter.test.ts index 81dcfc7a046b..844254dd6ccf 100644 --- a/packages/react-router/test/client/hydratedRouter.test.ts +++ b/packages/react-router/test/client/hydratedRouter.test.ts @@ -1,8 +1,8 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } 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'; import { instrumentHydratedRouter } from '../../src/client/hydratedRouter'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; vi.mock('@sentry/core', async () => { const actual = await vi.importActual('@sentry/core'); @@ -17,7 +17,7 @@ vi.mock('@sentry/core', async () => { }, SEMANTIC_ATTRIBUTE_SENTRY_OP: 'sentry.op', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', + GLOBAL_OBJ: globalThis, }; }); @@ -112,7 +112,7 @@ describe('instrumentHydratedRouter', () => { callback(newState); expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/foo/:id'); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.template': '/foo/:id', }); }); @@ -137,7 +137,7 @@ describe('instrumentHydratedRouter', () => { expect(mockNavigationSpan.setAttribute).not.toHaveBeenCalled(); expect(mockNavigationSpan.setAttributes).not.toHaveBeenCalled(); expect(mockPageloadSpan.setAttributes).toHaveBeenLastCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.template': '/foo/:id', }); }); @@ -163,7 +163,7 @@ describe('instrumentHydratedRouter', () => { expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/foo/:id'); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.template': '/foo/:id', }); @@ -249,7 +249,7 @@ describe('instrumentHydratedRouter', () => { expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/foo/bar/settings'); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.template': '/foo/bar/settings', }); }); @@ -285,13 +285,13 @@ describe('instrumentHydratedRouter', () => { expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/foo'); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/foo', 'url.full': 'https://example.com/foo', }); expect(mockNavigationSpan.updateName).toHaveBeenLastCalledWith('/foo/:id'); expect(mockNavigationSpan.setAttributes).toHaveBeenLastCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.template': '/foo/:id', }); }); @@ -318,7 +318,7 @@ describe('instrumentHydratedRouter', () => { await navigateResult.catch(() => undefined); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/foo', 'url.full': 'https://example.com/foo', }); @@ -337,7 +337,7 @@ describe('instrumentHydratedRouter', () => { expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/foo'); expect(mockNavigationSpan.updateName).toHaveBeenCalledTimes(1); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/foo', 'url.full': 'https://example.com/foo', }); @@ -357,7 +357,7 @@ describe('instrumentHydratedRouter', () => { expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/foo/:id'); expect(mockNavigationSpan.setAttributes).toHaveBeenLastCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.template': '/foo/:id', }); }); diff --git a/packages/react-router/test/client/utils.test.ts b/packages/react-router/test/client/utils.test.ts index 5839e934e3cd..8486b9c77be2 100644 --- a/packages/react-router/test/client/utils.test.ts +++ b/packages/react-router/test/client/utils.test.ts @@ -117,7 +117,7 @@ describe('updateNavigationSpanUrlFromLocation', () => { expect(span.updateName).toHaveBeenCalledWith('/foo'); expect(span.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/foo', 'url.full': 'https://example.com/foo?bar=1#section', }); @@ -156,7 +156,7 @@ describe('finalizeNavigationSpanFromRouterState', () => { expect(span.updateName).toHaveBeenLastCalledWith('/performance'); expect(span.setAttributes).toHaveBeenLastCalledWith({ - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', 'url.template': '/performance', }); }); @@ -173,7 +173,7 @@ describe('finalizeNavigationSpanFromRouterState', () => { expect(span.updateName).toHaveBeenCalledWith('/performance/'); expect(span.updateName).toHaveBeenCalledTimes(1); expect(span.setAttributes).toHaveBeenCalledWith({ - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'url.path': '/performance/', 'url.full': 'https://example.com/performance/', }); diff --git a/packages/react-router/test/server/createServerInstrumentation.test.ts b/packages/react-router/test/server/createServerInstrumentation.test.ts index 74f84108079d..174ff6c8cf40 100644 --- a/packages/react-router/test/server/createServerInstrumentation.test.ts +++ b/packages/react-router/test/server/createServerInstrumentation.test.ts @@ -20,7 +20,6 @@ vi.mock('@sentry/core', async () => { GLOBAL_OBJ: globalThis, SEMANTIC_ATTRIBUTE_SENTRY_OP: 'sentry.op', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', }; }); @@ -99,7 +98,7 @@ describe('createSentryServerInstrumentation', () => { expect(mockSetAttributes).toHaveBeenCalledWith({ 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', [URL_FULL]: 'http://example.com/test-path', [URL_PATH]: '/test-path', }); @@ -131,7 +130,7 @@ describe('createSentryServerInstrumentation', () => { attributes: expect.objectContaining({ 'sentry.op': 'http.server', 'sentry.origin': 'auto.http.react_router.instrumentation_api', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'http.request.method': 'GET', 'url.path': '/api/users', 'url.full': 'http://example.com/api/users', @@ -381,7 +380,7 @@ describe('createSentryServerInstrumentation', () => { expect(mockSetAttributes).toHaveBeenCalledWith( expect.objectContaining({ 'http.route': '/users/:id', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), ); }); diff --git a/packages/react-router/test/server/getMetaTagTransformer.test.ts b/packages/react-router/test/server/getMetaTagTransformer.test.ts index c4fdc3978926..6b2fbe10ee31 100644 --- a/packages/react-router/test/server/getMetaTagTransformer.test.ts +++ b/packages/react-router/test/server/getMetaTagTransformer.test.ts @@ -4,7 +4,6 @@ import { beforeEach, describe, expect, test, vi } from 'vitest'; import { getMetaTagTransformer } from '../../src/server/getMetaTagTransformer'; vi.mock('@sentry/core', () => ({ - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', getActiveSpan: vi.fn(), getRootSpan: vi.fn(), diff --git a/packages/react-router/test/server/wrapSentryHandleRequest.test.ts b/packages/react-router/test/server/wrapSentryHandleRequest.test.ts index 45b113f887bb..462917d15dfc 100644 --- a/packages/react-router/test/server/wrapSentryHandleRequest.test.ts +++ b/packages/react-router/test/server/wrapSentryHandleRequest.test.ts @@ -1,19 +1,17 @@ import { PassThrough } from 'node:stream'; -import { HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; import { flushIfServerless, getActiveSpan, getRootSpan, getTraceMetaTags, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { getMetaTagTransformer } from '../../src/server/getMetaTagTransformer'; import { wrapSentryHandleRequest } from '../../src/server/wrapSentryHandleRequest'; vi.mock('@sentry/core', () => ({ - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source', SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origin', getActiveSpan: vi.fn(), getRootSpan: vi.fn(), @@ -73,7 +71,7 @@ describe('wrapSentryHandleRequest', () => { expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ [HTTP_ROUTE]: '/some-path', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.react_router.request_handler', }); }); @@ -192,7 +190,7 @@ describe('wrapSentryHandleRequest', () => { // Should set route attributes without origin (to preserve instrumentation_api origin) expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ [HTTP_ROUTE]: '/some-path', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }); }); }); diff --git a/packages/react/test/reactrouter-compat-utils/instrumentation.test.tsx b/packages/react/test/reactrouter-compat-utils/instrumentation.test.tsx index ff0d59de3cf9..4d93928b2d4d 100644 --- a/packages/react/test/reactrouter-compat-utils/instrumentation.test.tsx +++ b/packages/react/test/reactrouter-compat-utils/instrumentation.test.tsx @@ -91,7 +91,7 @@ describe('reactrouter-compat-utils/instrumentation', () => { updateNavigationSpan(mockSpan, sampleLocation, sampleRoutes, false, mockMatchRoutes); expect(mockUpdateName).toHaveBeenCalledWith('Test Route'); - expect(mockSetAttribute).toHaveBeenCalledWith('sentry.source', 'route'); + expect(mockSetAttribute).toHaveBeenCalledWith('sentry.segment.name.source', 'route'); expect(addNonEnumerableProperty).toHaveBeenCalledWith(mockSpan, '__sentry_navigation_name_set__', true); }); @@ -178,7 +178,7 @@ describe('reactrouter-compat-utils/instrumentation', () => { (testSpan as any).end = function patchedEndFn(...args: any[]) { // This simulates what happens in the actual implementation updateNameMock('Updated Route'); - setAttributeMock('sentry.source', 'route'); + setAttributeMock('sentry.segment.name.source', 'route'); return originalEnd(...args); }; @@ -186,7 +186,7 @@ describe('reactrouter-compat-utils/instrumentation', () => { testSpan.end(12345); expect(updateNameMock).toHaveBeenCalledWith('Updated Route'); - expect(setAttributeMock).toHaveBeenCalledWith('sentry.source', 'route'); + expect(setAttributeMock).toHaveBeenCalledWith('sentry.segment.name.source', 'route'); expect(mockEnd).toHaveBeenCalledWith(12345); }); }); @@ -407,7 +407,7 @@ describe('updateNavigationSpan with wildcard detection', () => { updateNavigationSpan(testSpan, sampleLocation, sampleRoutes, false, mockMatchRoutes); expect(mockUpdateName).toHaveBeenCalledWith('Test Route'); - expect(mockSetAttribute).toHaveBeenCalledWith('sentry.source', 'route'); + expect(mockSetAttribute).toHaveBeenCalledWith('sentry.segment.name.source', 'route'); }); it('should handle forced updates', () => { @@ -428,7 +428,7 @@ describe('tryUpdateSpanNameBeforeEnd - source upgrade logic', () => { // Setup: Current span has URL source and non-parameterized name vi.mocked(spanToJSON).mockReturnValue({ name: '/users/123', - attributes: { 'sentry.op': 'navigation', 'sentry.source': 'url' }, + attributes: { 'sentry.op': 'navigation', 'sentry.segment.name.source': 'url' }, } as any); // Target: Resolves to route source with parameterized name @@ -454,14 +454,14 @@ describe('tryUpdateSpanNameBeforeEnd - source upgrade logic', () => { // Should upgrade from URL to route source expect(mockUpdateName).toHaveBeenCalledWith('/users/:id'); - expect(mockSetAttribute).toHaveBeenCalledWith('sentry.source', 'route'); + expect(mockSetAttribute).toHaveBeenCalledWith('sentry.segment.name.source', 'route'); }); it('should not downgrade from route source to URL source', async () => { // Setup: Current span has route source with parameterized name (no wildcard) vi.mocked(spanToJSON).mockReturnValue({ name: '/users/:id', - attributes: { 'sentry.op': 'navigation', 'sentry.source': 'route' }, + attributes: { 'sentry.op': 'navigation', 'sentry.segment.name.source': 'route' }, } as any); // Target: Would resolve to URL source (downgrade attempt) @@ -495,7 +495,7 @@ describe('tryUpdateSpanNameBeforeEnd - source upgrade logic', () => { // Setup: Current span has route source with wildcard vi.mocked(spanToJSON).mockReturnValue({ name: '/users/*', - attributes: { 'sentry.op': 'navigation', 'sentry.source': 'route' }, + attributes: { 'sentry.op': 'navigation', 'sentry.segment.name.source': 'route' }, } as any); // Mock wildcard detection: current name has wildcard, new name doesn't @@ -524,14 +524,14 @@ describe('tryUpdateSpanNameBeforeEnd - source upgrade logic', () => { // Should upgrade from wildcard to specific expect(mockUpdateName).toHaveBeenCalledWith('/users/:id'); - expect(mockSetAttribute).toHaveBeenCalledWith('sentry.source', 'route'); + expect(mockSetAttribute).toHaveBeenCalledWith('sentry.segment.name.source', 'route'); }); it('should not downgrade from wildcard route to URL', async () => { // Setup: Current span has route source with wildcard vi.mocked(spanToJSON).mockReturnValue({ name: '/users/*', - attributes: { 'sentry.op': 'navigation', 'sentry.source': 'route' }, + attributes: { 'sentry.op': 'navigation', 'sentry.segment.name.source': 'route' }, } as any); // Mock wildcard detection: current name has wildcard, new name doesn't @@ -593,14 +593,14 @@ describe('tryUpdateSpanNameBeforeEnd - source upgrade logic', () => { // Should set initial name expect(mockUpdateName).toHaveBeenCalledWith('/users/:id'); - expect(mockSetAttribute).toHaveBeenCalledWith('sentry.source', 'route'); + expect(mockSetAttribute).toHaveBeenCalledWith('sentry.segment.name.source', 'route'); }); it('should not update when same source and no improvement', async () => { // Setup: Current span has URL source vi.mocked(spanToJSON).mockReturnValue({ name: '/users/123', - attributes: { 'sentry.op': 'navigation', 'sentry.source': 'url' }, + attributes: { 'sentry.op': 'navigation', 'sentry.segment.name.source': 'url' }, } as any); // Target: Resolves to same URL source (no improvement) @@ -944,7 +944,7 @@ describe('tryUpdateSpanNameBeforeEnd - source upgrade logic', () => { name: '/search', attributes: expect.objectContaining({ 'sentry.op': 'navigation', - 'sentry.source': 'route', + 'sentry.segment.name.source': 'route', }), }), ); @@ -1152,7 +1152,7 @@ describe('tryUpdateSpanNameBeforeEnd - source upgrade logic', () => { // Mock spanToJSON to indicate span hasn't ended yet and has wildcard name vi.mocked(spanToJSON).mockReturnValue({ name: '/users/*', - attributes: { 'sentry.op': 'navigation', 'sentry.source': 'route' }, + attributes: { 'sentry.op': 'navigation', 'sentry.segment.name.source': 'route' }, } as any); // Second navigation - same location but better parameterized name available diff --git a/packages/react/test/reactrouter-cross-usage.test.tsx b/packages/react/test/reactrouter-cross-usage.test.tsx index 38918312d90d..191629ab8ee1 100644 --- a/packages/react/test/reactrouter-cross-usage.test.tsx +++ b/packages/react/test/reactrouter-cross-usage.test.tsx @@ -6,10 +6,9 @@ import { 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 { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { render, waitFor } from '@testing-library/react'; import * as React from 'react'; import { act } from 'react'; @@ -160,7 +159,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/second-level/:id/third-level/:id'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(URL_TEMPLATE, '/second-level/:id/third-level/:id'); }); @@ -225,7 +224,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenCalledTimes(1); // In cross-usage scenarios, the first wrapper creates the span and the second updates it expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/second-level/:id/third-level/:id'); - expect(mockNavigationSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockNavigationSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); }); }); @@ -283,7 +282,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/second-level/:id/third-level/:id'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(URL_TEMPLATE, '/second-level/:id/third-level/:id'); }); @@ -399,7 +398,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/second-level/:id/third-level/:id'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(URL_TEMPLATE, '/second-level/:id/third-level/:id'); }); @@ -469,7 +468,7 @@ describe('React Router cross usage of wrappers', () => { // Cross-usage deduplication: Span created once with initial route name // With nested lazy routes, initial name may be raw path, updated to parameterized by later wrapper expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/second-level/:id/third-level/:id'); - expect(mockNavigationSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockNavigationSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); }); }); @@ -528,7 +527,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/second-level/:id/third-level/:id'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(URL_TEMPLATE, '/second-level/:id/third-level/:id'); }); @@ -594,7 +593,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenCalledTimes(1); // Cross-usage with all three wrappers: span created once, then updated expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/second-level/:id/third-level/:id'); - expect(mockNavigationSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockNavigationSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); }); }); @@ -649,7 +648,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/settings', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/settings', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -768,7 +767,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenCalledWith(expect.any(BrowserClient), { name: '/user/:id', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/user/:id', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -790,7 +789,7 @@ describe('React Router cross usage of wrappers', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenNthCalledWith(2, expect.any(BrowserClient), { name: '/user/:id', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/user/:id', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', diff --git a/packages/react/test/reactrouter-descendant-routes.test.tsx b/packages/react/test/reactrouter-descendant-routes.test.tsx index 59c81296e9d6..10804904f5e5 100644 --- a/packages/react/test/reactrouter-descendant-routes.test.tsx +++ b/packages/react/test/reactrouter-descendant-routes.test.tsx @@ -6,10 +6,9 @@ import { 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 { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { render } from '@testing-library/react'; import * as React from 'react'; import { @@ -132,7 +131,7 @@ describe('React Router Descendant Routes', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/child/:id'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(URL_TEMPLATE, '/child/:id'); }); @@ -176,7 +175,7 @@ describe('React Router Descendant Routes', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/child/:id', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/child/:id', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -264,7 +263,7 @@ describe('React Router Descendant Routes', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/:orgId/:id'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(URL_TEMPLATE, '/:orgId/:id'); }); @@ -308,7 +307,7 @@ describe('React Router Descendant Routes', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/:orgId/:id', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/:orgId/:id', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -363,7 +362,7 @@ describe('React Router Descendant Routes', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/projects/:projectId/views/:viewId/:detailId'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith( URL_TEMPLATE, '/projects/:projectId/views/:viewId/:detailId', @@ -419,7 +418,7 @@ describe('React Router Descendant Routes', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/projects/:projectId/views/:viewId/:detailId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -480,7 +479,7 @@ describe('React Router Descendant Routes', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/projects/:projectId/views/:viewId/:detailId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -555,7 +554,7 @@ describe('React Router Descendant Routes', () => { expect(container.innerHTML).toContain('Details'); expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/projects/:projectId/views/:viewId/:detailId'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockRootSpan.setAttribute).toHaveBeenCalledWith( URL_TEMPLATE, '/projects/:projectId/views/:viewId/:detailId', @@ -633,7 +632,7 @@ describe('React Router Descendant Routes', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/projects/:projectId/views/:viewId/:detailId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId/:detailId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', diff --git a/packages/react/test/reactrouterv3.test.tsx b/packages/react/test/reactrouterv3.test.tsx index 26507c2a76e7..e77d9584499b 100644 --- a/packages/react/test/reactrouterv3.test.tsx +++ b/packages/react/test/reactrouterv3.test.tsx @@ -7,10 +7,9 @@ import { 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 { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } 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', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v3', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', @@ -144,7 +143,7 @@ describe('browserTracingReactRouterV3', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', @@ -158,7 +157,7 @@ describe('browserTracingReactRouterV3', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/features', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/features', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', @@ -200,7 +199,7 @@ describe('browserTracingReactRouterV3', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/users/:userid', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/:userid', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', @@ -216,7 +215,7 @@ describe('browserTracingReactRouterV3', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/teams/:teamId/details', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/teams/:teamId/details', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v3', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', diff --git a/packages/react/test/reactrouterv4.test.tsx b/packages/react/test/reactrouterv4.test.tsx index eb479fc115ef..5c3eac65cd9c 100644 --- a/packages/react/test/reactrouterv4.test.tsx +++ b/packages/react/test/reactrouterv4.test.tsx @@ -6,7 +6,6 @@ import { getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '@sentry/core'; import { render } from '@testing-library/react'; @@ -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 { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { BrowserClient, reactRouterV4BrowserTracingIntegration, withSentryRouting } from '../src'; import type { RouteConfig } from '../src/reactrouter'; @@ -86,7 +85,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: 'Pageload', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', }, @@ -131,7 +130,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -144,7 +143,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/features', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -203,7 +202,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/users/123', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -240,7 +239,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/users/123', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -249,7 +248,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/users/:userid'); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith( expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/:userid', }), ); @@ -285,7 +284,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/organizations/1234/v1/758', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -294,7 +293,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/organizations/:orgid/v1/:teamid'); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith( expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid/v1/:teamid', }), ); @@ -308,7 +307,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/organizations/543', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -317,7 +316,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/organizations/:orgid'); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith( expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid', }), ); @@ -356,7 +355,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/organizations/:orgid/v1/:teamid', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid/v1/:teamid', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', @@ -370,7 +369,7 @@ describe('browserTracingReactRouterV4', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/organizations/:orgid', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v4', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', diff --git a/packages/react/test/reactrouterv5.test.tsx b/packages/react/test/reactrouterv5.test.tsx index 5d6e065481fa..8f43da5efbaf 100644 --- a/packages/react/test/reactrouterv5.test.tsx +++ b/packages/react/test/reactrouterv5.test.tsx @@ -6,7 +6,6 @@ import { getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '@sentry/core'; import { render } from '@testing-library/react'; @@ -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 { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { BrowserClient, reactRouterV5BrowserTracingIntegration, withSentryRouting } from '../src'; import type { RouteConfig } from '../src/reactrouter'; @@ -86,7 +85,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: 'Pageload', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', }, @@ -131,7 +130,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -144,7 +143,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/features', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -203,7 +202,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/users/123', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -240,7 +239,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/users/123', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -249,7 +248,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/users/:userid'); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith( expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/:userid', }), ); @@ -285,7 +284,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/organizations/1234/v1/758', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -294,7 +293,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/organizations/:orgid/v1/:teamid'); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith( expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid/v1/:teamid', }), ); @@ -308,7 +307,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/organizations/543', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', }, @@ -317,7 +316,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/organizations/:orgid'); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith( expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/organizations/:orgid', }), ); @@ -356,7 +355,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/organizations/:orgid/v1/:teamid', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [URL_TEMPLATE]: '/organizations/:orgid/v1/:teamid', @@ -370,7 +369,7 @@ describe('browserTracingReactRouterV5', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/organizations/:orgid', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v5', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [URL_TEMPLATE]: '/organizations/:orgid', diff --git a/packages/react/test/reactrouterv6.test.tsx b/packages/react/test/reactrouterv6.test.tsx index 99728314ff66..ab06605718ca 100644 --- a/packages/react/test/reactrouterv6.test.tsx +++ b/packages/react/test/reactrouterv6.test.tsx @@ -6,10 +6,9 @@ import { 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 { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { fireEvent, render } from '@testing-library/react'; import * as React from 'react'; import type { RouteObject } from 'react-router-6'; @@ -132,7 +131,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: 'Pageload', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, @@ -179,7 +178,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: 'Pageload', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, @@ -216,7 +215,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: 'Pageload', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, @@ -333,7 +332,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -420,7 +419,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about/us', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about/us', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -458,7 +457,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about/:page', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about/:page', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -498,7 +497,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/stores/:storeId/products/:productId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/stores/:storeId/products/:productId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -546,7 +545,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/projects/:projectId/views/:viewId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -596,7 +595,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/projects/:projectId/views/:viewId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -648,7 +647,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/projects/:projectId/views/:viewId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -688,7 +687,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/issues/:groupId/', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -728,7 +727,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/issues/:groupId/', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -801,7 +800,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: 'Pageload', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.reactrouter_v6', }, @@ -952,7 +951,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -1004,7 +1003,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about/us', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about/us', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -1056,7 +1055,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/about/:page', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/about/:page', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -1114,7 +1113,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/stores/:storeId/products/:productId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/stores/:storeId/products/:productId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -1196,7 +1195,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/projects/:projectId/views/:viewId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/projects/:projectId/views/:viewId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -1276,7 +1275,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/param-page/:id/details/:superId', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/param-page/:id/details/:superId', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -1340,7 +1339,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); // should be /tests not //tests expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/tests'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); }); it('handles wildcard routes properly', () => { @@ -1398,7 +1397,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingPageLoadSpan).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenLastCalledWith('/tests/:testId/*'); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); }); it('works under a slash route with a trailing slash', () => { @@ -1433,7 +1432,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/issues/:groupId/', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', @@ -1473,7 +1472,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => { expect(mockStartBrowserTracingNavigationSpan).toHaveBeenLastCalledWith(expect.any(BrowserClient), { name: '/issues/:groupId/', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/issues/:groupId/', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.react.reactrouter_v6', diff --git a/packages/react/test/tanstackrouter.test.ts b/packages/react/test/tanstackrouter.test.ts index eda7aa44a0d4..3be33a3168f5 100644 --- a/packages/react/test/tanstackrouter.test.ts +++ b/packages/react/test/tanstackrouter.test.ts @@ -1,6 +1,6 @@ import * as SentryBrowser from '@sentry/browser'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core/browser'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core/browser'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { tanstackRouterBrowserTracingIntegration } from '../src/tanstackrouter'; @@ -85,7 +85,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { name: '/posts/$postId', attributes: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/posts/$postId', 'url.path.parameter.postId': '999', }), diff --git a/packages/remix/test/server/tracing-channel.test.ts b/packages/remix/test/server/tracing-channel.test.ts index 5f1983bc075d..72d7a6de1ea5 100644 --- a/packages/remix/test/server/tracing-channel.test.ts +++ b/packages/remix/test/server/tracing-channel.test.ts @@ -48,7 +48,7 @@ describe('remixIntegration (Orchestrion-based)', () => { 'sentry.origin': 'auto.http.remix', 'sentry.kind': 'server', 'sentry.op': 'http.server', - 'sentry.source': 'url', + 'sentry.segment.name.source': 'url', 'code.function.name': 'requestHandler', 'http.method': 'GET', 'url.full': 'http://localhost/users', @@ -84,7 +84,7 @@ describe('remixIntegration (Orchestrion-based)', () => { expect(span.setAttribute).toHaveBeenCalledWith('http.route', 'users/:userId'); expect(span.setAttribute).toHaveBeenCalledWith('match.route.id', 'routes/users.$userId'); expect(span.updateName).toHaveBeenCalledWith('GET users/:userId'); - expect(span.setAttribute).toHaveBeenCalledWith('sentry.source', 'route'); + expect(span.setAttribute).toHaveBeenCalledWith('sentry.segment.name.source', 'route'); }); it('matchServerRoutes: does nothing when there is no active span', () => { diff --git a/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts b/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts index e1183da96d1b..9405fb0d8672 100644 --- a/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts +++ b/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts @@ -1,4 +1,5 @@ import { + SENTRY_SEGMENT_NAME_SOURCE, GEN_AI_INPUT_MESSAGES, GEN_AI_OPERATION_NAME, GEN_AI_OUTPUT_MESSAGES, @@ -13,7 +14,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, spanToStaticSpanJSON, } from '@sentry/core'; @@ -68,7 +68,7 @@ describe('instrumentWorkersAiClient', () => { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.chat', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', [GEN_AI_PROVIDER_NAME]: 'cloudflare.workers_ai', [GEN_AI_OPERATION_NAME]: 'chat', [GEN_AI_REQUEST_MODEL]: MODEL, diff --git a/packages/solid/test/solidrouter.test.tsx b/packages/solid/test/solidrouter.test.tsx index 2e79d8995e0a..138cf7e7e868 100644 --- a/packages/solid/test/solidrouter.test.tsx +++ b/packages/solid/test/solidrouter.test.tsx @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { spanToJSON } from '@sentry/browser'; import type { Span } from '@sentry/core'; import { @@ -5,7 +6,6 @@ import { getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '@sentry/core'; import type { MemoryHistory } from '@solidjs/router'; @@ -73,7 +73,7 @@ describe('solidRouterBrowserTracingIntegration', () => { expect.objectContaining({ name: 'Pageload', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', }), @@ -104,7 +104,7 @@ describe('solidRouterBrowserTracingIntegration', () => { expect.objectContaining({ name: 'Pageload', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', }), @@ -149,7 +149,7 @@ describe('solidRouterBrowserTracingIntegration', () => { const span = spanToJSON(navSpan!); expect(span.name).toBe(parametrizedRoute); expect(span.attributes).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter', }); @@ -185,7 +185,7 @@ describe('solidRouterBrowserTracingIntegration', () => { expect.objectContaining({ name: '/about', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solid.solidrouter', }), diff --git a/packages/solid/test/tanstackrouter.test.ts b/packages/solid/test/tanstackrouter.test.ts index b51200dd0eda..de3a2e9496d7 100644 --- a/packages/solid/test/tanstackrouter.test.ts +++ b/packages/solid/test/tanstackrouter.test.ts @@ -1,6 +1,6 @@ import * as SentryBrowser from '@sentry/browser'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { tanstackRouterBrowserTracingIntegration } from '../src/tanstackrouter'; @@ -92,7 +92,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { name: '/posts/$postId', attributes: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.solid.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/posts/$postId', 'url.path.parameter.postId': '999', }), @@ -186,7 +186,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { fromLocation: { pathname: '/posts/456', search: {}, state: 'state-1' }, }); - expect(mockNavigationSpan.setAttribute).toHaveBeenLastCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'url'); + expect(mockNavigationSpan.setAttribute).toHaveBeenLastCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'url'); expect(mockNavigationSpan.setAttributes).toHaveBeenLastCalledWith( expect.objectContaining({ [URL_TEMPLATE]: undefined, diff --git a/packages/solidstart/test/client/solidrouter.test.tsx b/packages/solidstart/test/client/solidrouter.test.tsx index 1ef9bc1d75f6..226868db256d 100644 --- a/packages/solidstart/test/client/solidrouter.test.tsx +++ b/packages/solidstart/test/client/solidrouter.test.tsx @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { spanToJSON } from '@sentry/browser'; import type { Span } from '@sentry/core'; import { @@ -5,7 +6,6 @@ import { getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, } from '@sentry/core'; import type { MemoryHistory } from '@solidjs/router'; @@ -73,7 +73,7 @@ describe('solidRouterBrowserTracingIntegration', () => { expect.objectContaining({ name: 'Pageload', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', }), @@ -104,7 +104,7 @@ describe('solidRouterBrowserTracingIntegration', () => { expect.objectContaining({ name: '/', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.browser', }), @@ -149,7 +149,7 @@ describe('solidRouterBrowserTracingIntegration', () => { const span = spanToJSON(navSpan!); expect(span.name).toBe(parametrizedRoute); expect(span.attributes).toMatchObject({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.solidstart.solidrouter', }); @@ -185,7 +185,7 @@ describe('solidRouterBrowserTracingIntegration', () => { expect.objectContaining({ name: '/about', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_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 1fcc0d22e661..3d3b17dbcfe0 100644 --- a/packages/solidstart/test/server/withServerActionInstrumentation.test.ts +++ b/packages/solidstart/test/server/withServerActionInstrumentation.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; import * as SentryNode from '@sentry/node'; import { @@ -5,7 +6,6 @@ import { NodeClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, spanToJSON, } from '@sentry/node'; @@ -101,7 +101,7 @@ describe('withServerActionInstrumentation', () => { name: 'getPrefecture', attributes: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component', + [SENTRY_SEGMENT_NAME_SOURCE]: 'component', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.solidstart', }), }), @@ -142,7 +142,7 @@ describe('withServerActionInstrumentation', () => { expect(mockGetActiveSpan).to.toHaveBeenCalledTimes(2); expect(mockSpanSetAttribute).to.toHaveBeenCalledWith('http.route', 'getPrefecture'); - expect(mockSpanSetAttribute).to.toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockSpanSetAttribute).to.toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); }); // `@sentry/node`'s HTTP spans only carry `url.path`, so gating on `http.target` alone silently @@ -166,7 +166,7 @@ describe('withServerActionInstrumentation', () => { await getPrefecture(); expect(mockSpanSetAttribute).to.toHaveBeenCalledWith('http.route', 'getPrefecture'); - expect(mockSpanSetAttribute).to.toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockSpanSetAttribute).to.toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); }); it('does not set a server action name if the active span had a non `/_server` `url.path`', async () => { diff --git a/packages/sveltekit/test/client/browserTracingIntegration.test.ts b/packages/sveltekit/test/client/browserTracingIntegration.test.ts index 92e472fde8b6..1753e15cc9f0 100644 --- a/packages/sveltekit/test/client/browserTracingIntegration.test.ts +++ b/packages/sveltekit/test/client/browserTracingIntegration.test.ts @@ -4,13 +4,13 @@ /* eslint-disable @typescript-eslint/unbound-method */ import type { Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as SentrySvelte from '@sentry/svelte'; import { writable } from 'svelte/store'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { navigating, page } from '$app/stores'; import { browserTracingIntegration } from '../../src/client'; -import { SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, URL_TEMPLATE } from '@sentry/conventions/attributes'; // we have to overwrite the global mock from `vitest.setup.ts` here to reset the // `navigating` store for each test. @@ -116,7 +116,7 @@ describe('browserTracingIntegration', () => { op: 'pageload', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }); @@ -130,7 +130,7 @@ describe('browserTracingIntegration', () => { expect(createdRootSpan?.updateName).toHaveBeenCalledTimes(1); expect(createdRootSpan?.updateName).toHaveBeenCalledWith('testRoute'); expect(createdRootSpan?.setAttributes).toHaveBeenCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: 'testRoute', }); }); @@ -220,7 +220,7 @@ describe('browserTracingIntegration', () => { op: 'navigation', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/[id]', 'sentry.sveltekit.navigation.from': '/users', 'sentry.sveltekit.navigation.to': '/users/[id]', @@ -298,7 +298,7 @@ describe('browserTracingIntegration', () => { name: '/users/[id]', op: 'navigation', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.sveltekit', [URL_TEMPLATE]: '/users/[id]', 'sentry.sveltekit.navigation.from': '/users/[id]', diff --git a/packages/sveltekit/test/client/load.test.ts b/packages/sveltekit/test/client/load.test.ts index c023baa48254..d7b7b3a5f142 100644 --- a/packages/sveltekit/test/client/load.test.ts +++ b/packages/sveltekit/test/client/load.test.ts @@ -1,8 +1,5 @@ -import { - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as SentrySvelte from '@sentry/svelte'; import type { Load } from '@sveltejs/kit'; import { redirect } from '@sveltejs/kit'; @@ -110,7 +107,7 @@ describe('wrapLoadWithSentry', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', 'code.function.name': 'load', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }, name: '/users/[id]', }, @@ -138,7 +135,7 @@ describe('wrapLoadWithSentry', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', 'code.function.name': 'load', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, name: '/users/123', }, @@ -168,7 +165,7 @@ describe('wrapLoadWithSentry', () => { expect.objectContaining({ name: routeIdFromUntrack, attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }), }), expect.any(Function), diff --git a/packages/sveltekit/test/client/svelte5BrowserTracing.test.ts b/packages/sveltekit/test/client/svelte5BrowserTracing.test.ts index fc93cbad3f71..e76b24d742f0 100644 --- a/packages/sveltekit/test/client/svelte5BrowserTracing.test.ts +++ b/packages/sveltekit/test/client/svelte5BrowserTracing.test.ts @@ -4,9 +4,9 @@ /* eslint-disable @typescript-eslint/unbound-method */ import type { Span } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as SentrySvelte from '@sentry/svelte'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { instrumentSvelteKitTracing } from '../../src/client/svelte5BrowserTracing'; @@ -84,7 +84,7 @@ describe('svelte5 browser tracing', () => { op: 'pageload', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }); @@ -92,7 +92,7 @@ describe('svelte5 browser tracing', () => { expect(createdRootSpan?.updateName).toHaveBeenCalledWith('/users/[id]'); expect(createdRootSpan?.setAttributes).toHaveBeenCalledWith({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/[id]', }); expect(setTransactionNameSpy).toHaveBeenCalledWith('/users/[id]'); @@ -125,7 +125,7 @@ describe('svelte5 browser tracing', () => { op: 'navigation', attributes: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [URL_TEMPLATE]: '/users/[id]', }), }), diff --git a/packages/sveltekit/test/server-common/handle.test.ts b/packages/sveltekit/test/server-common/handle.test.ts index a1e6fc464ab6..2e930f574d60 100644 --- a/packages/sveltekit/test/server-common/handle.test.ts +++ b/packages/sveltekit/test/server-common/handle.test.ts @@ -1,13 +1,6 @@ import type { EventEnvelopeHeaders, Span } from '@sentry/core'; -import { HTTP_ROUTE } from '@sentry/conventions/attributes'; -import { - getCapturedScopesOnSpan, - getRootSpan, - getSpanDescendants, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - spanIsSampled, - spanToJSON, -} from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; +import { getCapturedScopesOnSpan, getRootSpan, getSpanDescendants, spanIsSampled, spanToJSON } from '@sentry/core'; import * as SentryCore from '@sentry/core'; import { NodeClient, setCurrentClient } from '@sentry/node'; import type { Handle } from '@sveltejs/kit'; @@ -144,7 +137,7 @@ describe('sentryHandle', () => { expect(spanToJSON(_span!).name).toEqual('GET /users/[id]'); expect(spanToJSON(_span!).attributes['sentry.op']).toEqual('http.server'); expect(spanToJSON(_span!).status).toEqual(isError ? 'error' : 'ok'); - expect(spanToJSON(_span!).attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toEqual('route'); + expect(spanToJSON(_span!).attributes?.[SENTRY_SEGMENT_NAME_SOURCE]).toEqual('route'); expect(spanToJSON(_span!).attributes?.[HTTP_ROUTE]).toEqual('/users/[id]'); expect(spanToJSON(_span!).end_timestamp).toBeDefined(); @@ -173,7 +166,7 @@ describe('sentryHandle', () => { expect(_span).toBeUndefined(); expect(spanToJSON(kitRootSpan).name).toEqual('GET /users/[id]'); - expect(spanToJSON(kitRootSpan).attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toEqual('route'); + expect(spanToJSON(kitRootSpan).attributes?.[SENTRY_SEGMENT_NAME_SOURCE]).toEqual('route'); expect(spanToJSON(kitRootSpan).attributes?.[HTTP_ROUTE]).toEqual('/users/[id]'); kitRootSpan.end(); }); @@ -210,7 +203,7 @@ describe('sentryHandle', () => { expect(spanToJSON(_span!).name).toEqual('GET /users/[id]'); expect(spanToJSON(_span!).attributes['sentry.op']).toEqual('http.server'); expect(spanToJSON(_span!).status).toEqual(isError ? 'error' : 'ok'); - expect(spanToJSON(_span!).attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]).toEqual('route'); + expect(spanToJSON(_span!).attributes?.[SENTRY_SEGMENT_NAME_SOURCE]).toEqual('route'); expect(spanToJSON(_span!).end_timestamp).toBeDefined(); diff --git a/packages/sveltekit/test/server-common/load.test.ts b/packages/sveltekit/test/server-common/load.test.ts index 67910ba0f724..04ad4a96787f 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_SEGMENT_NAME_SOURCE } 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_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import * as SentryCore from '@sentry/core'; import { NodeClient, setCurrentClient } from '@sentry/node'; import type { Load, ServerLoad } from '@sveltejs/kit'; @@ -172,7 +169,7 @@ describe('wrapLoadWithSentry calls `startSpan`', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', 'code.function.name': 'load', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }, name: '/users/[id]', }, @@ -191,7 +188,7 @@ describe('wrapLoadWithSentry calls `startSpan`', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', 'code.function.name': 'load', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, name: '/users/123', }, @@ -258,7 +255,7 @@ describe('wrapServerLoadWithSentry calls `startSpan`', () => { expect(transaction.contexts?.trace).toEqual({ data: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit.server', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', 'code.function.name': 'load', 'http.method': 'GET', @@ -325,7 +322,7 @@ describe('wrapServerLoadWithSentry calls `startSpan`', () => { expect.objectContaining({ name: '/users/[id]', attributes: expect.objectContaining({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }), }), expect.any(Function), diff --git a/packages/sveltekit/test/server-common/serverRoute.test.ts b/packages/sveltekit/test/server-common/serverRoute.test.ts index 1c1a0e38aad6..c2a9adf84846 100644 --- a/packages/sveltekit/test/server-common/serverRoute.test.ts +++ b/packages/sveltekit/test/server-common/serverRoute.test.ts @@ -5,7 +5,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, wrapServerRouteWithSentry, } from '../../src/server'; @@ -40,7 +39,6 @@ describe('wrapServerRouteWithSentry', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', 'code.function.name': 'GET', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', 'http.request.method': 'GET', }, name: 'GET /api/users/:id', @@ -63,7 +61,6 @@ describe('wrapServerRouteWithSentry', () => { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'function', 'code.function.name': 'GET', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.sveltekit', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', 'http.request.method': 'GET', }, name: 'GET Server Route', diff --git a/packages/vue/test/router.test.ts b/packages/vue/test/router.test.ts index 6bec267f904d..996477315953 100644 --- a/packages/vue/test/router.test.ts +++ b/packages/vue/test/router.test.ts @@ -1,8 +1,8 @@ import * as SentryBrowser from '@sentry/browser'; import type { Span, SpanAttributes } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; -import { NAVIGATION_ROUTE_ID, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, NAVIGATION_ROUTE_ID, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { afterEach, describe, expect, it, vi } from 'vitest'; import type { Route } from '../src/router'; import { instrumentVueRouter } from '../src/router'; @@ -126,7 +126,7 @@ describe('instrumentVueRouter()', () => { name: transactionName, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: transactionSource, + [SENTRY_SEGMENT_NAME_SOURCE]: transactionSource, ...getAttributesForRoute(to, transactionSource === 'route' ? transactionName : undefined), }, op: 'navigation', @@ -176,7 +176,7 @@ describe('instrumentVueRouter()', () => { expect(mockVueRouter.beforeEach).toHaveBeenCalledTimes(1); expect(mockRootSpan.updateName).toHaveBeenCalledWith(transactionName); - expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, transactionSource); + expect(mockRootSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, transactionSource); expect(mockRootSpan.setAttributes).toHaveBeenCalledWith({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue', ...getAttributesForRoute(to, transactionSource === 'route' ? transactionName : undefined), @@ -206,7 +206,7 @@ describe('instrumentVueRouter()', () => { name: '/login', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', ...getAttributesForRoute(to, '/login'), }, op: 'navigation', @@ -237,7 +237,7 @@ describe('instrumentVueRouter()', () => { name: 'login-screen', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', ...getAttributesForRoute(to), }, op: 'navigation', @@ -253,11 +253,11 @@ describe('instrumentVueRouter()', () => { setAttribute: vi.fn(), setAttributes: vi.fn(), name: '', - getSpanJSON: () => ({ attributes: { 'sentry.op': 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }), + getSpanJSON: () => ({ attributes: { 'sentry.op': 'pageload', [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }), getStaticSpanJSON: () => ({ op: 'pageload', data: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', + [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }, }), }; @@ -281,7 +281,7 @@ describe('instrumentVueRouter()', () => { mockRootSpan.getSpanJSON = () => ({ attributes: { 'sentry.op': 'pageload', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', + [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }, }); @@ -343,8 +343,8 @@ describe('instrumentVueRouter()', () => { setAttribute: vi.fn(), setAttributes: vi.fn(), name: '', - getSpanJSON: () => ({ attributes: { 'sentry.op': 'pageload', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }), - getStaticSpanJSON: () => ({ op: 'pageload', data: { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url' } }), + getSpanJSON: () => ({ attributes: { 'sentry.op': 'pageload', [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }), + getStaticSpanJSON: () => ({ op: 'pageload', data: { [SENTRY_SEGMENT_NAME_SOURCE]: 'url' } }), }; vi.spyOn(SentryCore, 'getRootSpan').mockImplementation(() => mockRootSpan as unknown as Span); diff --git a/packages/vue/test/tanstackrouter.test.ts b/packages/vue/test/tanstackrouter.test.ts index e622a3e7ba33..593d4da842ef 100644 --- a/packages/vue/test/tanstackrouter.test.ts +++ b/packages/vue/test/tanstackrouter.test.ts @@ -1,6 +1,6 @@ import * as SentryBrowser from '@sentry/browser'; -import { URL_TEMPLATE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; +import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type { AnyRouter } from '@tanstack/vue-router'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { tanstackRouterBrowserTracingIntegration } from '../src/tanstackrouter'; @@ -120,7 +120,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { name: '/test/:id', attributes: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.vue.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', 'url.path.parameter.id': '123', 'params.id': '123', }), @@ -193,7 +193,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { }); expect(mockPageloadSpan.updateName).toHaveBeenCalledWith('/unknown/path'); - expect(mockPageloadSpan.setAttribute).toHaveBeenLastCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'url'); + expect(mockPageloadSpan.setAttribute).toHaveBeenLastCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'url'); expect(mockPageloadSpan.setAttributes).toHaveBeenLastCalledWith( expect.objectContaining({ [URL_TEMPLATE]: undefined, @@ -293,7 +293,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { name: '/test/:id', attributes: expect.objectContaining({ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.vue.tanstack_router', - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route', + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', }), }, { url: expect.any(String) }, @@ -396,7 +396,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { }); expect(mockNavigationSpan.updateName).toHaveBeenCalledWith('/redirected/:id'); - expect(mockNavigationSpan.setAttribute).toHaveBeenCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); + expect(mockNavigationSpan.setAttribute).toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'route'); expect(mockNavigationSpan.setAttributes).toHaveBeenCalledWith( expect.objectContaining({ 'url.path': '/redirected/789', @@ -431,7 +431,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { fromLocation: { pathname: '/test/456', search: {}, state: 'state-1' }, }); - expect(mockNavigationSpan.setAttribute).toHaveBeenLastCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'url'); + expect(mockNavigationSpan.setAttribute).toHaveBeenLastCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'url'); expect(mockNavigationSpan.setAttributes).toHaveBeenLastCalledWith( expect.objectContaining({ [URL_TEMPLATE]: undefined, @@ -463,7 +463,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => { toLocation: { pathname: '/unknown/path', search: {} }, }); - expect(mockNavigationSpan.setAttribute).toHaveBeenLastCalledWith(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'url'); + expect(mockNavigationSpan.setAttribute).toHaveBeenLastCalledWith(SENTRY_SEGMENT_NAME_SOURCE, 'url'); expect(mockNavigationSpan.setAttributes).toHaveBeenLastCalledWith( expect.objectContaining({ [URL_TEMPLATE]: undefined, From 1c8f603d43e6a8d77dcae6a8536da32b6349ae65 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 14:15:50 +0200 Subject: [PATCH 07/13] test(deno): Drop duplicate sentry.segment.name.source assertion --- .../test-applications/deno-streamed/tests/spans.test.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts b/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts index 2cc20e2c5f8b..8df9772e6654 100644 --- a/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts +++ b/dev-packages/e2e-tests/test-applications/deno-streamed/tests/spans.test.ts @@ -119,10 +119,6 @@ const SEGMENT_SPAN = { type: 'string', value: 'url', }, - 'sentry.segment.name.source': { - type: 'string', - value: 'url', - }, 'server.address': { type: 'string', value: expect.any(String), From 6c07c4fcf5dec8a4dd02a2f84c913b293bdc9a2b Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 14:17:28 +0200 Subject: [PATCH 08/13] test: Drop duplicate sentry.segment.name.source assertion in streamed HTTP test Co-Authored-By: Cursor Grok 4.6 --- .../suites/tracing/httpIntegration-streamed/test.ts | 1 - 1 file changed, 1 deletion(-) 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 8e0d97fdd026..4ae87242be78 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 @@ -20,7 +20,6 @@ describe('httpIntegration-streamed', () => { expect(serverSpan?.is_segment).toBe(true); expect(serverSpan?.name).toBe('GET /test'); expect(serverSpan?.attributes['sentry.segment.name.source']).toEqual({ type: 'string', value: 'route' }); - expect(serverSpan?.attributes['sentry.segment.name.source']).toEqual({ type: 'string', value: 'route' }); }, }) .start(); From da850f076f491c7234c24913cb3642cb911a6a09 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 18:22:14 +0200 Subject: [PATCH 09/13] test(browser-utils): Assert inherited route source via sentry.segment.name.source --- packages/browser-utils/test/performance/interactions.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/browser-utils/test/performance/interactions.test.ts b/packages/browser-utils/test/performance/interactions.test.ts index b9637c8151b5..e3aa01ca9b1d 100644 --- a/packages/browser-utils/test/performance/interactions.test.ts +++ b/packages/browser-utils/test/performance/interactions.test.ts @@ -108,7 +108,7 @@ describe('interactionsIntegration', () => { op: 'navigation', name: '/users/:id', sampled: true, - attributes: { 'sentry.source': 'route' }, + attributes: { 'sentry.segment.name.source': 'route' }, }), ); From bdae8d9d49d7628053085dad63d0869998720acc Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Mon, 24 Aug 2026 18:27:40 +0200 Subject: [PATCH 10/13] test(core): Drop duplicate sentry.segment.name.source keys in captureSpan tests Co-Authored-By: Cursor Grok 4.6 --- .../core/test/lib/tracing/spans/captureSpan.test.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/packages/core/test/lib/tracing/spans/captureSpan.test.ts b/packages/core/test/lib/tracing/spans/captureSpan.test.ts index 90b6dd3f2145..24a45b0eb561 100644 --- a/packages/core/test/lib/tracing/spans/captureSpan.test.ts +++ b/packages/core/test/lib/tracing/spans/captureSpan.test.ts @@ -97,10 +97,6 @@ describe('captureSpan', () => { value: span.spanContext().spanId, type: 'string', }, - ['sentry.segment.name.source']: { - value: 'custom', - type: 'string', - }, [SENTRY_SEGMENT_NAME_SOURCE]: { value: 'custom', type: 'string', @@ -197,10 +193,6 @@ describe('captureSpan', () => { value: span.spanContext().spanId, type: 'string', }, - ['sentry.segment.name.source']: { - value: 'custom', - type: 'string', - }, [SENTRY_SEGMENT_NAME_SOURCE]: { value: 'custom', type: 'string', @@ -297,10 +289,6 @@ describe('captureSpan', () => { value: span.spanContext().spanId, type: 'string', }, - ['sentry.segment.name.source']: { - value: 'custom', - type: 'string', - }, [SENTRY_SEGMENT_NAME_SOURCE]: { value: 'custom', type: 'string', @@ -367,7 +355,6 @@ describe('captureSpan', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, [SENTRY_SEGMENT_NAME]: { value: 'my-span', type: 'string' }, [SENTRY_SEGMENT_ID]: { value: span.spanContext().spanId, type: 'string' }, - ['sentry.segment.name.source']: { value: 'custom', type: 'string' }, [SENTRY_SEGMENT_NAME_SOURCE]: { value: 'custom', type: 'string' }, [SEMANTIC_ATTRIBUTE_SENTRY_RELEASE]: { value: '1.0.0', type: 'string' }, [SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT]: { value: 'staging', type: 'string' }, From 1a4b880330c2ae06168df61ab2c710ddfd513c86 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Tue, 25 Aug 2026 13:59:31 +0200 Subject: [PATCH 11/13] fix(core): Address review comments on segment name source Keep tRPC route source on span start so sampling sees it, stop redis cache from deleting source on segment roots, and drop "segment" from the child-span debug warning. Co-Authored-By: Cursor Grok 4.6 --- packages/core/src/tracing/sentrySpan.ts | 2 +- packages/core/src/trpc.ts | 7 ++----- packages/core/test/lib/trpc.test.ts | 18 +++++++++++++++++- .../src/integrations/redis/redis-cache.ts | 2 -- .../integrations/redis/redis-cache.test.ts | 2 ++ 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index 02a18015ff5b..694e0232b068 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -181,7 +181,7 @@ export class SentrySpan implements Span { if (key === SENTRY_SEGMENT_NAME_SOURCE && value !== undefined && !spanIsSegment(this)) { DEBUG_BUILD && debug.warn( - `[Tracing] Ignoring \`${SENTRY_SEGMENT_NAME_SOURCE}\` on a child span: this attribute is only valid on the root span.`, + '[Tracing] Ignoring name source on a child span: this attribute is only valid on the root span.', ); return this; } diff --git a/packages/core/src/trpc.ts b/packages/core/src/trpc.ts index 11ef7c25b3be..e08248b3bbe4 100644 --- a/packages/core/src/trpc.ts +++ b/packages/core/src/trpc.ts @@ -2,6 +2,7 @@ import { RPC_METHOD, RPC_SYSTEM_NAME, SENTRY_OP, + SENTRY_SEGMENT_NAME_SOURCE, TRPC_PROCEDURE_PATH, TRPC_PROCEDURE_TYPE, } from '@sentry/conventions/attributes'; @@ -10,7 +11,6 @@ import { getClient, withIsolationScope } from './currentScopes'; import { captureException } from './exports'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; import { startSpanManual } from './tracing/trace'; -import { INTERNAL_setSegmentNameSourceIfSegment } from './utils/spanUtils'; import { normalize } from './utils/normalize'; import { setNormalizationDepthOverrideHint } from './utils/normalizationHints'; @@ -96,6 +96,7 @@ export function trpcMiddleware(options: SentryTrpcMiddlewareOptions = {}) { name: `trpc/${path}`, attributes: { [SENTRY_OP]: RPC, + [SENTRY_SEGMENT_NAME_SOURCE]: 'route', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.rpc.trpc', [RPC_SYSTEM_NAME]: 'trpc', [RPC_METHOD]: String(path), @@ -105,10 +106,6 @@ export function trpcMiddleware(options: SentryTrpcMiddlewareOptions = {}) { forceTransaction: !!options.forceTransaction, }, async span => { - // The procedure path names the segment only when tRPC is not nested in another span, - // e.g. an incoming HTTP request span. - INTERNAL_setSegmentNameSourceIfSegment(span, 'route'); - try { const nextResult = await next(); captureIfError(nextResult); diff --git a/packages/core/test/lib/trpc.test.ts b/packages/core/test/lib/trpc.test.ts index 15c445bdd99c..1df5f45957a5 100644 --- a/packages/core/test/lib/trpc.test.ts +++ b/packages/core/test/lib/trpc.test.ts @@ -61,8 +61,8 @@ describe('trpcMiddleware', () => { name: 'trpc/test.procedure', attributes: { 'sentry.op': 'rpc', + 'sentry.segment.name.source': 'route', 'sentry.origin': 'auto.rpc.trpc', - 'sentry.source': 'route', 'rpc.system.name': 'trpc', 'rpc.method': 'test.procedure', 'trpc.procedure_path': 'test.procedure', @@ -74,6 +74,22 @@ describe('trpcMiddleware', () => { ); }); + test('sets the segment name source when the tRPC span is the segment', async () => { + const middleware = trpcMiddleware(); + const next = vi.fn().mockResolvedValue({ ok: true }); + + await middleware({ path: 'test.procedure', type: 'query', next }); + + expect(tracing.startSpanManual).toHaveBeenCalledWith( + expect.objectContaining({ + attributes: expect.objectContaining({ + 'sentry.segment.name.source': 'route', + }), + }), + expect.any(Function), + ); + }); + test('captures error when next() returns error result', async () => { const middleware = trpcMiddleware(); const error = new Error('Test error'); diff --git a/packages/server-utils/src/integrations/redis/redis-cache.ts b/packages/server-utils/src/integrations/redis/redis-cache.ts index 7611526e909b..e79c6bf8f31c 100644 --- a/packages/server-utils/src/integrations/redis/redis-cache.ts +++ b/packages/server-utils/src/integrations/redis/redis-cache.ts @@ -3,7 +3,6 @@ import { NET_PEER_PORT, NETWORK_PEER_ADDRESS, NETWORK_PEER_PORT, - SENTRY_SEGMENT_NAME_SOURCE, SERVER_ADDRESS, SERVER_PORT, } from '@sentry/conventions/attributes'; @@ -201,7 +200,6 @@ export function applyRedisCacheAttributes( const spanDescription = safeKey.join(', '); span.updateName(options.maxCacheKeyLength ? truncate(spanDescription, options.maxCacheKeyLength) : spanDescription); - span.setAttribute(SENTRY_SEGMENT_NAME_SOURCE, undefined); } type NestedArray = Array | T>; diff --git a/packages/server-utils/test/integrations/redis/redis-cache.test.ts b/packages/server-utils/test/integrations/redis/redis-cache.test.ts index 7ea7f33bde90..cf0a62feaef4 100644 --- a/packages/server-utils/test/integrations/redis/redis-cache.test.ts +++ b/packages/server-utils/test/integrations/redis/redis-cache.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { applyRedisCacheAttributes, @@ -54,6 +55,7 @@ describe('redis cache', () => { expect(mockSpan.updateName).toHaveBeenCalledWith( 'cache:very-long-key-name, cache:very-long-key-name-2, cache:very-long-key-name-3', ); + expect(mockSpan.setAttribute).not.toHaveBeenCalledWith(SENTRY_SEGMENT_NAME_SOURCE, undefined); }); it('should truncate span name when maxCacheKeyLength is set', () => { From 4cd20d0537032df08be8b7950414f59290cec030 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Tue, 25 Aug 2026 14:15:32 +0200 Subject: [PATCH 12/13] chore(core): Format child-span name-source warning Co-Authored-By: Cursor Grok 4.6 --- packages/core/src/tracing/sentrySpan.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index 694e0232b068..8cb9bc95cbf8 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -180,9 +180,7 @@ export class SentrySpan implements Span { // Allow `undefined` so `addChildSpanToSpan` can strip a leaked constructor-time value. if (key === SENTRY_SEGMENT_NAME_SOURCE && value !== undefined && !spanIsSegment(this)) { DEBUG_BUILD && - debug.warn( - '[Tracing] Ignoring name source on a child span: this attribute is only valid on the root span.', - ); + debug.warn('[Tracing] Ignoring name source on a child span: this attribute is only valid on the root span.'); return this; } From 56c37cf3e171502c7bbcaf2406f4afa9613be192 Mon Sep 17 00:00:00 2001 From: RulaKhaled Date: Tue, 25 Aug 2026 14:15:48 +0200 Subject: [PATCH 13/13] chore(core): Format child-span name-source warning Co-Authored-By: Cursor Grok 4.6 --- packages/core/src/tracing/sentrySpan.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index 694e0232b068..8cb9bc95cbf8 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -180,9 +180,7 @@ export class SentrySpan implements Span { // Allow `undefined` so `addChildSpanToSpan` can strip a leaked constructor-time value. if (key === SENTRY_SEGMENT_NAME_SOURCE && value !== undefined && !spanIsSegment(this)) { DEBUG_BUILD && - debug.warn( - '[Tracing] Ignoring name source on a child span: this attribute is only valid on the root span.', - ); + debug.warn('[Tracing] Ignoring name source on a child span: this attribute is only valid on the root span.'); return this; }