Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions packages/browser-utils/src/performance/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
getActiveSpan,
parseUrl,
RESOURCE_SPAN_NAME_FALLBACK,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
setMeasurement,
spanToJSON,
filterCollectedUrl,
Expand All @@ -28,6 +27,7 @@ import {
URL_DOMAIN,
URL_FULL,
URL_SCHEME,
SENTRY_ORIGIN,
} from '@sentry/conventions/attributes';
import {
BROWSER_CACHE,
Expand Down Expand Up @@ -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',
},
});
}
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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,
},
});
Expand Down Expand Up @@ -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 } : {}),
},
Expand Down Expand Up @@ -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,
},
});
Expand All @@ -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,
},
});
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions packages/browser-utils/src/web-vitals/emitSpan.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
19 changes: 6 additions & 13 deletions packages/browser-utils/test/performance/browserMetrics.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/integrations/http/server-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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';
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/integrations/mcp-server/spans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -72,7 +71,7 @@ function buildSentryAttributes(type: McpSpanConfig['type']): Record<string, stri

return {
[SENTRY_OP]: op,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin,
[SENTRY_ORIGIN]: origin,
[SENTRY_SEGMENT_NAME_SOURCE]: MCP_ROUTE_SOURCE_VALUE,
};
}
Expand Down
7 changes: 3 additions & 4 deletions packages/core/src/integrations/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-lines */
import { DB_OPERATION_NAME, DB_SYSTEM_NAME, SENTRY_OP } from '@sentry/conventions/attributes';
import { DB_OPERATION_NAME, DB_SYSTEM_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
import { DB } from '@sentry/conventions/op';
import { addBreadcrumb } from '../breadcrumbs';
import { getClient } from '../currentScopes';
import { DEBUG_BUILD } from '../debug-build';
import { captureException } from '../exports';
import { defineIntegration } from '../integration';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes';
import { setHttpStatus, SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '../tracing';
import { hasSpanStreamingEnabled } from '../tracing/spans/hasSpanStreamingEnabled';
import { startSpanManual } from '../tracing/trace';
Expand Down Expand Up @@ -297,7 +296,7 @@ function instrumentAuthOperation(operation: AuthOperationFn, isAdmin = false): A
{
name,
attributes: {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.supabase',
[SENTRY_ORIGIN]: 'auto.db.supabase',
[SENTRY_OP]: DB,
[DB_SYSTEM_NAME]: 'postgresql',
[DB_OPERATION_NAME]: operationName,
Expand Down Expand Up @@ -464,7 +463,7 @@ function instrumentPostgRESTFilterBuilder(
'db.sdk': getHeader(typedThis.headers, 'X-Client-Info'),
[DB_SYSTEM_NAME]: 'postgresql',
[DB_OPERATION_NAME]: operation,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.supabase',
[SENTRY_ORIGIN]: 'auto.db.supabase',
[SENTRY_OP]: DB,
};

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/logs/console-integration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SENTRY_ORIGIN } from '@sentry/conventions/attributes';
import { getClient } from '../currentScopes';
import { addConsoleInstrumentationHandler } from '../instrument/console';
import { defineIntegration } from '../integration';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes';
import type { ConsoleLevel } from '../types/instrument';
import type { IntegrationFn } from '../types/integration';
import { CONSOLE_LEVELS } from '../utils/debug-logger';
Expand All @@ -17,7 +17,7 @@ interface CaptureConsoleOptions {
const INTEGRATION_NAME = 'ConsoleLogs' as const;

const DEFAULT_ATTRIBUTES = {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.log.console',
[SENTRY_ORIGIN]: 'auto.log.console',
};

const _consoleLoggingIntegration = ((options: Partial<CaptureConsoleOptions> = {}) => {
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/tracing/sentrySpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
Expand Down
11 changes: 8 additions & 3 deletions packages/core/src/utils/spanUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down
Loading
Loading