diff --git a/packages/browser-utils/src/performance/entries.ts b/packages/browser-utils/src/performance/entries.ts index f28e60f1cb3e..ce03b8405d7c 100644 --- a/packages/browser-utils/src/performance/entries.ts +++ b/packages/browser-utils/src/performance/entries.ts @@ -6,7 +6,6 @@ import { getActiveSpan, parseUrl, RESOURCE_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setMeasurement, spanToJSON, filterCollectedUrl, @@ -28,6 +27,7 @@ import { URL_DOMAIN, URL_FULL, URL_SCHEME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { BROWSER_CACHE, @@ -123,7 +123,7 @@ export function startTrackingLongTasks(): void { name: UI_LONG_TASK_SPAN_NAME_FALLBACK, op: UI_LONG_TASK, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }, }); } @@ -164,7 +164,7 @@ export function startTrackingLongAnimationFrames(): void { const duration = msToSec(entry.duration); const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', }; const initialScript = entry.scripts[0]; @@ -291,7 +291,7 @@ export function _addPaintSpan( name: entry.name, attributes: { [SENTRY_OP]: BROWSER_PAINT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', [BROWSER_PAINT_TYPE]: entry.name, }, }); @@ -370,7 +370,7 @@ function _addPerformanceNavigationTiming( name: spanStreamingEnabled ? BROWSER_NAVIGATION_TIMING_SPAN_NAMES[op] : entry.name, attributes: { [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', [URL_FULL]: filterCollectedUrl(entry.name), ...(event === 'redirect' && entry.redirectCount != null ? { 'http.redirect_count': entry.redirectCount } : {}), }, @@ -411,7 +411,7 @@ function _addRequest( name: spanStreamingEnabled ? BROWSER_NAVIGATION_TIMING_SPAN_NAMES[BROWSER_REQUEST] : entry.name, attributes: { [SENTRY_OP]: BROWSER_REQUEST, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', [URL_FULL]: url, }, }); @@ -420,7 +420,7 @@ function _addRequest( name: spanStreamingEnabled ? BROWSER_NAVIGATION_TIMING_SPAN_NAMES[BROWSER_RESPONSE] : entry.name, attributes: { [SENTRY_OP]: BROWSER_RESPONSE, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + [SENTRY_ORIGIN]: 'auto.ui.browser.metrics', [URL_FULL]: url, }, }); @@ -453,7 +453,7 @@ export function _addResourceSpans( } const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', }; const parsedUrl = parseUrl(resourceUrl); diff --git a/packages/browser-utils/src/web-vitals/emitSpan.ts b/packages/browser-utils/src/web-vitals/emitSpan.ts index ed3602f35e6f..5e25931f4bf8 100644 --- a/packages/browser-utils/src/web-vitals/emitSpan.ts +++ b/packages/browser-utils/src/web-vitals/emitSpan.ts @@ -1,5 +1,5 @@ import type { Integration, Span, SpanAttributes } from '@sentry/core'; -import { getClient, getCurrentScope, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core'; +import { getClient, getCurrentScope, getRootSpan, spanToJSON } from '@sentry/core'; import { startInactiveSpan } from '@sentry/core/browser'; import { SENTRY_EXCLUSIVE_TIME, @@ -10,6 +10,7 @@ import { SENTRY_TRANSACTION, USER_AGENT_ORIGINAL, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { WINDOW } from '../types'; import type { MetricNavigationType } from '../instrumentation/performanceObserver'; @@ -85,7 +86,7 @@ export function _emitWebVitalSpan(options: WebVitalSpanOptions): void { const segmentName = segmentSpan ? spanToJSON(segmentSpan).name : getCurrentScope().getScopeData().transactionName; const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, + [SENTRY_ORIGIN]: origin, [SENTRY_OP]: op, [SENTRY_EXCLUSIVE_TIME]: 0, [`browser.web_vital.${metricName}.value`]: value, diff --git a/packages/browser-utils/test/performance/browserMetrics.test.ts b/packages/browser-utils/test/performance/browserMetrics.test.ts index bb87c4d64750..f9dcccabb0b4 100644 --- a/packages/browser-utils/test/performance/browserMetrics.test.ts +++ b/packages/browser-utils/test/performance/browserMetrics.test.ts @@ -1,13 +1,6 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '@sentry/core'; -import { - getClient, - getMainCarrier, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SentrySpan, - setCurrentClient, - spanToJSON, -} from '@sentry/core'; +import { getClient, getMainCarrier, SentrySpan, setCurrentClient, spanToJSON } from '@sentry/core'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { _addNavigationSpans, @@ -247,7 +240,7 @@ describe('_addResourceSpans', () => { end_timestamp: timeOrigin + startTime + duration, attributes: { [SENTRY_OP]: 'resource.css', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', ['http.response.body.decoded_size']: entry.decodedBodySize, ['http.response.body.size']: entry.encodedBodySize, ['http.response.size']: entry.transferSize, @@ -430,7 +423,7 @@ describe('_addResourceSpans', () => { expect.objectContaining({ attributes: expect.objectContaining({ [SENTRY_OP]: 'resource.css', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', ['http.response.body.decoded_size']: entry.decodedBodySize, ['http.response.body.size']: entry.encodedBodySize, ['http.response.size']: entry.transferSize, @@ -469,7 +462,7 @@ describe('_addResourceSpans', () => { expect.objectContaining({ attributes: expect.objectContaining({ [SENTRY_OP]: 'resource.css', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'example.com', 'url.domain': 'example.com', 'http.request.same_origin': true, @@ -521,7 +514,7 @@ describe('_addResourceSpans', () => { expect.objectContaining({ attributes: { [SENTRY_OP]: 'resource.css', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.resource.browser.metrics', + [SENTRY_ORIGIN]: 'auto.resource.browser.metrics', 'server.address': 'example.com', 'url.domain': 'example.com', 'http.request.same_origin': true, diff --git a/packages/core/src/fetch.ts b/packages/core/src/fetch.ts index aaf83ef25d82..76ef3892bea1 100644 --- a/packages/core/src/fetch.ts +++ b/packages/core/src/fetch.ts @@ -9,11 +9,11 @@ import { URL_FRAGMENT, URL_FULL, URL_QUERY, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; import type { Client } from './client'; import { getClient } from './currentScopes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; import { setHttpStatus, SPAN_STATUS_ERROR, spanIsIgnored } from './tracing'; import { startInactiveSpan } from './tracing/trace'; import { SentryNonRecordingSpan } from './tracing/sentryNonRecordingSpan'; @@ -385,7 +385,7 @@ function getFetchSpanAttributes( type: 'fetch', // oxlint-disable-next-line typescript/no-deprecated [HTTP_REQUEST_METHOD]: method, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, + [SENTRY_ORIGIN]: spanOrigin, [SENTRY_OP]: HTTP_CLIENT, [URL_DOMAIN]: domain, }; diff --git a/packages/core/src/integrations/http/server-subscription.ts b/packages/core/src/integrations/http/server-subscription.ts index 3ef8edbf0a49..8427c699e031 100644 --- a/packages/core/src/integrations/http/server-subscription.ts +++ b/packages/core/src/integrations/http/server-subscription.ts @@ -39,7 +39,6 @@ import { continueTrace, startSpanManual } from '../../tracing/trace'; import { getSpanStatusFromHttpCode, SPAN_STATUS_ERROR } from '../../tracing'; import { hasSpanStreamingEnabled } from '../../tracing/spans/hasSpanStreamingEnabled'; import { HTTP_SPAN_NAME_FALLBACK } from '../../tracing/spans/spanNames'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { safeMathRandom } from '../../utils/randomSafeContext'; import type { SpanStatus } from '../../types/spanStatus'; import { @@ -66,6 +65,7 @@ import { URL_QUERY, URL_SCHEME, USER_AGENT_ORIGINAL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; import { filterCollectedUrl, filterCollectedUrlQuery } from '../../utils/data-collection/filterCollectedUrl'; @@ -326,7 +326,7 @@ function buildServerSpanWrap( attributes: { // Sentry-specific attributes [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.server', + [SENTRY_ORIGIN]: 'auto.http.server', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [SENTRY_KIND]: 'server', // Network attributes diff --git a/packages/core/src/integrations/mcp-server/spans.ts b/packages/core/src/integrations/mcp-server/spans.ts index 9159ce497122..b380da55e5a8 100644 --- a/packages/core/src/integrations/mcp-server/spans.ts +++ b/packages/core/src/integrations/mcp-server/spans.ts @@ -6,13 +6,12 @@ */ import { getClient } from '../../currentScopes'; -import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { MCP_NOTIFICATION_CLIENT_TO_SERVER, MCP_NOTIFICATION_SERVER_TO_CLIENT, MCP_SERVER, } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes'; import { hasSpanStreamingEnabled } from '../../tracing/spans/hasSpanStreamingEnabled'; import { MCP_NOTIFICATION_SPAN_NAME_FALLBACK, MCP_SERVER_SPAN_NAME_FALLBACK } from '../../tracing/spans/spanNames'; import { startSpan } from '../../tracing/trace'; @@ -72,7 +71,7 @@ function buildSentryAttributes(type: McpSpanConfig['type']): Record = {}) => { diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index 7d149353da1a..f0285f63eb27 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -6,8 +6,9 @@ import { SENTRY_EXCLUSIVE_TIME, SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '../semanticAttributes'; import type { Client } from '../client'; import type { TransactionEvent } from '../types/event'; import type { SpanLink } from '../types/link'; @@ -103,7 +104,7 @@ export class SentrySpan implements Span { this._attributes = {}; this.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SENTRY_OP]: spanContext.op, ...spanContext.attributes, }); @@ -278,7 +279,7 @@ export class SentrySpan implements Span { status: getStatusMessage(this._status), timestamp: this._endTime, trace_id: this._traceId, - origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined, + origin: this._attributes[SENTRY_ORIGIN] as SpanOrigin | undefined, profile_id: this._attributes[SENTRY_PROFILE_ID] as string | undefined, exclusive_time: this._attributes[SENTRY_EXCLUSIVE_TIME] as number | undefined, measurements: timedEventsToMeasurements(this._events), diff --git a/packages/core/src/trpc.ts b/packages/core/src/trpc.ts index 55e428f60458..d84f6f16f17b 100644 --- a/packages/core/src/trpc.ts +++ b/packages/core/src/trpc.ts @@ -5,11 +5,11 @@ import { SENTRY_SEGMENT_NAME_SOURCE, TRPC_PROCEDURE_PATH, TRPC_PROCEDURE_TYPE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { RPC } from '@sentry/conventions/op'; import { getClient, withIsolationScope } from './currentScopes'; import { captureException } from './exports'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; import { startSpanManual } from './tracing/trace'; import { normalize } from './utils/normalize'; import { setNormalizationDepthOverrideHint } from './utils/normalizationHints'; @@ -97,7 +97,7 @@ export function trpcMiddleware(options: SentryTrpcMiddlewareOptions = {}) { attributes: { [SENTRY_OP]: RPC, [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.rpc.trpc', + [SENTRY_ORIGIN]: 'auto.rpc.trpc', [RPC_SYSTEM_NAME]: 'trpc', [RPC_METHOD]: String(path), [TRPC_PROCEDURE_PATH]: String(path), diff --git a/packages/core/src/utils/spanUtils.ts b/packages/core/src/utils/spanUtils.ts index a643caeccaba..e1615b9bf5c4 100644 --- a/packages/core/src/utils/spanUtils.ts +++ b/packages/core/src/utils/spanUtils.ts @@ -5,8 +5,13 @@ import { serializeAttributes } from '../attributes'; import { getMainCarrier } from '../carrier'; import { getCurrentScope } from '../currentScopes'; import type { Scope } from '../scope'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_STATUS_MESSAGE, SENTRY_OP } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_STATUS_MESSAGE, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; +import { SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME } from '../semanticAttributes'; import type { SentrySpan } from '../tracing/sentrySpan'; import { isStatusErrorMessageValid, SPAN_STATUS_OK, SPAN_STATUS_UNSET } from '../tracing/spanstatus'; import { getCapturedScopesOnSpan } from '../tracing/utils'; @@ -187,7 +192,7 @@ export function spanToStaticSpanJSON(span: Span): SpanJSON { timestamp: spanTimeInputToSeconds(endTime) || undefined, status: getStatusMessage(status), op: attributes[SENTRY_OP], - origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined, + origin: attributes[SENTRY_ORIGIN] as SpanOrigin | undefined, links: convertSpanLinksForEnvelope(links), }; } diff --git a/packages/core/src/utils/url.ts b/packages/core/src/utils/url.ts index d7f45141a342..3a0a5fca186c 100644 --- a/packages/core/src/utils/url.ts +++ b/packages/core/src/utils/url.ts @@ -11,8 +11,8 @@ import { SENTRY_SEGMENT_NAME_SOURCE, URL_SCHEME, URL_TEMPLATE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; import type { Client } from '../client'; import type { SpanAttributes } from '../types/span'; import type { TransactionSource } from '../types/transaction'; @@ -210,7 +210,7 @@ export function getHttpSpanDetailsFromUrlObject( client?: Client, ): [name: string, attributes: SpanAttributes] { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, + [SENTRY_ORIGIN]: spanOrigin, }; let nameSource: TransactionSource = 'url'; diff --git a/packages/core/test/lib/tracing/spans/captureSpan.test.ts b/packages/core/test/lib/tracing/spans/captureSpan.test.ts index 5f72e42a622b..968e9a68be1b 100644 --- a/packages/core/test/lib/tracing/spans/captureSpan.test.ts +++ b/packages/core/test/lib/tracing/spans/captureSpan.test.ts @@ -3,7 +3,6 @@ import type { Contexts, Span, StreamedSpanJSON } from '../../../../src'; import { captureSpan, debug, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, spanStreamingIntegration, startInactiveSpan, @@ -33,6 +32,7 @@ import { SENTRY_RELEASE, SENTRY_SDK_INTEGRATIONS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; describe('captureSpan', () => { @@ -81,7 +81,7 @@ describe('captureSpan', () => { type: 'string', value: 'http.client', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -177,7 +177,7 @@ describe('captureSpan', () => { type: 'string', value: 'http.client', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -273,7 +273,7 @@ describe('captureSpan', () => { type: 'string', value: 'http.client', }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { + [SENTRY_ORIGIN]: { type: 'string', value: 'manual', }, @@ -351,7 +351,7 @@ describe('captureSpan', () => { attributes: { [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, [SENTRY_OP]: { type: 'string', value: 'http.client' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, [SENTRY_SEGMENT_NAME]: { value: 'my-span', type: 'string' }, [SENTRY_SEGMENT_ID]: { value: span.spanContext().spanId, type: 'string' }, diff --git a/packages/core/test/lib/tracing/trace.test.ts b/packages/core/test/lib/tracing/trace.test.ts index 9f54b7e693c9..5d7ab473b1b8 100644 --- a/packages/core/test/lib/tracing/trace.test.ts +++ b/packages/core/test/lib/tracing/trace.test.ts @@ -6,7 +6,6 @@ import { getMainCarrier, getTraceData, Scope, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setAsyncContextStrategy, setCurrentClient, spanToJSON, @@ -32,7 +31,7 @@ import { getActiveSpan, getRootSpan, getSpanDescendants, spanIsSampled } from '. import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; import { SUPPRESS_TRACING_KEY } from '../../../src/tracing/constants'; import { resetGlobals } from '../../testutils'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; const enum Type { Sync = 'sync', @@ -179,7 +178,7 @@ describe('startSpan', () => { await startSpan( { name: 'GET users/[id]', - attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser' }, + attributes: { [SENTRY_ORIGIN]: 'auto.http.browser' }, }, () => { return callback(); diff --git a/packages/core/test/lib/utils/spanUtils.test.ts b/packages/core/test/lib/utils/spanUtils.test.ts index c11a2fa3317d..032a09ce1667 100644 --- a/packages/core/test/lib/utils/spanUtils.test.ts +++ b/packages/core/test/lib/utils/spanUtils.test.ts @@ -1,10 +1,9 @@ -import { SENTRY_LINK_TYPE, SENTRY_STATUS_MESSAGE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_LINK_TYPE, SENTRY_STATUS_MESSAGE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { beforeEach, describe, expect, it, test } from 'vitest'; import { convertSpanLinksForEnvelope, getCurrentScope, Scope, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, SentrySpan, setCurrentClient, @@ -343,7 +342,7 @@ describe('spanToStaticSpanJSON', () => { traceId: 'abcd', startTimestamp: 123, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', }, }); span.setStatus({ code: SPAN_STATUS_OK }); @@ -400,7 +399,7 @@ describe('spanToStaticSpanJSON', () => { attr1: 'value1', attr2: 2, [SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', }, status: { code: SPAN_STATUS_ERROR, message: 'unknown_error' }, }); @@ -417,7 +416,7 @@ describe('spanToStaticSpanJSON', () => { attr1: 'value1', attr2: 2, [SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', }, status: 'unknown_error', }); @@ -437,7 +436,7 @@ describe('spanToStaticSpanJSON', () => { status: 'ok', is_segment: true, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', }, }); }); @@ -451,7 +450,7 @@ describe('spanToStaticSpanJSON', () => { traceId: 'abcd', startTimestamp: 123, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', attr1: 'value1', attr2: 2, attr3: true, @@ -488,7 +487,7 @@ describe('spanToStaticSpanJSON', () => { attr3: true, attr4: [1, 2, 3], [SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', }, links: [ { @@ -586,7 +585,7 @@ describe('spanToStaticSpanJSON', () => { attr1: 'value1', attr2: 2, [SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', }, links: [ { @@ -616,7 +615,7 @@ describe('spanToStaticSpanJSON', () => { attr1: 'value1', attr2: 2, [SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', [SENTRY_STATUS_MESSAGE]: 'unknown_error', }, links: [ @@ -683,7 +682,7 @@ describe('spanToStaticSpanJSON', () => { attr3: true, attr4: [1, 2, 3], [SENTRY_OP]: 'test op', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto', + [SENTRY_ORIGIN]: 'auto', }, links: [ { @@ -712,7 +711,7 @@ describe('spanToStaticSpanJSON', () => { attr3: { type: 'boolean', value: true }, attr4: { type: 'array', value: [1, 2, 3] }, [SENTRY_OP]: { type: 'string', value: 'test op' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto' }, }, links: [ { diff --git a/packages/effect/src/logger.ts b/packages/effect/src/logger.ts index f0a55b3bf20e..a5fc7fe6923d 100644 --- a/packages/effect/src/logger.ts +++ b/packages/effect/src/logger.ts @@ -1,9 +1,10 @@ -import { isObjectLike, logger as sentryLogger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { isObjectLike, logger as sentryLogger } from '@sentry/core'; import * as Logger from 'effect/Logger'; import type * as LogLevel from 'effect/LogLevel'; const LOG_ATTRIBUTES = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.log.effect', + [SENTRY_ORIGIN]: 'auto.log.effect', }; function getLogLevelTag(logLevel: LogLevel.LogLevel): LogLevel.LogLevel | 'Warning' { diff --git a/packages/effect/src/tracer.ts b/packages/effect/src/tracer.ts index 2e72e3c61fc0..f25ce111b180 100644 --- a/packages/effect/src/tracer.ts +++ b/packages/effect/src/tracer.ts @@ -1,5 +1,5 @@ /* oxlint-disable max-lines */ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HTTP_CLIENT, HTTP_SERVER } from '@sentry/conventions/op'; import type { Span, StartSpanOptions } from '@sentry/core'; import { @@ -9,7 +9,6 @@ import { getCurrentScope, getDefaultCurrentScope, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startNewTrace, withActiveSpan, withScope, @@ -390,7 +389,7 @@ function createSentrySpan( // Setting these to `undefined` would strip the core defaults instead of leaving them in place. attributes: { ...(op && { [SENTRY_OP]: op }), - ...(origin && { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin }), + ...(origin && { [SENTRY_ORIGIN]: origin }), }, }, parent, diff --git a/packages/effect/test/tracer.test.ts b/packages/effect/test/tracer.test.ts index 66ccf6cb9e0a..c1f4a767da93 100644 --- a/packages/effect/test/tracer.test.ts +++ b/packages/effect/test/tracer.test.ts @@ -1,8 +1,7 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { describe, expect, it } from '@effect/vitest'; import * as sentryCore from '@sentry/core'; import * as sentryCoreBrowser from '@sentry/core/browser'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { ServerRuntimeClient } from '@sentry/core/server'; import { Effect } from 'effect'; import * as Tracer from 'effect/Tracer'; @@ -202,9 +201,9 @@ describe.each(VARIANTS)('SentryEffectTracer ($variant)', ({ variant, tracer, spa Effect.gen(function* () { const attributes = yield* attributesFor('my-operation'); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBeUndefined(); + expect(attributes?.[SENTRY_ORIGIN]).toBeUndefined(); expect(attributes?.[SENTRY_OP]).toBeUndefined(); - expect(attributes).not.toHaveProperty(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN); + expect(attributes).not.toHaveProperty(SENTRY_ORIGIN); expect(attributes).not.toHaveProperty(SENTRY_OP); }), ); @@ -213,7 +212,7 @@ describe.each(VARIANTS)('SentryEffectTracer ($variant)', ({ variant, tracer, spa Effect.gen(function* () { const attributes = yield* attributesFor('http.server GET /api/users'); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.effect'); + expect(attributes?.[SENTRY_ORIGIN]).toBe('auto.http.effect'); expect(attributes?.[SENTRY_OP]).toBe('http.server'); }), ); @@ -222,7 +221,7 @@ describe.each(VARIANTS)('SentryEffectTracer ($variant)', ({ variant, tracer, spa Effect.gen(function* () { const attributes = yield* attributesFor('http.client GET https://api.example.com'); - expect(attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toBe('auto.http.effect'); + expect(attributes?.[SENTRY_ORIGIN]).toBe('auto.http.effect'); expect(attributes?.[SENTRY_OP]).toBe('http.client'); }), ); diff --git a/packages/opentelemetry/test/integration/transactions.test.ts b/packages/opentelemetry/test/integration/transactions.test.ts index 4ff73f163f0c..21f24a0f8555 100644 --- a/packages/opentelemetry/test/integration/transactions.test.ts +++ b/packages/opentelemetry/test/integration/transactions.test.ts @@ -1,16 +1,9 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { SpanContext } from '@opentelemetry/api'; import { context, ROOT_CONTEXT, trace, TraceFlags } from '@opentelemetry/api'; import { TraceState } from '../../src/utils/TraceState'; import type { Event, TransactionEvent } from '@sentry/core'; -import { - addBreadcrumb, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - setTag, - startInactiveSpan, - startSpan, - withIsolationScope, -} from '@sentry/core'; +import { addBreadcrumb, setTag, startInactiveSpan, startSpan, withIsolationScope } from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { SENTRY_TRACE_STATE_DSC } from '../../src/constants'; import { makeTraceState } from '../../src/utils/makeTraceState'; @@ -44,7 +37,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }, span => { @@ -168,7 +161,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, @@ -324,7 +317,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, @@ -438,7 +431,7 @@ describe('Integration | Transactions', () => { op: 'test op', name: 'test name', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, diff --git a/packages/opentelemetry/test/trace.test.ts b/packages/opentelemetry/test/trace.test.ts index 957f034b801d..448692f6a505 100644 --- a/packages/opentelemetry/test/trace.test.ts +++ b/packages/opentelemetry/test/trace.test.ts @@ -1,7 +1,7 @@ /* eslint-disable typescript/no-deprecated */ import type { Span, TimeInput } from '@opentelemetry/api'; import { context, ROOT_CONTEXT, trace, TraceFlags } from '@opentelemetry/api'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_KIND, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Event, Scope } from '@sentry/core'; import { getCapturedScopesOnSpan, @@ -10,7 +10,6 @@ import { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, spanToJSON, startInactiveSpan, @@ -210,7 +209,7 @@ describe('trace', () => { span => { expect(span).toBeDefined(); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }); @@ -223,14 +222,14 @@ describe('trace', () => { op: 'my-op', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', + [SENTRY_ORIGIN]: 'auto.test.origin', }, }, span => { expect(span).toBeDefined(); expect(getSpanAttributes(span)).toEqual({ [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', + [SENTRY_ORIGIN]: 'auto.test.origin', [SENTRY_OP]: 'my-op', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, }); @@ -256,7 +255,7 @@ describe('trace', () => { expect(getSpanName(span)).toEqual('outer'); expect(getSpanStartTime(span)).toEqual(date); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1', @@ -607,7 +606,7 @@ describe('trace', () => { expect(span).toBeDefined(); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', }); @@ -617,7 +616,7 @@ describe('trace', () => { op: 'my-op', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', + [SENTRY_ORIGIN]: 'auto.test.origin', }, }); @@ -625,7 +624,7 @@ describe('trace', () => { expect(getSpanAttributes(span2)).toEqual({ [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test.origin', + [SENTRY_ORIGIN]: 'auto.test.origin', [SENTRY_OP]: 'my-op', }); }); @@ -647,7 +646,7 @@ describe('trace', () => { expect(getSpanName(span)).toEqual('outer'); expect(getSpanStartTime(span)).toEqual(date); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1', @@ -980,7 +979,7 @@ describe('trace', () => { expect(getSpanName(span)).toEqual('outer'); expect(getSpanStartTime(span)).toEqual(date); expect(getSpanAttributes(span)).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', test1: 'test 1',