From daab9090449ea0298520e432d342456697f07299 Mon Sep 17 00:00:00 2001 From: Nicolas Hrubec Date: Mon, 5 Oct 2026 11:20:49 +0200 Subject: [PATCH] ref(server): Use SENTRY_ORIGIN convention constant Co-Authored-By: GPT-6 --- .../suites/public-api/startSpan/test.ts | 13 ++-- .../suites/tracing/d1/test.ts | 5 +- .../suites/tracing/durableobject-sql/test.ts | 7 +- .../tracing/durableobject-sync-kv/test.ts | 5 +- .../suites/tracing/scheduled/test.ts | 6 +- .../suites/tracing/workflow/test.ts | 6 +- .../suites/fs-instrumentation/test.ts | 51 +++++++------- .../startSpan/basic-usage-streamed/test.ts | 11 +-- .../suites/tracing/groq/test.ts | 6 +- .../suites/tracing/langgraph/test.ts | 4 +- .../suites/tracing/mistral/test.ts | 12 ++-- .../tracing/openai/openai-tool-calls/test.ts | 18 ++--- .../suites/tracing/openai/test.ts | 68 +++++++++---------- .../suites/tracing/openai/v6/test.ts | 42 ++++++------ .../suites/tracing/openai/v7/test.ts | 10 +-- .../suites/tracing/together-ai/test.ts | 6 +- .../vercelai/span-streaming-v4/test.ts | 32 ++++----- .../vercelai/span-streaming-v6/test.ts | 32 ++++----- packages/bun/src/integrations/bunserver.ts | 4 +- .../agents/instrumentAgentCallableRpc.ts | 6 +- .../instrumentDurableObjectStorage.ts | 6 +- .../instrumentDurableObjectSyncKvStorage.ts | 6 +- .../instrumentations/instrumentSqlStorage.ts | 13 +--- .../instrumentations/worker/instrumentD1.ts | 15 ++-- .../worker/instrumentQueue.ts | 6 +- .../worker/instrumentQueueProducer.ts | 6 +- .../instrumentations/worker/instrumentR2.ts | 5 +- packages/cloudflare/src/workflows.ts | 19 +++--- .../instrumentDurableObjectStorage.test.ts | 26 +++---- ...strumentDurableObjectSyncKvStorage.test.ts | 10 +-- .../test/instrumentSqlStorage.test.ts | 10 +-- packages/deno/src/opentelemetry/tracer.ts | 7 +- packages/elysia/src/withElysia.ts | 8 +-- .../src/gcpfunction/cloud_events.ts | 4 +- .../src/gcpfunction/http.ts | 4 +- .../src/integrations/google-cloud-grpc.ts | 6 +- .../src/integrations/google-cloud-http.ts | 12 +++- .../test/gcpfunction/cloud_event.test.ts | 17 ++--- .../test/gcpfunction/events.test.ts | 17 ++--- .../test/gcpfunction/http.test.ts | 7 +- .../integrations/google-cloud-grpc.test.ts | 6 +- .../integrations/google-cloud-http.test.ts | 14 ++-- packages/nestjs/src/decorators.ts | 6 +- packages/nestjs/src/integrations/helpers.ts | 15 ++-- .../nestjs/src/integrations/wrap-route.ts | 8 +-- packages/nestjs/test/decorators.test.ts | 9 ++- .../test/integrations/span-origin.test.ts | 8 +-- .../fs/vendored/instrumentation.ts | 5 +- .../http/httpServerSpansIntegration.ts | 4 +- .../node-fetch/undici-instrumentation.ts | 4 +- packages/node/src/utils/addOriginToSpan.ts | 4 +- .../test/integration/transactions.test.ts | 9 ++- .../node/test/integrations/undici.test.ts | 4 +- .../server-utils/src/ai/anthropic-ai/index.ts | 12 +--- packages/server-utils/src/ai/flue/index.ts | 10 ++- packages/server-utils/src/ai/flue/utils.ts | 14 ++-- .../server-utils/src/ai/google-genai/index.ts | 4 +- .../src/ai/langchain/embeddings.ts | 11 +-- .../server-utils/src/ai/langchain/index.ts | 14 ++-- .../server-utils/src/ai/langchain/utils.ts | 5 +- .../server-utils/src/ai/langgraph/index.ts | 5 +- .../server-utils/src/ai/langgraph/utils.ts | 5 +- packages/server-utils/src/ai/mastra/index.ts | 5 +- packages/server-utils/src/ai/mistral/index.ts | 11 +-- packages/server-utils/src/ai/openai/index.ts | 4 +- .../server-utils/src/ai/typesafe/index.ts | 12 +--- .../server-utils/src/ai/workers-ai/utils.ts | 5 +- .../server-utils/src/integrations/amqplib.ts | 6 +- .../src/integrations/anthropic.ts | 5 +- .../src/integrations/aws-sdk/index.ts | 5 +- .../src/integrations/dataloader.ts | 4 +- .../integrations/express/instrumentation.ts | 5 +- .../integrations/fastify/instrumentation.ts | 6 +- .../src/integrations/firebase/firestore.ts | 5 +- .../src/integrations/firebase/functions.ts | 4 +- .../src/integrations/generic-pool.ts | 6 +- .../src/integrations/google-genai.ts | 3 +- .../graphql/graphql-dc-subscriber.ts | 17 ++--- .../src/integrations/graphql/resolvers.ts | 5 +- .../src/integrations/graphql/spans.ts | 11 +-- .../src/integrations/hapi/hapi-utils.ts | 5 +- .../src/integrations/hono/honoIntegration.ts | 6 +- .../src/integrations/hono/patchAppRequest.ts | 13 +--- .../integrations/hono/wrapMiddlewareSpan.ts | 5 +- .../src/integrations/kafkajs/spans.ts | 6 +- .../server-utils/src/integrations/knex.ts | 4 +- .../src/integrations/koa/index.ts | 5 +- .../server-utils/src/integrations/mistral.ts | 10 +-- .../src/integrations/mongodb/mongodb-span.ts | 11 +-- .../mongoose/mongoose-dc-subscriber.ts | 12 +--- .../mongoose/mongoose-legacy-span.ts | 5 +- .../server-utils/src/integrations/mysql.ts | 4 +- .../src/integrations/mysql2/index.ts | 4 +- .../mysql2/mysql2-dc-subscriber.ts | 7 +- .../src/integrations/openai-compatible.ts | 5 +- .../server-utils/src/integrations/openai.ts | 4 +- .../src/integrations/postgres-js.ts | 4 +- .../server-utils/src/integrations/postgres.ts | 4 +- .../src/integrations/prisma/orchestrion.ts | 13 +--- .../src/integrations/prisma/tracing-helper.ts | 4 +- .../src/integrations/redis/index.ts | 6 +- .../redis/ioredis-channel-subscriber.ts | 5 +- .../integrations/redis/redis-dc-subscriber.ts | 9 +-- .../server-utils/src/integrations/tedious.ts | 4 +- .../vercel-ai/vercel-ai-dc-subscriber.ts | 6 +- .../test/ai/lib/tracing/workers-ai.test.ts | 6 +- .../ai/lib/utils/workers-ai-utils.test.ts | 6 +- 107 files changed, 468 insertions(+), 548 deletions(-) diff --git a/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan/test.ts b/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan/test.ts index 00d89567b577..0fa5d410368b 100644 --- a/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/public-api/startSpan/test.ts @@ -1,4 +1,4 @@ -import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; +import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_SDK_NAME, @@ -10,6 +10,7 @@ import { SENTRY_RELEASE, SENTRY_SDK_INTEGRATIONS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import { createRunner } from '../../../runner'; @@ -85,7 +86,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName }, [SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, }, name: 'test-child-span', @@ -104,7 +105,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa attributes: { 'sentry.is_localhost': { value: true, type: 'boolean' }, [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, @@ -141,7 +142,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa attributes: { 'sentry.is_localhost': { value: true, type: 'boolean' }, [SENTRY_TRACE_LIFECYCLE]: { type: 'string', value: 'stream' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SENTRY_SDK_NAME]: { type: 'string', value: CLOUDFLARE_SDK }, [SENTRY_SDK_VERSION]: { type: 'string', value: SDK_VERSION }, [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, @@ -169,7 +170,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName }, [SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, }, name: 'test-span', @@ -193,7 +194,7 @@ it('sends a streamed span envelope with correct spans for a manually started spa value: expect.arrayContaining(['SpanStreaming']), }, [SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.http.cloudflare' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.http.cloudflare' }, [SENTRY_SEGMENT_ID]: { type: 'string', value: segmentSpanId }, [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentName }, [SENTRY_OP]: { type: 'string', value: 'http.server' }, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts index 13a6474f8377..9c88edd7b0a3 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/d1/test.ts @@ -1,6 +1,6 @@ import { expect, it } from 'vitest'; import type { Envelope, SerializedStreamedSpan } from '@sentry/core'; -import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SDK_VERSION } from '@sentry/core'; import { SENTRY_SDK_NAME, SENTRY_SDK_VERSION, @@ -9,6 +9,7 @@ import { SENTRY_TRACE_LIFECYCLE, SENTRY_ENVIRONMENT, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { createRunner } from '../../../runner'; import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils'; @@ -37,7 +38,7 @@ function commonAttributes(segmentSpan: SerializedStreamedSpan): SerializedStream [SENTRY_SEGMENT_NAME]: { type: 'string', value: segmentSpan.name }, [SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, [SENTRY_OP]: { type: 'string', value: 'db.query' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.d1' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.d1' }, 'db.system.name': { type: 'string', value: 'cloudflare-d1' }, }; } diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts index 3b0fbb839714..1f8e514601a8 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sql/test.ts @@ -1,6 +1,5 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Envelope } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { expect, it } from 'vitest'; import { createRunner } from '../../../runner'; import { getSpansFromEnvelope } from '../../../spanUtils'; @@ -24,7 +23,7 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal expect(segmentSpan?.attributes['url.path']).toEqual({ type: 'string', value: '/exec' }); const sqlSpans = spans.filter( - span => span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value === 'auto.db.cloudflare.durable_object.sql', + span => span.attributes[SENTRY_ORIGIN]?.value === 'auto.db.cloudflare.durable_object.sql', ); expect(sqlSpans).toHaveLength(3); @@ -34,7 +33,7 @@ it('instruments SQL exec operations on Durable Object storage', async ({ signal name: 'CREATE TABLE users', attributes: expect.objectContaining({ [SENTRY_OP]: { type: 'string', value: 'db.query' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object.sql' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object.sql' }, 'db.system.name': { type: 'string', value: 'cloudflare-durable-object-sql' }, 'db.operation.name': { type: 'string', value: 'exec' }, 'db.query.text': { diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts index 113d35d64cf8..ddbfc897054e 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/durableobject-sync-kv/test.ts @@ -1,7 +1,6 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Envelope } from '@sentry/core'; import { expect, it } from 'vitest'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { createRunner } from '../../../runner'; import { getSpanOp, getSpansFromEnvelope } from '../../../spanUtils'; @@ -31,7 +30,7 @@ it('instruments sync KV operations on Durable Object storage', async ({ signal } name: 'durable_object_storage_kv_put', attributes: expect.objectContaining({ [SENTRY_OP]: { type: 'string', value: 'db' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.db.cloudflare.durable_object' }, 'db.system.name': { type: 'string', value: 'cloudflare-durable-object-sql' }, 'db.operation.name': { type: 'string', value: 'put' }, }), diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts index 637dddd01aa3..f894df8a361d 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/scheduled/test.ts @@ -1,7 +1,7 @@ -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; import type { Event } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { createRunner } from '../../../runner'; import { getSpansFromEnvelope } from '../../../spanUtils'; @@ -21,7 +21,7 @@ it('Scheduled handler creates a segment span with correct attributes', async ({ status: 'ok', attributes: expect.objectContaining({ [SENTRY_OP]: { type: 'string', value: 'function' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.scheduled' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.scheduled' }, [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'task' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, 'code.function.name': { type: 'string', value: 'scheduled' }, diff --git a/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts b/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts index 5934cf064a1e..86bcab0fb7ce 100644 --- a/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts +++ b/dev-packages/cloudflare-integration-tests/suites/tracing/workflow/test.ts @@ -1,6 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { expect, it } from 'vitest'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { createRunner } from '../../../runner'; it('Workflow steps create segment spans with correct attributes', async ({ signal }) => { @@ -25,7 +25,7 @@ it('Workflow steps create segment spans with correct attributes', async ({ signa status: 'ok', attributes: expect.objectContaining({ [SENTRY_OP]: { type: 'string', value: 'function' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.workflow' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.faas.cloudflare.workflow' }, [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'task' }, [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { type: 'integer', value: 1 }, 'code.function.name': { type: 'string', value: stepName }, diff --git a/dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts b/dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts index 644a8c886e5e..e4d4a1474e05 100644 --- a/dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts +++ b/dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts @@ -1,6 +1,5 @@ import type { SerializedStreamedSpanContainer } from '@sentry/core'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/node'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createCjsTests } from '../../utils/runner'; @@ -24,11 +23,7 @@ function expectFileSpans( status, attributes: Object.fromEntries( Object.entries(attributes).filter( - ([key]) => - key.endsWith('_argument') || - key === 'error.type' || - key === SENTRY_OP || - key === SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + ([key]) => key.endsWith('_argument') || key === 'error.type' || key === SENTRY_OP || key === SENTRY_ORIGIN, ), ), })), @@ -61,7 +56,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-that-doesnt-exist.txt'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -83,7 +78,7 @@ describe('fs instrumentation', () => { attributes: { path_argument: { type: 'string', value: expect.stringMatching('/fixtures/some-file.txt') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -92,7 +87,7 @@ describe('fs instrumentation', () => { attributes: { path_argument: { type: 'string', value: expect.stringMatching('/fixtures/some-file-promises.txt') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -104,7 +99,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-promisify.txt'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -127,7 +122,7 @@ describe('fs instrumentation', () => { src_argument: { type: 'string', value: expect.stringMatching('/fixtures/some-file.txt') }, dest_argument: { type: 'string', value: expect.stringMatching('/fixtures/some-file.txt.copy') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -140,7 +135,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-promises.txt.copy'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -153,7 +148,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-promisify.txt.copy'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -176,7 +171,7 @@ describe('fs instrumentation', () => { existing_path_argument: { type: 'string', value: expect.stringMatching('/fixtures/some-file.txt') }, new_path_argument: { type: 'string', value: expect.stringMatching('/fixtures/some-file.txt.link') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -186,7 +181,7 @@ describe('fs instrumentation', () => { existing_path_argument: { type: 'string', value: expect.stringMatching('/some-file-promises.txt') }, new_path_argument: { type: 'string', value: expect.stringMatching('/some-file-promises.txt.link') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -202,7 +197,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-promisify.txt.link'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -224,7 +219,7 @@ describe('fs instrumentation', () => { attributes: { prefix_argument: { type: 'string', value: expect.stringMatching('/foo-') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -233,7 +228,7 @@ describe('fs instrumentation', () => { attributes: { prefix_argument: { type: 'string', value: expect.stringMatching('/foo-') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -242,7 +237,7 @@ describe('fs instrumentation', () => { attributes: { prefix_argument: { type: 'string', value: expect.stringMatching('/foo-') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -265,7 +260,7 @@ describe('fs instrumentation', () => { target_argument: { type: 'string', value: expect.stringMatching('/some-file-promisify.txt') }, path_argument: { type: 'string', value: expect.stringMatching('/some-file-promisify.txt.symlink') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -281,7 +276,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-promisify.txt.symlink'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -297,7 +292,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-promisify.txt.symlink'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -319,7 +314,7 @@ describe('fs instrumentation', () => { attributes: { path_argument: { type: 'string', value: expect.stringMatching('/fixtures/some-file.txt') }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, { @@ -331,7 +326,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-promisify.txt'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -367,7 +362,7 @@ describe('fs instrumentation', () => { value: expect.stringMatching('/fixtures/some-file-that-doesnt-exist.txt'), }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -400,7 +395,7 @@ describe('fs instrumentation', () => { attributes: { 'error.type': { type: 'string', value: 'ENOENT' }, [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), @@ -422,7 +417,7 @@ describe('fs instrumentation', () => { // Neither `path_argument` nor `error.type` are recorded attributes: { [SENTRY_OP]: { type: 'string', value: 'file' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'auto.file.fs' }, }, }, ]), diff --git a/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts b/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts index dd7d18f7c961..87a40fa69b3f 100644 --- a/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/startSpan/basic-usage-streamed/test.ts @@ -1,4 +1,4 @@ -import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; +import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core'; import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_SEGMENT_ID, @@ -10,6 +10,7 @@ import { SENTRY_RELEASE, SENTRY_SDK_INTEGRATIONS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { expect, test } from 'vitest'; import { createRunner } from '../../../../utils/runner'; @@ -66,7 +67,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' }, [SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, }, name: 'test-child-span', is_segment: false, @@ -90,7 +91,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' }, [SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, }, links: [ { @@ -127,7 +128,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' }, [SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, }, name: 'test-manual-span', is_segment: false, @@ -154,7 +155,7 @@ test('sends a streamed span envelope with correct spans for a manually started s [SENTRY_SEGMENT_NAME]: { type: 'string', value: 'test-span' }, [SENTRY_RELEASE]: { type: 'string', value: '1.0.0' }, [SENTRY_ENVIRONMENT]: { type: 'string', value: 'production' }, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, + [SENTRY_ORIGIN]: { type: 'string', value: 'manual' }, [SENTRY_SEGMENT_NAME_SOURCE]: { type: 'string', value: 'custom' }, 'process.runtime.engine.name': { type: 'string', value: 'v8' }, 'process.runtime.engine.version': { type: 'string', value: expect.any(String) }, diff --git a/dev-packages/node-integration-tests/suites/tracing/groq/test.ts b/dev-packages/node-integration-tests/suites/tracing/groq/test.ts index d63eca3f15c5..ab5271d177ba 100644 --- a/dev-packages/node-integration-tests/suites/tracing/groq/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/groq/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { GEN_AI_EMBEDDINGS_INPUT, GEN_AI_INPUT_MESSAGES, @@ -16,6 +15,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -39,7 +39,7 @@ describe('Groq integration', () => { expect(chatSpan!.status).toBe('ok'); expect(chatSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('chat'); expect(chatSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(chatSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(chatSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(chatSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('llama-3.3-70b-versatile'); expect(chatSpan!.attributes[GEN_AI_REQUEST_TEMPERATURE]?.value).toBe(0.7); @@ -89,7 +89,7 @@ describe('Groq integration', () => { 'embeddings nomic-embed-text-v1_5', ]); for (const span of rawSpans) { - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(span.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(span.attributes[GEN_AI_RESPONSE_MODEL]).toBeUndefined(); expect(span.attributes[GEN_AI_USAGE_TOTAL_TOKENS]).toBeUndefined(); expect(span.attributes[GEN_AI_RESPONSE_TEXT]).toBeUndefined(); diff --git a/dev-packages/node-integration-tests/suites/tracing/langgraph/test.ts b/dev-packages/node-integration-tests/suites/tracing/langgraph/test.ts index e436b94a61e8..92b94bf07853 100644 --- a/dev-packages/node-integration-tests/suites/tracing/langgraph/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/langgraph/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_AGENT_NAME, @@ -16,6 +15,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { getStringAttributeValue } from '../../../utils'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -276,7 +276,7 @@ describe('LangGraph integration', () => { attributes: expect.objectContaining({ [GEN_AI_OPERATION_NAME]: expect.objectContaining({ value: 'invoke_agent' }), [SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.invoke_agent' }), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: expect.objectContaining({ value: 'auto.ai.langgraph' }), + [SENTRY_ORIGIN]: expect.objectContaining({ value: 'auto.ai.langgraph' }), [GEN_AI_AGENT_NAME]: expect.objectContaining({ value: 'helpful_assistant' }), [GEN_AI_PIPELINE_NAME]: expect.objectContaining({ value: 'helpful_assistant' }), }), diff --git a/dev-packages/node-integration-tests/suites/tracing/mistral/test.ts b/dev-packages/node-integration-tests/suites/tracing/mistral/test.ts index 4ae126d350d9..1b1e91310beb 100644 --- a/dev-packages/node-integration-tests/suites/tracing/mistral/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/mistral/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { GEN_AI_AGENT_NAME, GEN_AI_EMBEDDINGS_INPUT, @@ -21,6 +20,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmTests } from '../../../utils/runner'; @@ -49,7 +49,7 @@ describe('Mistral integration', () => { expect(chatSpan!.status).toBe('ok'); expect(chatSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('chat'); expect(chatSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(chatSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(chatSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(chatSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('mistral-small-latest'); expect(chatSpan!.attributes[GEN_AI_REQUEST_TEMPERATURE]?.value).toBe(0.7); @@ -142,7 +142,7 @@ describe('Mistral integration', () => { expect(embeddingsSpan!.status).toBe('ok'); expect(embeddingsSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('embeddings'); expect(embeddingsSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.embeddings'); - expect(embeddingsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(embeddingsSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(embeddingsSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(embeddingsSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('mistral-embed'); expect(embeddingsSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS]?.value).toBe(8); @@ -185,7 +185,7 @@ describe('Mistral integration', () => { expect(agentSpan!.status).toBe('ok'); expect(agentSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('invoke_agent'); expect(agentSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.invoke_agent'); - expect(agentSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(agentSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(agentSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(agentSpan!.attributes[GEN_AI_AGENT_NAME]?.value).toBe('ag-mock-123'); expect(agentSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS]?.value).toBe(10); @@ -263,7 +263,7 @@ describe('Mistral integration', () => { expect(chatSpan).toBeDefined(); expect(chatSpan!.name).toBe('chat mistral-small-latest'); expect(chatSpan!.status).toBe('ok'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(chatSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(chatSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(chatSpan!.attributes[GEN_AI_RESPONSE_TEXT]?.value).toBe('["Hello from the manual client!"]'); @@ -298,7 +298,7 @@ describe('Mistral integration', () => { expect(parseSpans[0]!.name).toBe('chat mistral-small-latest'); expect(parseSpans[0]!.status).toBe('ok'); expect(parseSpans[0]!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('chat'); - expect(parseSpans[0]!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(parseSpans[0]!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(parseSpans[0]!.attributes[GEN_AI_REQUEST_STREAM]?.value).toBe(false); expect(parseSpans[0]!.attributes[GEN_AI_USAGE_TOTAL_TOKENS]?.value).toBe(12); diff --git a/dev-packages/node-integration-tests/suites/tracing/openai/openai-tool-calls/test.ts b/dev-packages/node-integration-tests/suites/tracing/openai/openai-tool-calls/test.ts index cd746332059b..5dfd13c21f7f 100644 --- a/dev-packages/node-integration-tests/suites/tracing/openai/openai-tool-calls/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/openai/openai-tool-calls/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES, @@ -16,6 +15,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; @@ -97,7 +97,7 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -147,7 +147,7 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -207,7 +207,7 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(responsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -260,7 +260,7 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -333,7 +333,7 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -397,7 +397,7 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -468,7 +468,7 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(responsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -532,7 +532,7 @@ describe('OpenAI Tool Calls integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesToolsSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesToolsSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); diff --git a/dev-packages/node-integration-tests/suites/tracing/openai/test.ts b/dev-packages/node-integration-tests/suites/tracing/openai/test.ts index 27382085cdcc..2da282ebabb4 100644 --- a/dev-packages/node-integration-tests/suites/tracing/openai/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/openai/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type { SerializedStreamedSpanContainer } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { @@ -19,6 +18,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_DIMENSIONS_ATTRIBUTE, @@ -55,7 +55,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -112,7 +112,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -162,7 +162,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -189,7 +189,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -252,7 +252,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -324,7 +324,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -345,7 +345,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -398,7 +398,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -471,7 +471,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -540,7 +540,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -598,7 +598,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -629,7 +629,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -704,7 +704,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -788,7 +788,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -809,7 +809,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -871,7 +871,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1024,7 +1024,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1069,7 +1069,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1098,7 +1098,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1145,7 +1145,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(rawEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(rawEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1192,7 +1192,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1243,7 +1243,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1276,7 +1276,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1317,7 +1317,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(rawEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(rawEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1362,7 +1362,7 @@ describe('OpenAI integration', () => { data: { [GEN_AI_OPERATION_NAME]: 'chat', [SENTRY_OP]: 'gen_ai.chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_ORIGIN]: 'auto.ai.openai', [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_REQUEST_MODEL]: 'gpt-3.5-turbo', [GEN_AI_REQUEST_TEMPERATURE]: 0.7, @@ -1404,7 +1404,7 @@ describe('OpenAI integration', () => { data: { [GEN_AI_OPERATION_NAME]: 'chat', [SENTRY_OP]: 'gen_ai.chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_ORIGIN]: 'auto.ai.openai', [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_REQUEST_MODEL]: 'gpt-3.5-turbo', [GEN_AI_REQUEST_TEMPERATURE]: 0.7, @@ -1451,7 +1451,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(conversationCreateSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(conversationCreateSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1480,7 +1480,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(conversationResponseSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(conversationResponseSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1523,7 +1523,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(previousResponseSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(previousResponseSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1554,7 +1554,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(rawConversationSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(rawConversationSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1754,7 +1754,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1784,7 +1784,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(parsedChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1814,7 +1814,7 @@ describe('OpenAI integration', () => { type: 'string', value: 'gen_ai.chat', }); - expect(parsedResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(parsedResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); diff --git a/dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts b/dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts index be3746e90068..49d5cb48bd9d 100644 --- a/dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_EMBEDDINGS_INPUT, @@ -17,6 +16,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_DIMENSIONS_ATTRIBUTE, @@ -55,7 +55,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -110,7 +110,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -160,7 +160,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -187,7 +187,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -250,7 +250,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -322,7 +322,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -364,7 +364,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -431,7 +431,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(responsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(responsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -489,7 +489,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(nonStreamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(nonStreamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -520,7 +520,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingChatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingChatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -595,7 +595,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingResponsesSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingResponsesSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -679,7 +679,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(streamingErrorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(streamingErrorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -789,7 +789,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -834,7 +834,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -863,7 +863,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -929,7 +929,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -980,7 +980,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(errorEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1013,7 +1013,7 @@ describe('OpenAI integration (V6)', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(multiEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(multiEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -1077,7 +1077,7 @@ describe('OpenAI integration (V6)', () => { data: { [GEN_AI_OPERATION_NAME]: 'chat', [SENTRY_OP]: 'gen_ai.chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_ORIGIN]: 'auto.ai.openai', [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_REQUEST_MODEL]: 'gpt-3.5-turbo', [GEN_AI_REQUEST_TEMPERATURE]: 0.7, @@ -1130,7 +1130,7 @@ describe('OpenAI integration (V6)', () => { data: { [GEN_AI_OPERATION_NAME]: 'chat', [SENTRY_OP]: 'gen_ai.chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_ORIGIN]: 'auto.ai.openai', [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_REQUEST_MODEL]: 'gpt-3.5-turbo', [GEN_AI_REQUEST_TEMPERATURE]: 0.7, diff --git a/dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts b/dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts index 646b63ec7a6a..fbea79d4f34c 100644 --- a/dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, expect } from 'vitest'; import { GEN_AI_OPERATION_NAME, @@ -12,6 +11,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; import { conditionalTest } from '../../../../utils/index'; @@ -49,7 +49,7 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -97,7 +97,7 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => { const errorSpan = container.items.find(span => span.name === 'chat error-model' && span.status !== 'ok'); expect(errorSpan).toBeDefined(); - expect(errorSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(errorSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -140,7 +140,7 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => { type: 'string', value: 'gen_ai.embeddings', }); - expect(singleEmbeddingSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(singleEmbeddingSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); @@ -189,7 +189,7 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => { type: 'string', value: 'gen_ai.chat', }); - expect(chatCompletionSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]).toEqual({ + expect(chatCompletionSpan!.attributes[SENTRY_ORIGIN]).toEqual({ type: 'string', value: 'auto.ai.openai', }); diff --git a/dev-packages/node-integration-tests/suites/tracing/together-ai/test.ts b/dev-packages/node-integration-tests/suites/tracing/together-ai/test.ts index b9a7fb1fe38b..1e912a358fc0 100644 --- a/dev-packages/node-integration-tests/suites/tracing/together-ai/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/together-ai/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { GEN_AI_EMBEDDINGS_INPUT, GEN_AI_INPUT_MESSAGES, @@ -16,6 +15,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { afterAll, describe, expect } from 'vitest'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner'; @@ -39,7 +39,7 @@ describe('Together integration', () => { expect(chatSpan!.status).toBe('ok'); expect(chatSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('chat'); expect(chatSpan!.attributes[SENTRY_OP]?.value).toBe('gen_ai.chat'); - expect(chatSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(chatSpan!.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(chatSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER); expect(chatSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('meta-llama/Llama-3.3-70B-Instruct-Turbo'); expect(chatSpan!.attributes[GEN_AI_REQUEST_TEMPERATURE]?.value).toBe(0.7); @@ -89,7 +89,7 @@ describe('Together integration', () => { 'embeddings togethercomputer/m2-bert-80M-8k-retrieval', ]); for (const span of rawSpans) { - expect(span.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN); + expect(span.attributes[SENTRY_ORIGIN]?.value).toBe(ORIGIN); expect(span.attributes[GEN_AI_RESPONSE_MODEL]).toBeUndefined(); expect(span.attributes[GEN_AI_USAGE_TOTAL_TOKENS]).toBeUndefined(); expect(span.attributes[GEN_AI_RESPONSE_TEXT]).toBeUndefined(); diff --git a/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts b/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts index 3da2f82f24c9..50385f0e0c40 100644 --- a/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES, @@ -15,6 +14,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; @@ -52,7 +52,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Second span - generate_content for simple generateText @@ -67,7 +67,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Third span - invoke_agent for explicit telemetry generateText @@ -81,7 +81,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Fourth span - tool call invoke_agent @@ -95,7 +95,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Fifth span - tool call generate_content @@ -109,7 +109,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Sixth span - execute_tool @@ -122,7 +122,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), [SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), ]), @@ -146,7 +146,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Second span - generate_content with input/output messages @@ -165,7 +165,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Third span - explicit telemetry invoke_agent with messages @@ -183,7 +183,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Fourth span - tool call invoke_agent with messages @@ -201,7 +201,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Fifth span - tool call generate_content with tool definitions @@ -218,7 +218,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), // Sixth span - execute_tool with description and input/output @@ -233,7 +233,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_CALL_RESULT]: expect.objectContaining({ value: expect.any(String) }), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), [SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), ]), @@ -247,7 +247,7 @@ describe('Vercel AI integration (streaming v4)', () => { attributes: expect.objectContaining({ [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), expect.objectContaining({ @@ -260,7 +260,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), expect.objectContaining({ @@ -271,7 +271,7 @@ describe('Vercel AI integration (streaming v4)', () => { [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), [SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin), + [SENTRY_ORIGIN]: attr(expectedOrigin), }), }), ]), diff --git a/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts b/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts index 806649ede43f..db4707374c4e 100644 --- a/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts @@ -1,4 +1,3 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterAll, describe, expect } from 'vitest'; import { GEN_AI_INPUT_MESSAGES, @@ -15,6 +14,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes'; import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner'; @@ -49,7 +49,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Second span - generate_content for simple generateText @@ -64,7 +64,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Third span - invoke_agent for explicit telemetry generateText @@ -78,7 +78,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Fourth span - tool call invoke_agent @@ -92,7 +92,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Fifth span - tool call generate_content @@ -106,7 +106,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Sixth span - execute_tool @@ -119,7 +119,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), [SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), ]), @@ -143,7 +143,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Second span - generate_content with input/output messages @@ -162,7 +162,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Third span - explicit telemetry invoke_agent with messages @@ -180,7 +180,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(30), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Fourth span - tool call invoke_agent with messages (V6: no text part, only tool_call) @@ -198,7 +198,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Fifth span - tool call generate_content with tool definitions @@ -215,7 +215,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), // Sixth span - execute_tool with description and input/output @@ -230,7 +230,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_CALL_RESULT]: expect.objectContaining({ value: expect.any(String) }), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), [SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), ]), @@ -243,7 +243,7 @@ describe('Vercel AI integration (streaming, v6)', () => { attributes: expect.objectContaining({ [GEN_AI_OPERATION_NAME]: attr('invoke_agent'), [SENTRY_OP]: attr('gen_ai.invoke_agent'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), expect.objectContaining({ @@ -256,7 +256,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_USAGE_TOTAL_TOKENS]: attr(40), [GEN_AI_OPERATION_NAME]: attr('generate_content'), [SENTRY_OP]: attr('gen_ai.generate_content'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), expect.objectContaining({ @@ -267,7 +267,7 @@ describe('Vercel AI integration (streaming, v6)', () => { [GEN_AI_TOOL_NAME]: attr('getWeather'), [GEN_AI_OPERATION_NAME]: attr('execute_tool'), [SENTRY_OP]: attr('gen_ai.execute_tool'), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin), + [SENTRY_ORIGIN]: attr(origin), }), }), ]), diff --git a/packages/bun/src/integrations/bunserver.ts b/packages/bun/src/integrations/bunserver.ts index 080251c7dba3..bf73c591d467 100644 --- a/packages/bun/src/integrations/bunserver.ts +++ b/packages/bun/src/integrations/bunserver.ts @@ -12,7 +12,6 @@ import { HTTP_SPAN_NAME_FALLBACK, isURLObjectRelative, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, startSpan, winterCGRequestToRequestData, @@ -36,6 +35,7 @@ import { URL_PORT, URL_QUERY, URL_SCHEME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; @@ -355,7 +355,7 @@ function getSpanAttributesFromParsedUrl( request: Request, ): SpanAttributes { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.bun.serve', + [SENTRY_ORIGIN]: 'auto.http.bun.serve', [HTTP_REQUEST_METHOD]: request.method || 'GET', [SENTRY_SEGMENT_NAME_SOURCE]: 'url', }; diff --git a/packages/cloudflare/src/instrumentations/agents/instrumentAgentCallableRpc.ts b/packages/cloudflare/src/instrumentations/agents/instrumentAgentCallableRpc.ts index bf64488ad90c..88ea17db8eb5 100644 --- a/packages/cloudflare/src/instrumentations/agents/instrumentAgentCallableRpc.ts +++ b/packages/cloudflare/src/instrumentations/agents/instrumentAgentCallableRpc.ts @@ -1,6 +1,6 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { RPC } from '@sentry/conventions/op'; -import { debug, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { debug, startSpan } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import { AGENT_SPAN_ORIGIN, type AgentInternals, getAgentAttributes, setAgentConversationId } from './types'; @@ -35,7 +35,7 @@ export function instrumentAgentCallableRpc(obj: AgentInternals): void { name: method, attributes: { [SENTRY_OP]: RPC, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: AGENT_SPAN_ORIGIN, + [SENTRY_ORIGIN]: AGENT_SPAN_ORIGIN, ...getAgentAttributes(thisArg), }, }, diff --git a/packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts b/packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts index 976412bae83d..e1d1a3fc1025 100644 --- a/packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts +++ b/packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts @@ -1,7 +1,7 @@ import type { DurableObjectStorage, SyncKvStorage, SqlStorage } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { getClient, isThenable, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { getClient, isThenable, startSpan } from '@sentry/core'; import type { CloudflareClientOptions } from '../client'; import { getStorageKeys, targetsCloudflareInternalKey } from '../utils/internalStorageKey'; import { storeSpanContext } from '../utils/traceLinks'; @@ -75,7 +75,7 @@ export function instrumentDurableObjectStorage( name: `durable_object_storage_${methodName}`, attributes: { [SENTRY_OP]: DB, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': methodName, }, diff --git a/packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts b/packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts index c8b94d14fef4..eb21b57a2fbf 100644 --- a/packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts +++ b/packages/cloudflare/src/instrumentations/instrumentDurableObjectSyncKvStorage.ts @@ -1,7 +1,7 @@ import type { SyncKvStorage } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { startSpan } from '@sentry/core'; const SYNC_KV_METHODS_TO_INSTRUMENT = ['get', 'put', 'delete', 'list'] as const; @@ -28,7 +28,7 @@ export function instrumentDurableObjectSyncKvStorage(syncKv: SyncKvStorage): Syn name: `durable_object_storage_kv_${methodName}`, attributes: { [SENTRY_OP]: DB, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', // keeping the value as close as possible to the Cloudflare Worker KV instrumentation // https://github.com/cloudflare/workerd/blob/6b8b11787e2b2a800ab0edd0690bfab3857b0529/src/workerd/api/sync-kv.c%2B%2B#L19 'db.system.name': 'cloudflare-durable-object-sql', diff --git a/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts b/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts index 706960562f88..276cd0be5f8d 100644 --- a/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts +++ b/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts @@ -1,21 +1,14 @@ import type { SqlStorage } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; -import { - getActiveSpan, - getClient, - hasSpansEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - spanIsSampled, - startSpan, -} from '@sentry/core'; +import { getActiveSpan, getClient, hasSpansEnabled, spanIsSampled, startSpan } from '@sentry/core'; import { getSqlQuerySummary, sanitizeSqlQuery } from '@sentry/server-utils'; import type { CloudflareClientOptions } from '../client'; import { mayTargetCloudflareInternalTable, targetsCloudflareInternalTable } from '../utils/internalSqlQuery'; const SPAN_ATTRIBUTES = { [SENTRY_OP]: DB_QUERY, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', }; diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts b/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts index d8410ce32a45..42b01428816c 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts @@ -1,16 +1,9 @@ /* eslint-disable @typescript-eslint/unbound-method */ import type { D1Database, D1DatabaseSession, D1PreparedStatement, D1Response } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; import type { Span, SpanAttributes, StartSpanOptions } from '@sentry/core'; -import { - addBreadcrumb, - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startSpan, -} from '@sentry/core'; +import { addBreadcrumb, getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startSpan } from '@sentry/core'; import { getSqlQuerySummary, sanitizeSqlQuery } from '@sentry/server-utils'; import { ensureInstrumented } from '../../instrument'; @@ -148,7 +141,7 @@ function createStartSpanOptions(queryText: string | undefined, type: D1QueryType 'db.operation.name': type, 'db.query.text': queryText, 'db.query.summary': querySummary, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', }, }; } @@ -187,7 +180,7 @@ function instrumentBatch( 'db.operation.name': 'batch', 'db.query.text': queryText || undefined, 'db.operation.batch.size': statements.length, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.d1', }, }, async () => { diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts index 285be9fc1313..b12f01474d6a 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts @@ -1,9 +1,9 @@ import type { MessageBatch } from '@cloudflare/workers-types'; import type { AnyExportedHandler } from '../../types'; import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers'; -import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { QUEUE_PROCESS } from '@sentry/conventions/op'; -import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, withIsolationScope } from '@sentry/core'; +import { captureException, startSpan, withIsolationScope } from '@sentry/core'; import type { CloudflareOptions } from '../../client'; import { flushAndDispose } from '../../flush'; import { ensureInstrumented } from '../../instrument'; @@ -45,7 +45,7 @@ function wrapQueueHandler( 'messaging.operation.name': 'process', 'messaging.batch.message_count': batch.messages.length, 'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts - 1, 0), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue', + [SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts b/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts index d1b3de4ba107..3460ea32c633 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentQueueProducer.ts @@ -1,7 +1,7 @@ import type { MessageSendRequest, Queue, QueueSendBatchOptions, QueueSendOptions } from '@cloudflare/workers-types'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { QUEUE_PUBLISH } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { startSpan } from '@sentry/core'; const ORIGIN = 'auto.faas.cloudflare.queue'; @@ -26,7 +26,7 @@ function startPublishSpan( ...(messageCount !== undefined && { 'messaging.batch.message_count': messageCount }), 'messaging.message.body.size': bodySize, [SENTRY_OP]: QUEUE_PUBLISH, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }, }, callback, diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts b/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts index 7d6ad24ae3e2..a2ffdf72e50a 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentR2.ts @@ -7,6 +7,7 @@ import { CLOUDFLARE_R2_REQUEST_PART_NUMBER, CLOUDFLARE_R2_REQUEST_PREFIX, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { OBJECT_DELETE, @@ -19,7 +20,7 @@ import { OBJECT_PUT, OBJECT_UPLOAD_PART, } from '@sentry/conventions/op'; -import { isObjectLike, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { isObjectLike, startSpan } from '@sentry/core'; const ORIGIN = 'auto.faas.cloudflare.r2'; @@ -67,7 +68,7 @@ function createSpanOptions(bindingName: string, r2Op: R2OperationKey, key?: stri ...(isR2ListOptions(key) && key.prefix !== undefined && { [CLOUDFLARE_R2_REQUEST_PREFIX]: key.prefix }), ...(isR2ListOptions(key) && key.delimiter !== undefined && { [CLOUDFLARE_R2_REQUEST_DELIMITER]: key.delimiter }), [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }, }; } diff --git a/packages/cloudflare/src/workflows.ts b/packages/cloudflare/src/workflows.ts index 62442cadf32d..6043354e6427 100644 --- a/packages/cloudflare/src/workflows.ts +++ b/packages/cloudflare/src/workflows.ts @@ -1,15 +1,12 @@ -import { SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { + SENTRY_SEGMENT_NAME_SOURCE, + CODE_FUNCTION_NAME, + SENTRY_OP, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; import type { PropagationContext, Scope } from '@sentry/core'; -import { - captureException, - flush, - getCurrentScope, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startSpan, - withIsolationScope, - withScope, -} from '@sentry/core'; +import { captureException, flush, getCurrentScope, startSpan, withIsolationScope, withScope } from '@sentry/core'; import type { WorkflowDelayDuration, WorkflowEntrypoint, @@ -146,7 +143,7 @@ class WrappedWorkflowStep implements WorkflowStep { typeof config?.retries?.delay === 'function' ? undefined : config?.retries?.delay, 'cloudflare.workflow.retries.limit': config?.retries?.limit, 'cloudflare.workflow.attempt': attempt, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', + [SENTRY_ORIGIN]: 'auto.faas.cloudflare.workflow', [SENTRY_SEGMENT_NAME_SOURCE]: 'task', }, }, diff --git a/packages/cloudflare/test/instrumentDurableObjectStorage.test.ts b/packages/cloudflare/test/instrumentDurableObjectStorage.test.ts index af5161e5bcde..8a17c0031aac 100644 --- a/packages/cloudflare/test/instrumentDurableObjectStorage.test.ts +++ b/packages/cloudflare/test/instrumentDurableObjectStorage.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as sentryCore from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { instrumentDurableObjectStorage } from '../src/instrumentations/instrumentDurableObjectStorage'; @@ -32,7 +32,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_get', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'get', }, @@ -53,7 +53,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_get', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'get', }, @@ -76,7 +76,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_put', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'put', }, @@ -97,7 +97,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_put', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'put', }, @@ -120,7 +120,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_delete', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'delete', }, @@ -141,7 +141,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_delete', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'delete', }, @@ -164,7 +164,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_list', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'list', }, @@ -187,7 +187,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_setAlarm', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'setAlarm', }, @@ -271,7 +271,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_getAlarm', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'getAlarm', }, @@ -292,7 +292,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_deleteAlarm', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare.durable_object.storage', 'db.operation.name': 'deleteAlarm', }, @@ -315,7 +315,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'SELECT', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 'db.query.text': 'SELECT ?', @@ -439,7 +439,7 @@ describe('instrumentDurableObjectStorage', () => { name: 'durable_object_storage_kv_get', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'get', }, diff --git a/packages/cloudflare/test/instrumentDurableObjectSyncKvStorage.test.ts b/packages/cloudflare/test/instrumentDurableObjectSyncKvStorage.test.ts index f6135c2f919c..b75cc0e0e245 100644 --- a/packages/cloudflare/test/instrumentDurableObjectSyncKvStorage.test.ts +++ b/packages/cloudflare/test/instrumentDurableObjectSyncKvStorage.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as sentryCore from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { instrumentDurableObjectSyncKvStorage } from '../src/instrumentations/instrumentDurableObjectSyncKvStorage'; @@ -21,7 +21,7 @@ describe('instrumentDurableObjectSyncKvStorage', () => { name: 'durable_object_storage_kv_get', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'get', }, @@ -64,7 +64,7 @@ describe('instrumentDurableObjectSyncKvStorage', () => { name: 'durable_object_storage_kv_put', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'put', }, @@ -96,7 +96,7 @@ describe('instrumentDurableObjectSyncKvStorage', () => { name: 'durable_object_storage_kv_delete', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'delete', }, @@ -129,7 +129,7 @@ describe('instrumentDurableObjectSyncKvStorage', () => { name: 'durable_object_storage_kv_list', attributes: { 'sentry.op': 'db', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'list', }, diff --git a/packages/cloudflare/test/instrumentSqlStorage.test.ts b/packages/cloudflare/test/instrumentSqlStorage.test.ts index 8d76316460f3..edf590f84a0f 100644 --- a/packages/cloudflare/test/instrumentSqlStorage.test.ts +++ b/packages/cloudflare/test/instrumentSqlStorage.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as sentryCore from '@sentry/core'; import * as serverUtils from '@sentry/server-utils'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -27,7 +27,7 @@ describe('instrumentSqlStorage', () => { name: 'SELECT users', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 'db.query.text': 'SELECT * FROM users WHERE id = ?', @@ -51,7 +51,7 @@ describe('instrumentSqlStorage', () => { name: 'SELECT users', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 'db.query.text': 'SELECT * FROM users WHERE name = ? AND age > ?', @@ -84,7 +84,7 @@ describe('instrumentSqlStorage', () => { name: 'INSERT users', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', 'db.query.text': 'INSERT INTO users (name, email) VALUES (?, ?)', @@ -281,7 +281,7 @@ describe('instrumentSqlStorage', () => { name: 'exec', attributes: { 'sentry.op': 'db.query', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', + [SENTRY_ORIGIN]: 'auto.db.cloudflare.durable_object.sql', 'db.system.name': 'cloudflare-durable-object-sql', 'db.operation.name': 'exec', }, diff --git a/packages/deno/src/opentelemetry/tracer.ts b/packages/deno/src/opentelemetry/tracer.ts index 795f24eb9be4..e9846b994e45 100644 --- a/packages/deno/src/opentelemetry/tracer.ts +++ b/packages/deno/src/opentelemetry/tracer.ts @@ -1,6 +1,7 @@ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Context, Span, SpanOptions, Tracer, TracerProvider } from '@opentelemetry/api'; import { trace } from '@opentelemetry/api'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, startSpanManual } from '@sentry/core'; +import { startInactiveSpan, startSpanManual } from '@sentry/core'; /** * Set up a mock OTEL tracer to allow inter-op with OpenTelemetry emitted spans. @@ -34,7 +35,7 @@ class SentryDenoTracer implements Tracer { name, attributes: { ...options?.attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', 'sentry.deno_tracer': true, }, }); @@ -64,7 +65,7 @@ class SentryDenoTracer implements Tracer { name, attributes: { ...opts.attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', + [SENTRY_ORIGIN]: 'manual', 'sentry.deno_tracer': true, }, }; diff --git a/packages/elysia/src/withElysia.ts b/packages/elysia/src/withElysia.ts index f423920872cc..ee8ac91f8cb5 100644 --- a/packages/elysia/src/withElysia.ts +++ b/packages/elysia/src/withElysia.ts @@ -5,6 +5,7 @@ import { SENTRY_SEGMENT_NAME_SOURCE, URL_FULL, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HANDLER, HTTP_SERVER, MIDDLEWARE } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; @@ -18,7 +19,6 @@ import { getTraceData, hasSpanStreamingEnabled, REQUEST_HANDLER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, startInactiveSpan, startSpanManual, @@ -154,7 +154,7 @@ function instrumentLifecyclePhase( parentSpan: rootSpan, attributes: { [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, + [SENTRY_ORIGIN]: ELYSIA_ORIGIN, ...routeAttribute, }, }); @@ -169,7 +169,7 @@ function instrumentLifecyclePhase( parentSpan: phaseSpan, attributes: { [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, + [SENTRY_ORIGIN]: ELYSIA_ORIGIN, ...routeAttribute, // Streamed request handler spans are named after the route, so the // handler name has no other place to go. Anonymous handlers have no @@ -251,7 +251,7 @@ export function withElysia(app: T, options: ElysiaHandlerOp : `${request.method} ${new URL(request.url).pathname}`, attributes: { [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ELYSIA_ORIGIN, + [SENTRY_ORIGIN]: ELYSIA_ORIGIN, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', [URL_FULL]: filterCollectedUrl(request.url), [URL_PATH]: new URL(request.url).pathname, diff --git a/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts b/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts index e7b1f6c7e21b..5fae82f33b51 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts @@ -8,6 +8,7 @@ import { GCP_FUNCTION_CONTEXT_SOURCE, GCP_FUNCTION_CONTEXT_SPECVERSION, GCP_FUNCTION_CONTEXT_TIME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import { @@ -15,7 +16,6 @@ import { getClient, handleCallbackErrors, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, } from '@sentry/core'; import { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node'; @@ -64,7 +64,7 @@ function _wrapCloudEventFunction( [FAAS_NAME]: functionName, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: context.type, [GCP_FUNCTION_CONTEXT_ID]: context.id, [GCP_FUNCTION_CONTEXT_SOURCE]: context.source, diff --git a/packages/google-cloud-serverless/src/gcpfunction/http.ts b/packages/google-cloud-serverless/src/gcpfunction/http.ts index a90cb8ad00fd..3775752497ef 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/http.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/http.ts @@ -5,6 +5,7 @@ import { HTTP_REQUEST_METHOD, SENTRY_OP, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import { @@ -14,7 +15,6 @@ import { hasSpanStreamingEnabled, httpRequestToRequestData, isString, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, setHttpStatus, stripUrlQueryAndFragment, @@ -73,7 +73,7 @@ function _wrapHttpFunction(fn: HttpFunction, options: Partial): [FAAS_NAME]: functionName, [FAAS_TRIGGER]: 'http', [SENTRY_SEGMENT_NAME_SOURCE]: hasSpanStreaming ? 'component' : 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', // The method and path used to be the span name; they stay on the span so that // information survives the low-cardinality rename. [HTTP_REQUEST_METHOD]: reqMethod || undefined, diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts index d41e1cb38ad7..e0cb9816f13f 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts @@ -1,7 +1,7 @@ -import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { GRPC } from '@sentry/conventions/op'; import type { Client, IntegrationFn } from '@sentry/core'; -import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { defineIntegration, fill, getClient } from '@sentry/core'; import { startInactiveSpan } from '@sentry/node'; import type { EventEmitter } from 'events'; @@ -106,7 +106,7 @@ export function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodNa onlyIfParent: true, attributes: { [SENTRY_OP]: GRPC, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', + [SENTRY_ORIGIN]: 'auto.grpc.serverless', [RPC_SYSTEM_NAME]: 'grpc', [RPC_SERVICE]: serviceIdentifier, [RPC_METHOD]: methodName, diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts index 91e99e031840..6359ed876333 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts @@ -1,5 +1,12 @@ import type * as common from '@google-cloud/common'; -import { HTTP_REQUEST_METHOD, SENTRY_OP, SERVER_ADDRESS, URL_DOMAIN, URL_FULL } from '@sentry/conventions/attributes'; +import { + HTTP_REQUEST_METHOD, + SENTRY_OP, + SERVER_ADDRESS, + URL_DOMAIN, + URL_FULL, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; import type { Client, IntegrationFn } from '@sentry/core'; import { @@ -9,7 +16,6 @@ import { hasSpanStreamingEnabled, isURLObjectRelative, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, filterCollectedUrl, stripUrlQueryAndFragment, @@ -72,7 +78,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction { onlyIfParent: true, attributes: { [SENTRY_OP]: HTTP_CLIENT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless', + [SENTRY_ORIGIN]: 'auto.http.serverless', [HTTP_REQUEST_METHOD]: httpMethod, [SERVER_ADDRESS]: serverAddress, [URL_DOMAIN]: serverAddress, diff --git a/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts b/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts index 514a288f9531..a6bb52702d6a 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/cloud_event.test.ts @@ -8,11 +8,12 @@ import { GCP_FUNCTION_CONTEXT_SOURCE, GCP_FUNCTION_CONTEXT_SPECVERSION, GCP_FUNCTION_CONTEXT_TIME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { Client } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; +import { SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; import { wrapCloudEventFunction } from '../../src/gcpfunction/cloud_events'; import type { CloudEventFunction, CloudEventFunctionWithCallback } from '../../src/gcpfunction/general'; @@ -94,7 +95,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -126,7 +127,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -159,7 +160,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -203,7 +204,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -247,7 +248,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -276,7 +277,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', @@ -319,7 +320,7 @@ describe('wrapCloudEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'cloud_event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event', [GCP_FUNCTION_CONTEXT_TYPE]: 'google.cloud.pubsub.topic.v1.messagePublished', [GCP_FUNCTION_CONTEXT_ID]: '5302804326013861', [GCP_FUNCTION_CONTEXT_SOURCE]: '//pubsub.googleapis.com/projects/my-project/topics/my-topic', diff --git a/packages/google-cloud-serverless/test/gcpfunction/events.test.ts b/packages/google-cloud-serverless/test/gcpfunction/events.test.ts index 95d1b6972924..c69251441b54 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/events.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/events.test.ts @@ -7,11 +7,12 @@ import { GCP_FUNCTION_CONTEXT_EVENT_ID, GCP_FUNCTION_CONTEXT_RESOURCE, GCP_FUNCTION_CONTEXT_TIMESTAMP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { Client, Event } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; +import { SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; import { wrapEventFunction } from '../../src/gcpfunction/events'; import type { EventFunction, EventFunctionWithCallback } from '../../src/gcpfunction/general'; @@ -88,7 +89,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -116,7 +117,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -149,7 +150,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -181,7 +182,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -211,7 +212,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -239,7 +240,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', @@ -268,7 +269,7 @@ describe('wrapEventFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'event', [SENTRY_SEGMENT_NAME_SOURCE]: 'component', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event', [GCP_FUNCTION_CONTEXT_EVENT_TYPE]: 'providers/cloud.firestore/eventTypes/document.write', [GCP_FUNCTION_CONTEXT_EVENT_ID]: '1144231683168617', [GCP_FUNCTION_CONTEXT_RESOURCE]: 'projects/my-project/databases/(default)/documents/users/abc123', diff --git a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts index 881fc6867bd6..a0704860c8bf 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts @@ -5,11 +5,12 @@ import { HTTP_REQUEST_METHOD, SENTRY_OP, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { Client, Integration } from '@sentry/core'; import * as SentryCore from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; +import { SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, type MockInstance, test, vi } from 'vitest'; import type { HttpFunction, Request, Response } from '../../src/gcpfunction/general'; import { wrapHttpFunction } from '../../src/gcpfunction/http'; @@ -107,7 +108,7 @@ describe('GCPFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'http', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', [HTTP_REQUEST_METHOD]: 'POST', [URL_PATH]: '/path', }, @@ -134,7 +135,7 @@ describe('GCPFunction', () => { [FAAS_NAME]: undefined, [FAAS_TRIGGER]: 'http', [SENTRY_SEGMENT_NAME_SOURCE]: 'route', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', + [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http', [HTTP_REQUEST_METHOD]: 'POST', [URL_PATH]: '/path', }, diff --git a/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts b/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts index 954f186a34d4..9d9aa0dcedf7 100644 --- a/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts +++ b/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts @@ -1,5 +1,5 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; -import { createTransport, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setCurrentClient } from '@sentry/core'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { createTransport, setCurrentClient } from '@sentry/core'; import { NodeClient } from '@sentry/node'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import type { GrpcFunction, GrpcFunctionObject, Stub } from '../../src/integrations/google-cloud-grpc'; @@ -145,7 +145,7 @@ describe('GoogleCloudGrpc tracing', () => { onlyIfParent: true, attributes: { [SENTRY_OP]: 'grpc', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', + [SENTRY_ORIGIN]: 'auto.grpc.serverless', 'rpc.system.name': 'grpc', 'rpc.service': 'test-service', 'rpc.method': 'unaryMethod', diff --git a/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts b/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts index 3a0859914daf..a7d550eea515 100644 --- a/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts +++ b/packages/google-cloud-serverless/test/integrations/google-cloud-http.test.ts @@ -1,7 +1,13 @@ import { BigQuery } from '@google-cloud/bigquery'; -import { HTTP_REQUEST_METHOD, SENTRY_OP, SERVER_ADDRESS, URL_DOMAIN, URL_FULL } from '@sentry/conventions/attributes'; +import { + HTTP_REQUEST_METHOD, + SENTRY_OP, + SERVER_ADDRESS, + URL_DOMAIN, + URL_FULL, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { createTransport, NodeClient, setCurrentClient } from '@sentry/node'; import * as fs from 'fs'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -93,7 +99,7 @@ describe('GoogleCloudHttp tracing', () => { onlyIfParent: true, attributes: { [SENTRY_OP]: HTTP_CLIENT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless', + [SENTRY_ORIGIN]: 'auto.http.serverless', [HTTP_REQUEST_METHOD]: 'POST', [SERVER_ADDRESS]: 'bigquery.googleapis.com', [URL_DOMAIN]: 'bigquery.googleapis.com', @@ -105,7 +111,7 @@ describe('GoogleCloudHttp tracing', () => { onlyIfParent: true, attributes: { [SENTRY_OP]: HTTP_CLIENT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless', + [SENTRY_ORIGIN]: 'auto.http.serverless', [HTTP_REQUEST_METHOD]: 'GET', [SERVER_ADDRESS]: 'bigquery.googleapis.com', [URL_DOMAIN]: 'bigquery.googleapis.com', diff --git a/packages/nestjs/src/decorators.ts b/packages/nestjs/src/decorators.ts index a7e41bacc1b2..4d5762481d2f 100644 --- a/packages/nestjs/src/decorators.ts +++ b/packages/nestjs/src/decorators.ts @@ -1,6 +1,6 @@ import type { MonitorConfig } from '@sentry/core'; -import { CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; -import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { CODE_FUNCTION_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; +import { captureException } from '@sentry/core'; import * as Sentry from '@sentry/node'; import { startSpan } from '@sentry/node'; import { isExpectedError } from './helpers'; @@ -42,7 +42,7 @@ export function SentryTraced(op: string = 'function') { op: op, name: propertyKey, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', + [SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', [SENTRY_OP]: op, [CODE_FUNCTION_NAME]: propertyKey, }, diff --git a/packages/nestjs/src/integrations/helpers.ts b/packages/nestjs/src/integrations/helpers.ts index 8759a78b31ee..5056413e911a 100644 --- a/packages/nestjs/src/integrations/helpers.ts +++ b/packages/nestjs/src/integrations/helpers.ts @@ -5,16 +5,11 @@ import { MESSAGING_SYSTEM, SENTRY_DESCRIPTION, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, MIDDLEWARE, QUEUE_PROCESS } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; -import { - addNonEnumerableProperty, - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - withActiveSpan, -} from '@sentry/core'; +import { addNonEnumerableProperty, getClient, hasSpanStreamingEnabled, withActiveSpan } from '@sentry/core'; import type { CatchTarget, InjectableTarget, NextFunction, Observable, Subscription } from './types'; /** A function of unknown signature, matching the methods/handlers we wrap. */ @@ -100,7 +95,7 @@ export function getMiddlewareSpanOptions( name: name ?? target.name ?? 'unknown', attributes: { [SENTRY_OP]: MIDDLEWARE, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: middlewareOrigin(componentType), + [SENTRY_ORIGIN]: middlewareOrigin(componentType), }, }; } @@ -124,7 +119,7 @@ export function getEventSpanOptions(event: string): { attributes: { [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: event, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.event.nestjs', + [SENTRY_ORIGIN]: 'auto.event.nestjs', // Relay infers a `function` span's description from `code.function.name` alone, which drops the prefix. ...(isStreamed && { [SENTRY_DESCRIPTION]: description }), }, @@ -157,7 +152,7 @@ export function getBullMQProcessSpanOptions(queueName: string | undefined): { name, attributes: { [SENTRY_OP]: QUEUE_PROCESS, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.queue.nestjs.bullmq', + [SENTRY_ORIGIN]: 'auto.queue.nestjs.bullmq', [MESSAGING_SYSTEM]: 'bullmq', [MESSAGING_OPERATION_TYPE]: PROCESS_OPERATION, [MESSAGING_DESTINATION_NAME]: queueName, diff --git a/packages/nestjs/src/integrations/wrap-route.ts b/packages/nestjs/src/integrations/wrap-route.ts index c65b6e2b69ce..406591804d49 100644 --- a/packages/nestjs/src/integrations/wrap-route.ts +++ b/packages/nestjs/src/integrations/wrap-route.ts @@ -4,6 +4,7 @@ import { HTTP_ROUTE, SENTRY_OP, URL_FULL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION, HANDLER } from '@sentry/conventions/op'; import type { SpanAttributes } from '@sentry/core'; @@ -11,7 +12,6 @@ import { getClient, hasSpanStreamingEnabled, REQUEST_HANDLER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, filterCollectedUrl, } from '@sentry/core'; @@ -47,7 +47,7 @@ export function getAppCreationSpanOptions( attributes: { component: NESTJS_COMPONENT, [SENTRY_OP]: FUNCTION, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: HTTP_ORIGIN, + [SENTRY_ORIGIN]: HTTP_ORIGIN, [AttributeNames.TYPE]: NestType.APP_CREATION, [AttributeNames.VERSION]: moduleVersion || undefined, [AttributeNames.MODULE]: moduleName || undefined, @@ -68,7 +68,7 @@ export function wrapRouteHandler(callback: AnyFn, moduleVersion?: string): AnyFn const attributes: SpanAttributes = { component: NESTJS_COMPONENT, [SENTRY_OP]: HANDLER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: HTTP_ORIGIN, + [SENTRY_ORIGIN]: HTTP_ORIGIN, [AttributeNames.TYPE]: NestType.REQUEST_HANDLER, [AttributeNames.CALLBACK]: callback.name, [AttributeNames.VERSION]: moduleVersion || undefined, @@ -111,7 +111,7 @@ export function wrapRequestContextHandler( const httpRoute = req.route?.path || req.routeOptions?.url || req.routerPath; const attributes: SpanAttributes = { component: NESTJS_COMPONENT, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: HTTP_ORIGIN, + [SENTRY_ORIGIN]: HTTP_ORIGIN, [SENTRY_OP]: FUNCTION, [CODE_FUNCTION_NAME]: spanName, [AttributeNames.TYPE]: NestType.REQUEST_CONTEXT, diff --git a/packages/nestjs/test/decorators.test.ts b/packages/nestjs/test/decorators.test.ts index 8e6c083057ff..661f00b89182 100644 --- a/packages/nestjs/test/decorators.test.ts +++ b/packages/nestjs/test/decorators.test.ts @@ -1,7 +1,6 @@ import 'reflect-metadata'; -import { CODE_FUNCTION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { CODE_FUNCTION_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as core from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { SentryCron, SentryExceptionCaptured, SentryTraced } from '../src/decorators'; import * as helpers from '../src/helpers'; @@ -41,7 +40,7 @@ describe('SentryTraced decorator', () => { op: 'test-operation', name: 'testMethod', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', + [SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', [SENTRY_OP]: 'test-operation', [CODE_FUNCTION_NAME]: 'testMethod', }, @@ -75,7 +74,7 @@ describe('SentryTraced decorator', () => { op: 'function', // default value name: 'testDefaultOp', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', + [SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', [SENTRY_OP]: 'function', [CODE_FUNCTION_NAME]: 'testDefaultOp', }, @@ -109,7 +108,7 @@ describe('SentryTraced decorator', () => { op: 'sync-operation', name: 'syncMethod', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', + [SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced', [SENTRY_OP]: 'sync-operation', [CODE_FUNCTION_NAME]: 'syncMethod', }, diff --git a/packages/nestjs/test/integrations/span-origin.test.ts b/packages/nestjs/test/integrations/span-origin.test.ts index 8eba4fb68e18..b1d0f3bc551f 100644 --- a/packages/nestjs/test/integrations/span-origin.test.ts +++ b/packages/nestjs/test/integrations/span-origin.test.ts @@ -1,4 +1,4 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { describe, expect, it } from 'vitest'; import { getBullMQProcessSpanOptions, @@ -8,15 +8,15 @@ import { } from '../../src/integrations/helpers'; function middlewareOrigin(componentType?: string): unknown { - return getMiddlewareSpanOptions({ name: 'X' }, undefined, componentType).attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]; + return getMiddlewareSpanOptions({ name: 'X' }, undefined, componentType).attributes[SENTRY_ORIGIN]; } function eventOrigin(): unknown { - return getEventSpanOptions('x').attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]; + return getEventSpanOptions('x').attributes[SENTRY_ORIGIN]; } function bullmqOrigin(): unknown { - return getBullMQProcessSpanOptions('q').attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]; + return getBullMQProcessSpanOptions('q').attributes[SENTRY_ORIGIN]; } describe('NestJS span origin', () => { diff --git a/packages/node/src/integrations/fs/vendored/instrumentation.ts b/packages/node/src/integrations/fs/vendored/instrumentation.ts index 23660cc7f7ff..d341a3d9ffa3 100644 --- a/packages/node/src/integrations/fs/vendored/instrumentation.ts +++ b/packages/node/src/integrations/fs/vendored/instrumentation.ts @@ -14,11 +14,10 @@ * `error.type` (the syscall error code, e.g. `ENOENT`). */ -import { ERROR_TYPE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { ERROR_TYPE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { FILE } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; import { - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, getActiveSpan, startInactiveSpan, @@ -101,7 +100,7 @@ function getSpanAttributes( ): SpanAttributes { const attributes: SpanAttributes = { [SENTRY_OP]: SPAN_OP, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN, + [SENTRY_ORIGIN]: SPAN_ORIGIN, }; if (!config.recordFilePaths) { diff --git a/packages/node/src/integrations/http/httpServerSpansIntegration.ts b/packages/node/src/integrations/http/httpServerSpansIntegration.ts index 4712bdd61e7a..b690854c87d2 100644 --- a/packages/node/src/integrations/http/httpServerSpansIntegration.ts +++ b/packages/node/src/integrations/http/httpServerSpansIntegration.ts @@ -24,6 +24,7 @@ import { URL_QUERY, URL_SCHEME, USER_AGENT_ORIGINAL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; import type { Event, Integration, IntegrationFn, Span, SpanAttributes, SpanStatus } from '@sentry/core'; @@ -39,7 +40,6 @@ import { httpHeadersToSpanAttributes, getContentLengthFromHeaders, parseStringToURLObject, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, stripUrlQueryAndFragment, isTracingSuppressed, @@ -168,7 +168,7 @@ const _httpServerSpansIntegration = ((options: HttpServerSpansIntegrationOptions [SENTRY_KIND]: 'server', [SENTRY_OP]: HTTP_SERVER, [SENTRY_SEGMENT_NAME_SOURCE]: 'url', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.http_server', + [SENTRY_ORIGIN]: 'auto.http.http_server', [SENTRY_HTTP_PREFETCH]: isKnownPrefetchRequest(request) || undefined, [URL_FULL]: filterCollectedUrl(fullUrl, client), [URL_PATH]: urlObj?.pathname ?? httpTargetWithoutQueryFragment, diff --git a/packages/node/src/integrations/node-fetch/undici-instrumentation.ts b/packages/node/src/integrations/node-fetch/undici-instrumentation.ts index 0def1c3be01d..4b9f9f82324c 100644 --- a/packages/node/src/integrations/node-fetch/undici-instrumentation.ts +++ b/packages/node/src/integrations/node-fetch/undici-instrumentation.ts @@ -31,7 +31,6 @@ import { parseUrl, safeCallback, SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, stripDataUrlContent, @@ -59,6 +58,7 @@ import { URL_QUERY, URL_SCHEME, USER_AGENT_ORIGINAL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HTTP_CLIENT } from '@sentry/conventions/op'; import { DEBUG_BUILD } from '../../debug-build'; @@ -220,7 +220,7 @@ function onRequestCreated(config: NodeFetchOptions, { request }: RequestMessage) [URL_QUERY]: filterCollectedUrlQuery(getUrlQuery(requestUrl.search)), [URL_FRAGMENT]: getUrlFragment(requestUrl.hash), [URL_SCHEME]: urlScheme, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.node_fetch', + [SENTRY_ORIGIN]: 'auto.http.node_fetch', }; // Sanitize data URLs to prevent long base64 strings in span attributes diff --git a/packages/node/src/utils/addOriginToSpan.ts b/packages/node/src/utils/addOriginToSpan.ts index 2a23710fa7cf..afb1c8872aaf 100644 --- a/packages/node/src/utils/addOriginToSpan.ts +++ b/packages/node/src/utils/addOriginToSpan.ts @@ -1,8 +1,8 @@ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import type { Span } from '@opentelemetry/api'; import type { SpanOrigin } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; /** Adds an origin to an OTEL Span. */ export function addOriginToSpan(span: Span, origin: SpanOrigin): void { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin); + span.setAttribute(SENTRY_ORIGIN, origin); } diff --git a/packages/node/test/integration/transactions.test.ts b/packages/node/test/integration/transactions.test.ts index a4bf5e3281ff..681c988eef10 100644 --- a/packages/node/test/integration/transactions.test.ts +++ b/packages/node/test/integration/transactions.test.ts @@ -1,7 +1,6 @@ -import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +import { SENTRY_SEGMENT_NAME_SOURCE, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { context, trace, TraceFlags } from '@opentelemetry/api'; import type { ErrorEvent, TransactionEvent } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import * as Sentry from '../../src'; import { cleanupOtel, mockSdkInit } from '../helpers/mockSdkInit'; @@ -38,7 +37,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }, span => { @@ -168,7 +167,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }, span => { @@ -460,7 +459,7 @@ describe('Integration | Transactions', () => { name: 'test name', attributes: { [SENTRY_SEGMENT_NAME_SOURCE]: 'task', - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.test', + [SENTRY_ORIGIN]: 'auto.test', }, }, () => { diff --git a/packages/node/test/integrations/undici.test.ts b/packages/node/test/integrations/undici.test.ts index f278ccc726d7..807b16ac5468 100644 --- a/packages/node/test/integrations/undici.test.ts +++ b/packages/node/test/integrations/undici.test.ts @@ -10,8 +10,8 @@ import { URL_PATH, URL_QUERY, URL_SCHEME, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { channel } from 'node:diagnostics_channel'; import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import type { UndiciRequest } from '../../src/integrations/node-fetch/types'; @@ -70,7 +70,7 @@ describe('instrumentUndici', () => { [URL_QUERY]: 'limit=10', [URL_FRAGMENT]: undefined, [URL_SCHEME]: 'https', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.node_fetch', + [SENTRY_ORIGIN]: 'auto.http.node_fetch', [SERVER_ADDRESS]: 'api.example.com', [SERVER_PORT]: 443, }, diff --git a/packages/server-utils/src/ai/anthropic-ai/index.ts b/packages/server-utils/src/ai/anthropic-ai/index.ts index f45d875d8b6e..c285a043bc4c 100644 --- a/packages/server-utils/src/ai/anthropic-ai/index.ts +++ b/packages/server-utils/src/ai/anthropic-ai/index.ts @@ -1,12 +1,5 @@ /* eslint-disable typescript-eslint/no-deprecated */ -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startSpan, - startSpanManual, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startSpan, startSpanManual } from '@sentry/core'; import type { Span, SpanAttributeValue } from '@sentry/core'; import { GEN_AI_OPERATION_NAME, @@ -22,6 +15,7 @@ import { GEN_AI_RESPONSE_TEXT, GEN_AI_RESPONSE_TOOL_CALLS, GEN_AI_TOOL_DEFINITIONS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../core/gen-ai-attributes'; import type { InstrumentedMethodEntry } from '../core/utils'; @@ -56,7 +50,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: 'anthropic', [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.anthropic', + [SENTRY_ORIGIN]: 'auto.ai.anthropic', }; if (args.length > 0 && typeof args[0] === 'object' && args[0] !== null) { diff --git a/packages/server-utils/src/ai/flue/index.ts b/packages/server-utils/src/ai/flue/index.ts index 67e59c9fcdc6..7243aeb1351f 100644 --- a/packages/server-utils/src/ai/flue/index.ts +++ b/packages/server-utils/src/ai/flue/index.ts @@ -5,11 +5,15 @@ import { continueTrace, getActiveSpan, LRUMap, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, withActiveSpan, } from '@sentry/core'; -import { GEN_AI_AGENT_NAME, GEN_AI_CONVERSATION_ID, GEN_AI_OPERATION_NAME } from '@sentry/conventions/attributes'; +import { + GEN_AI_AGENT_NAME, + GEN_AI_CONVERSATION_ID, + GEN_AI_OPERATION_NAME, + SENTRY_ORIGIN, +} from '@sentry/conventions/attributes'; import { ANTHROPIC_AI_INTEGRATION_NAME } from '../anthropic-ai/constants'; import type { GenAiOptions } from '../core/utils'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../core/utils'; @@ -104,7 +108,7 @@ export function createFlueInstrumentation(options: FlueOptions = {}): FlueInstru name: `invoke_agent ${ctx.agentName ?? 'agent'}`, op: getGenAiSpanOp('invoke_agent'), attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FLUE_ORIGIN, + [SENTRY_ORIGIN]: FLUE_ORIGIN, [GEN_AI_OPERATION_NAME]: 'invoke_agent', ...(ctx.agentName ? { [GEN_AI_AGENT_NAME]: ctx.agentName } : {}), ...(ctx.conversationId ? { [GEN_AI_CONVERSATION_ID]: ctx.conversationId } : {}), diff --git a/packages/server-utils/src/ai/flue/utils.ts b/packages/server-utils/src/ai/flue/utils.ts index a1b463cbfbd7..2661eea0892c 100644 --- a/packages/server-utils/src/ai/flue/utils.ts +++ b/packages/server-utils/src/ai/flue/utils.ts @@ -1,12 +1,5 @@ import type { LRUMap, Span } from '@sentry/core'; -import { - captureException, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, - stringify, - withActiveSpan, -} from '@sentry/core'; +import { captureException, SPAN_STATUS_ERROR, startInactiveSpan, stringify, withActiveSpan } from '@sentry/core'; import { GEN_AI_CONVERSATION_ID, GEN_AI_COST_CACHE_CREATION_INPUT_TOKENS, @@ -37,6 +30,7 @@ import { GEN_AI_USAGE_TOTAL_TOKENS, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { getGenAiSpanOp } from '../core/utils'; import { FLUE_ORIGIN, MAX_TRACKED_FLUE_SPANS } from './constants'; @@ -123,7 +117,7 @@ export function startTurnSpan(observation: FlueObservation, turnSpans: SpanTrack name: 'chat', op: getGenAiSpanOp('chat'), attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FLUE_ORIGIN, + [SENTRY_ORIGIN]: FLUE_ORIGIN, [GEN_AI_OPERATION_NAME]: 'chat', ...(observation.conversationId ? { [GEN_AI_CONVERSATION_ID]: observation.conversationId } : {}), // No conventional attribute for this; it is the only way to tell a compaction turn from a @@ -237,7 +231,7 @@ export function startToolSpan(observation: FlueObservation, toolSpans: SpanTrack name: `execute_tool ${toolName ?? 'unknown'}`, op: getGenAiSpanOp('execute_tool'), attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FLUE_ORIGIN, + [SENTRY_ORIGIN]: FLUE_ORIGIN, [GEN_AI_OPERATION_NAME]: 'execute_tool', ...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}), ...(observation.conversationId ? { [GEN_AI_CONVERSATION_ID]: observation.conversationId } : {}), diff --git a/packages/server-utils/src/ai/google-genai/index.ts b/packages/server-utils/src/ai/google-genai/index.ts index 01b7cfb0f6c0..06bd425bc188 100644 --- a/packages/server-utils/src/ai/google-genai/index.ts +++ b/packages/server-utils/src/ai/google-genai/index.ts @@ -4,7 +4,6 @@ import { getClient, handleCallbackErrors, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan, startSpanManual, @@ -31,6 +30,7 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { InstrumentedMethodEntry } from '../core/utils'; import { buildMethodPath, getGenAiSpanOp, resolveAIRecordingOptions } from '../core/utils'; @@ -113,7 +113,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: GOOGLE_GENAI_SYSTEM_NAME, [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.google_genai', + [SENTRY_ORIGIN]: 'auto.ai.google_genai', }; if (params) { diff --git a/packages/server-utils/src/ai/langchain/embeddings.ts b/packages/server-utils/src/ai/langchain/embeddings.ts index 1a8f61c867f6..e1c4fd25fd9b 100644 --- a/packages/server-utils/src/ai/langchain/embeddings.ts +++ b/packages/server-utils/src/ai/langchain/embeddings.ts @@ -1,10 +1,4 @@ -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startSpan, - stringify, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, startSpan, stringify } from '@sentry/core'; import type { SpanAttributeValue } from '@sentry/core'; import { GEN_AI_EMBEDDINGS_INPUT, @@ -12,6 +6,7 @@ import { GEN_AI_PROVIDER_NAME, GEN_AI_REQUEST_MODEL, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_EMBEDDINGS } from '@sentry/conventions/op'; import { @@ -45,7 +40,7 @@ function extractEmbeddingAttributes(instance: unknown): Record const embeddingsInstance = (instance ?? {}) as Record; const attributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, + [SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, [SENTRY_OP]: GEN_AI_EMBEDDINGS, [GEN_AI_OPERATION_NAME]: 'embeddings', [GEN_AI_REQUEST_MODEL]: embeddingsInstance.model ?? 'unknown', diff --git a/packages/server-utils/src/ai/langchain/index.ts b/packages/server-utils/src/ai/langchain/index.ts index ea60eef3305e..e9d7df2a9d3d 100644 --- a/packages/server-utils/src/ai/langchain/index.ts +++ b/packages/server-utils/src/ai/langchain/index.ts @@ -1,12 +1,5 @@ /* eslint-disable max-lines */ -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startSpanManual, - stringify, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startSpanManual, stringify } from '@sentry/core'; import type { Span, SpanAttributeValue } from '@sentry/core'; import { GEN_AI_OPERATION_NAME, @@ -17,6 +10,7 @@ import { GEN_AI_TOOL_DEFINITIONS, GEN_AI_TOOL_NAME, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_CHAT, GEN_AI_EXECUTE_TOOL, GEN_AI_INVOKE_AGENT } from '@sentry/conventions/op'; import { resolveAIRecordingOptions } from '../core/utils'; @@ -227,7 +221,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): const chainName = runName || chain.name; const attributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.langchain', + [SENTRY_ORIGIN]: 'auto.ai.langchain', [GEN_AI_OPERATION_NAME]: 'invoke_agent', }; @@ -307,7 +301,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}): const toolName = runName || tool.name || 'unknown_tool'; const attributes: Record = { ...getAgentNameFromMetadata(metadata), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, + [SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, [GEN_AI_OPERATION_NAME]: 'execute_tool', [GEN_AI_TOOL_NAME]: toolName, }; diff --git a/packages/server-utils/src/ai/langchain/utils.ts b/packages/server-utils/src/ai/langchain/utils.ts index 4c29d93068ec..fa5a4948d519 100644 --- a/packages/server-utils/src/ai/langchain/utils.ts +++ b/packages/server-utils/src/ai/langchain/utils.ts @@ -1,6 +1,6 @@ /* eslint-disable max-lines */ /* eslint-disable typescript-eslint/no-deprecated */ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, stringify } from '@sentry/core'; +import { stringify } from '@sentry/core'; import type { SpanAttributeValue } from '@sentry/core'; import { GEN_AI_AGENT_NAME, @@ -24,6 +24,7 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE, GEN_AI_RESPONSE_STOP_REASON_ATTRIBUTE } from '../core/gen-ai-attributes'; import { extractSystemInstructions } from '../core/utils'; @@ -227,7 +228,7 @@ function baseRequestAttributes( [GEN_AI_PROVIDER_NAME]: stringify(system ?? 'langchain', String), [GEN_AI_OPERATION_NAME]: 'chat', [GEN_AI_REQUEST_MODEL]: stringify(modelName, String), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, + [SENTRY_ORIGIN]: LANGCHAIN_ORIGIN, ...extractCommonRequestAttributes(serialized, invocationParams, langSmithMetadata), }; } diff --git a/packages/server-utils/src/ai/langgraph/index.ts b/packages/server-utils/src/ai/langgraph/index.ts index 00825cbd6206..6795c3bd6317 100644 --- a/packages/server-utils/src/ai/langgraph/index.ts +++ b/packages/server-utils/src/ai/langgraph/index.ts @@ -1,5 +1,5 @@ /* eslint-disable typescript-eslint/no-deprecated */ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan, stringify } from '@sentry/core'; +import { SPAN_STATUS_ERROR, startSpan, stringify } from '@sentry/core'; import { GEN_AI_AGENT_NAME, GEN_AI_CONVERSATION_ID, @@ -10,6 +10,7 @@ import { GEN_AI_SYSTEM_INSTRUCTIONS, GEN_AI_TOOL_DEFINITIONS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_INVOKE_AGENT } from '@sentry/conventions/op'; import { extractSystemInstructions, resolveAIRecordingOptions } from '../core/utils'; @@ -99,7 +100,7 @@ export function instrumentCompiledGraphInvoke( { name: 'invoke_agent', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, + [SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, [SENTRY_OP]: GEN_AI_INVOKE_AGENT, [GEN_AI_OPERATION_NAME]: 'invoke_agent', }, diff --git a/packages/server-utils/src/ai/langgraph/utils.ts b/packages/server-utils/src/ai/langgraph/utils.ts index 86e43d2d33a0..94e39318d10e 100644 --- a/packages/server-utils/src/ai/langgraph/utils.ts +++ b/packages/server-utils/src/ai/langgraph/utils.ts @@ -1,5 +1,5 @@ /* eslint-disable typescript-eslint/no-deprecated */ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan } from '@sentry/core'; +import { SPAN_STATUS_ERROR, startSpan } from '@sentry/core'; import type { Span, SpanAttributes } from '@sentry/core'; import { GEN_AI_AGENT_NAME, @@ -16,6 +16,7 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_EXECUTE_TOOL } from '@sentry/conventions/op'; import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../core/gen-ai-attributes'; @@ -75,7 +76,7 @@ export function wrapToolsWithSpans(tools: unknown[], options: LangGraphOptions, const wrappedInvoke = new Proxy(originalInvoke as (...args: unknown[]) => unknown, { apply(target, thisArg, args: unknown[]): unknown { const spanAttributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, + [SENTRY_ORIGIN]: LANGGRAPH_ORIGIN, [SENTRY_OP]: GEN_AI_EXECUTE_TOOL, [GEN_AI_OPERATION_NAME]: 'execute_tool', [GEN_AI_TOOL_NAME]: toolName, diff --git a/packages/server-utils/src/ai/mastra/index.ts b/packages/server-utils/src/ai/mastra/index.ts index 48db51f77fcc..0bfcdd712777 100644 --- a/packages/server-utils/src/ai/mastra/index.ts +++ b/packages/server-utils/src/ai/mastra/index.ts @@ -5,11 +5,10 @@ import { getActiveSpan, getClient, LRUMap, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; -import { GEN_AI_RESPONSE_MODEL, SENTRY_OP } from '@sentry/conventions/attributes'; +import { GEN_AI_RESPONSE_MODEL, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DEBUG_BUILD } from '../../debug-build'; import type { GenAiOptions } from '../core/utils'; import { resolveAIRecordingOptions } from '../core/utils'; @@ -144,7 +143,7 @@ export class SentryMastraExporter implements MastraObservabilityExporter { attributes: { ...this._attributesFor(span), [SENTRY_OP]: getOperation(span.type)?.op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: MASTRA_ORIGIN, + [SENTRY_ORIGIN]: MASTRA_ORIGIN, }, }); diff --git a/packages/server-utils/src/ai/mistral/index.ts b/packages/server-utils/src/ai/mistral/index.ts index 96a335d0ebf2..4f6ba7b25f7e 100644 --- a/packages/server-utils/src/ai/mistral/index.ts +++ b/packages/server-utils/src/ai/mistral/index.ts @@ -1,10 +1,4 @@ -import { - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startSpan, - startSpanManual, - stringify, -} from '@sentry/core'; +import { SPAN_STATUS_ERROR, startSpan, startSpanManual, stringify } from '@sentry/core'; import type { Span, SpanAttributeValue } from '@sentry/core'; import { GEN_AI_AGENT_NAME, @@ -14,6 +8,7 @@ import { GEN_AI_PROVIDER_NAME, GEN_AI_SYSTEM_INSTRUCTIONS, GEN_AI_TOOL_DEFINITIONS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { InstrumentedMethodEntry } from '../core/utils'; import { @@ -55,7 +50,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: MISTRAL_PROVIDER_NAME, [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: MISTRAL_ORIGIN, + [SENTRY_ORIGIN]: MISTRAL_ORIGIN, [GEN_AI_REQUEST_STREAM_ATTRIBUTE]: streaming, }; diff --git a/packages/server-utils/src/ai/openai/index.ts b/packages/server-utils/src/ai/openai/index.ts index 7bed7ab27743..981da4281ef5 100644 --- a/packages/server-utils/src/ai/openai/index.ts +++ b/packages/server-utils/src/ai/openai/index.ts @@ -3,7 +3,6 @@ import { DEBUG_BUILD } from '../../debug-build'; import { getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startSpan, startSpanManual, @@ -19,6 +18,7 @@ import { GEN_AI_REQUEST_MODEL, GEN_AI_SYSTEM_INSTRUCTIONS, GEN_AI_TOOL_DEFINITIONS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { InstrumentedMethodEntry } from '../core/utils'; import { @@ -67,7 +67,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: 'openai', [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.openai', + [SENTRY_ORIGIN]: 'auto.ai.openai', }; if (args.length > 0 && typeof args[0] === 'object' && args[0] !== null) { diff --git a/packages/server-utils/src/ai/typesafe/index.ts b/packages/server-utils/src/ai/typesafe/index.ts index 328853cf5b02..0155969192d0 100644 --- a/packages/server-utils/src/ai/typesafe/index.ts +++ b/packages/server-utils/src/ai/typesafe/index.ts @@ -8,16 +8,10 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import type { Span, SpanAttributes } from '@sentry/core'; -import { - isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, - stringify, - withActiveSpan, -} from '@sentry/core'; +import { isObjectLike, SPAN_STATUS_ERROR, startInactiveSpan, stringify, withActiveSpan } from '@sentry/core'; import type { GenAiOptions } from '../core/utils'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../core/utils'; import { TYPESAFE_ORIGIN, TYPESAFE_PROVIDER_NAME } from './constants'; @@ -45,7 +39,7 @@ function getRequestAttributes( recordInputs: boolean, ): SpanAttributes { return { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: TYPESAFE_ORIGIN, + [SENTRY_ORIGIN]: TYPESAFE_ORIGIN, [GEN_AI_OPERATION_NAME]: 'evaluate', [GEN_AI_PROVIDER_NAME]: TYPESAFE_PROVIDER_NAME, ...(model ? { [GEN_AI_REQUEST_MODEL]: model } : {}), diff --git a/packages/server-utils/src/ai/workers-ai/utils.ts b/packages/server-utils/src/ai/workers-ai/utils.ts index 4af2c3424e05..b242e62f7014 100644 --- a/packages/server-utils/src/ai/workers-ai/utils.ts +++ b/packages/server-utils/src/ai/workers-ai/utils.ts @@ -14,9 +14,10 @@ import { GEN_AI_RESPONSE_TEXT, GEN_AI_RESPONSE_TOOL_CALLS, GEN_AI_SYSTEM_INSTRUCTIONS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_CHAT, GEN_AI_EMBEDDINGS } from '@sentry/conventions/op'; -import { isObjectLike, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, stringify } from '@sentry/core'; +import { isObjectLike, stringify } from '@sentry/core'; import type { Span, SpanAttributeValue } from '@sentry/core'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../core/gen-ai-attributes'; import { @@ -69,7 +70,7 @@ export function extractRequestAttributes( const attributes: Record = { [GEN_AI_PROVIDER_NAME]: WORKERS_AI_PROVIDER_NAME, [GEN_AI_OPERATION_NAME]: operationName, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, + [SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, [GEN_AI_REQUEST_MODEL]: typeof model === 'string' ? model : 'unknown', }; diff --git a/packages/server-utils/src/integrations/amqplib.ts b/packages/server-utils/src/integrations/amqplib.ts index b67b546d8b2f..9b227d7e0e2c 100644 --- a/packages/server-utils/src/integrations/amqplib.ts +++ b/packages/server-utils/src/integrations/amqplib.ts @@ -7,7 +7,6 @@ import { getClient, getTraceData, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, timestampInSeconds, @@ -26,6 +25,7 @@ import { SERVER_ADDRESS, SERVER_PORT, URL_FULL, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { QUEUE_PROCESS, QUEUE_PUBLISH } from '@sentry/conventions/op'; import { amqplibModuleNames } from '../orchestrion/config/amqplib'; @@ -464,7 +464,7 @@ function startPublishSpan(data: AmqpChannelContext): Span { [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_VALUE_SEND, [MESSAGING_MESSAGE_ID]: options?.messageId as string | undefined, [ATTR_MESSAGING_CONVERSATION_ID]: options?.correlationId as string | undefined, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PUBLISHER_ORIGIN, + [SENTRY_ORIGIN]: PUBLISHER_ORIGIN, }, }); @@ -510,7 +510,7 @@ function startConsumeSpan(queue: string | undefined, msg: ConsumeMessage, channe [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_VALUE_PROCESS, [MESSAGING_MESSAGE_ID]: msg.properties?.messageId as string | undefined, [ATTR_MESSAGING_CONVERSATION_ID]: msg.properties?.correlationId as string | undefined, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN, + [SENTRY_ORIGIN]: CONSUMER_ORIGIN, }, }); } diff --git a/packages/server-utils/src/integrations/anthropic.ts b/packages/server-utils/src/integrations/anthropic.ts index 33517d4730c2..d14d3cbb2f6a 100644 --- a/packages/server-utils/src/integrations/anthropic.ts +++ b/packages/server-utils/src/integrations/anthropic.ts @@ -1,4 +1,4 @@ -import { GEN_AI_REQUEST_MODEL } from '@sentry/conventions/attributes'; +import { GEN_AI_REQUEST_MODEL, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as diagnosticsChannel from '../utils/diagnosticsChannel'; import type { IntegrationFn, Span, SpanAttributeValue } from '@sentry/core'; import { @@ -7,7 +7,6 @@ import { getActiveSpan, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../ai/core/utils'; @@ -115,7 +114,7 @@ function createGenAiSpan( const attributes = extractRequestAttributes(args, operation, recordInputs); const model = (attributes[GEN_AI_REQUEST_MODEL] as string) || 'unknown'; - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN; + attributes[SENTRY_ORIGIN] = ORIGIN; const client = getClient(); const span = startInactiveSpan({ diff --git a/packages/server-utils/src/integrations/aws-sdk/index.ts b/packages/server-utils/src/integrations/aws-sdk/index.ts index eb966dcd56c6..25a75931deb7 100644 --- a/packages/server-utils/src/integrations/aws-sdk/index.ts +++ b/packages/server-utils/src/integrations/aws-sdk/index.ts @@ -1,12 +1,13 @@ import * as diagnosticsChannel from '../../utils/diagnosticsChannel'; import type { IntegrationFn, Span } from '@sentry/core'; -import { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { defineIntegration, startInactiveSpan } from '@sentry/core'; import { _AWS_REQUEST_ID as AWS_REQUEST_ID, AWS_REQUEST_EXTENDED_ID, CLOUD_REGION, SENTRY_KIND, HTTP_RESPONSE_STATUS_CODE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { RPC } from '@sentry/conventions/op'; import { CHANNELS } from '../../orchestrion/channels'; @@ -111,7 +112,7 @@ function instrumentAwsSdk(servicesExtensions: ServicesExtensions): void { op: requestMetadata.spanOp || RPC, attributes: { [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: AWS_SDK_ORIGIN, + [SENTRY_ORIGIN]: AWS_SDK_ORIGIN, ...extractAttributesFromNormalizedRequest(normalizedRequest), ...requestMetadata.spanAttributes, }, diff --git a/packages/server-utils/src/integrations/dataloader.ts b/packages/server-utils/src/integrations/dataloader.ts index ac928f3ceeca..89decb7338e9 100644 --- a/packages/server-utils/src/integrations/dataloader.ts +++ b/packages/server-utils/src/integrations/dataloader.ts @@ -6,6 +6,7 @@ import { DB_OPERATION_NAME, SENTRY_KIND, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { CACHE_GET, CACHE_PUT, CACHE_REMOVE } from '@sentry/conventions/op'; import type { IntegrationFn, Span, StartSpanOptions } from '@sentry/core'; @@ -15,7 +16,6 @@ import { defineIntegration, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, startSpan, waitForTracingChannelBinding, @@ -113,7 +113,7 @@ function makeSpanOptions( // the vendored OTel instrumentation. The `batch` runs off a deferred tick with no obvious network // peer, so it gets no kind. [SENTRY_KIND]: operation === 'batch' ? undefined : 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [DB_OPERATION_NAME]: operation, // A loader batches and caches one entity type, so it is the closest thing dataloader has to a // collection. Unnamed loaders report nothing. diff --git a/packages/server-utils/src/integrations/express/instrumentation.ts b/packages/server-utils/src/integrations/express/instrumentation.ts index ae442c454602..753ebbc90660 100644 --- a/packages/server-utils/src/integrations/express/instrumentation.ts +++ b/packages/server-utils/src/integrations/express/instrumentation.ts @@ -1,5 +1,5 @@ import type * as diagnosticsChannel from 'node:diagnostics_channel'; -import { HTTP_ROUTE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { HTTP_ROUTE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HANDLER, MIDDLEWARE, ROUTER } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; import { @@ -12,7 +12,6 @@ import { hasSpanStreamingEnabled, REQUEST_HANDLER_SPAN_NAME_FALLBACK, ROUTER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, stringMatchesSomePattern, withActiveSpan, @@ -340,7 +339,7 @@ function getSpanForLayer(data: HandleChannelContext, options: ExpressIntegration ? matchedRoute || REQUEST_HANDLER_SPAN_NAME_FALLBACK : name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: EXPRESS_TYPE_TO_SPAN_OP[type], [ATTR_EXPRESS_NAME]: name, [ATTR_EXPRESS_TYPE]: type, diff --git a/packages/server-utils/src/integrations/fastify/instrumentation.ts b/packages/server-utils/src/integrations/fastify/instrumentation.ts index 92f71c908fe4..6d34c4f66f2d 100644 --- a/packages/server-utils/src/integrations/fastify/instrumentation.ts +++ b/packages/server-utils/src/integrations/fastify/instrumentation.ts @@ -21,6 +21,7 @@ import { HTTP_ROUTE, SENTRY_OP, URL_PATH, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { HANDLER, MIDDLEWARE } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; @@ -30,7 +31,6 @@ import { getIsolationScope, hasSpanStreamingEnabled, REQUEST_HANDLER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, startSpan, @@ -168,7 +168,7 @@ function onRequest(this: any, request: any, _reply: any, hookDone: () => void): getIsolationScope().setTransactionName(`${method} ${routeName}`); const attributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: HANDLER, [HTTP_REQUEST_METHOD]: request.method, [URL_PATH]: request.url, @@ -359,7 +359,7 @@ function handlerWrapper(handler: AnyFn, hookName: string, spanAttributes: Record attributes: { ...spanAttributes, [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }, parentSpan, }, diff --git a/packages/server-utils/src/integrations/firebase/firestore.ts b/packages/server-utils/src/integrations/firebase/firestore.ts index 161daca6abaf..43928bd504b0 100644 --- a/packages/server-utils/src/integrations/firebase/firestore.ts +++ b/packages/server-utils/src/integrations/firebase/firestore.ts @@ -8,10 +8,11 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core'; import type { FirebaseApp, FirebaseOptions, FirestoreReference, FirestoreSettings } from './firestore-types'; /** @@ -24,7 +25,7 @@ export function startFirestoreSpan(spanName: string, reference: FirestoreReferen attributes: { [SENTRY_OP]: DB_QUERY, [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.firebase.firestore', + [SENTRY_ORIGIN]: 'auto.firebase.firestore', [DB_OPERATION_NAME]: spanName, ...buildAttributes(reference), }, diff --git a/packages/server-utils/src/integrations/firebase/functions.ts b/packages/server-utils/src/integrations/firebase/functions.ts index c8a919ef6fa8..75fd439a3cd6 100644 --- a/packages/server-utils/src/integrations/firebase/functions.ts +++ b/packages/server-utils/src/integrations/firebase/functions.ts @@ -5,6 +5,7 @@ import { SENTRY_KIND, SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { FUNCTION_GCP } from '@sentry/conventions/op'; import type { SpanAttributes } from '@sentry/core'; @@ -13,7 +14,6 @@ import { flush, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, SPAN_STATUS_ERROR, startSpanManual, @@ -65,7 +65,7 @@ function wrapHandler(handler: Handler, triggerType: string): Handler { const enhancedTriggerType = `firebase.function.${triggerType}`; const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FUNCTIONS_ORIGIN, + [SENTRY_ORIGIN]: FUNCTIONS_ORIGIN, [FAAS_NAME]: functionName, [FAAS_TRIGGER]: triggerType, 'faas.provider': 'firebase', diff --git a/packages/server-utils/src/integrations/generic-pool.ts b/packages/server-utils/src/integrations/generic-pool.ts index 40d0f4c530a1..f5236f5a364c 100644 --- a/packages/server-utils/src/integrations/generic-pool.ts +++ b/packages/server-utils/src/integrations/generic-pool.ts @@ -1,8 +1,8 @@ import * as diagnosticsChannel from '../utils/diagnosticsChannel'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { IntegrationFn } from '@sentry/core'; -import { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { defineIntegration, startInactiveSpan } from '@sentry/core'; import { CHANNELS } from '../orchestrion/channels'; import { genericPoolModuleNames } from '../orchestrion/config/generic-pool'; import { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation'; @@ -41,7 +41,7 @@ function instrumentGenericPool(): void { name: 'generic-pool.acquire', attributes: { [SENTRY_OP]: DB, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.generic_pool', + [SENTRY_ORIGIN]: 'auto.db.generic_pool', }, }), ); diff --git a/packages/server-utils/src/integrations/google-genai.ts b/packages/server-utils/src/integrations/google-genai.ts index 6ddaf8757d6a..b191c503df5b 100644 --- a/packages/server-utils/src/integrations/google-genai.ts +++ b/packages/server-utils/src/integrations/google-genai.ts @@ -7,7 +7,6 @@ import { getActiveSpan, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, startInactiveSpan, } from '@sentry/core'; @@ -116,7 +115,7 @@ function createGenAiSpan( const attributes = extractRequestAttributes(operation, params, data.self, recordInputs); const model = (attributes[GEN_AI_REQUEST_MODEL] as string) || 'unknown'; - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN; + attributes[SENTRY_ORIGIN] = ORIGIN; const client = getClient(); const span = startInactiveSpan({ diff --git a/packages/server-utils/src/integrations/graphql/graphql-dc-subscriber.ts b/packages/server-utils/src/integrations/graphql/graphql-dc-subscriber.ts index 57aea8904715..8ea8a5d91944 100644 --- a/packages/server-utils/src/integrations/graphql/graphql-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/graphql/graphql-dc-subscriber.ts @@ -4,15 +4,10 @@ import { GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GRAPHQL } from '@sentry/conventions/op'; -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../../tracing-channel'; import { GRAPHQL_FIELD_NAME, @@ -163,7 +158,7 @@ function setupParseChannel(tracingChannel: GraphqlTracingChannelFactory): void { return startInactiveSpan({ name: client && hasSpanStreamingEnabled(client) ? `GraphQL ${PROCESSING_TYPE_PARSE}` : SPAN_NAME_PARSE, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_PARSE, }, @@ -180,7 +175,7 @@ function setupValidateChannel(tracingChannel: GraphqlTracingChannelFactory): voi return startInactiveSpan({ name: client && hasSpanStreamingEnabled(client) ? `GraphQL ${PROCESSING_TYPE_VALIDATE}` : SPAN_NAME_VALIDATE, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_VALIDATE, [GRAPHQL_DOCUMENT]: collectGraphqlDocument(data.document), @@ -216,7 +211,7 @@ function setupOperationChannel( ? streamedName : getOperationSpanName(data.operationType, data.operationName, fallbackName), attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_EXECUTE, [GRAPHQL_OPERATION_TYPE]: data.operationType, @@ -258,7 +253,7 @@ function setupResolveChannel(tracingChannel: GraphqlTracingChannelFactory, ignor ? `GraphQL ${PROCESSING_TYPE_RESOLVE}` : `${SPAN_NAME_RESOLVE} ${data.fieldPath}`, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_RESOLVE, [GRAPHQL_FIELD_NAME]: data.fieldName, diff --git a/packages/server-utils/src/integrations/graphql/resolvers.ts b/packages/server-utils/src/integrations/graphql/resolvers.ts index d5c36ccd4915..c432b06b79ec 100644 --- a/packages/server-utils/src/integrations/graphql/resolvers.ts +++ b/packages/server-utils/src/integrations/graphql/resolvers.ts @@ -6,14 +6,13 @@ * call runs). Resolver spans use the same origin/op/field attributes as the native subscriber. */ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { GRAPHQL } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; import { getClient, hasSpanStreamingEnabled, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, withActiveSpan, @@ -182,7 +181,7 @@ function createFieldIfNotExists( function createResolverSpan(info: GraphQLResolveInfo, path: string[], parentSpan?: Span): Span { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: GRAPHQL, [GRAPHQL_PROCESSING_TYPE]: PROCESSING_TYPE_RESOLVE, [GRAPHQL_FIELD_NAME]: info.fieldName, diff --git a/packages/server-utils/src/integrations/graphql/spans.ts b/packages/server-utils/src/integrations/graphql/spans.ts index fb0ef6a624b7..329407428a81 100644 --- a/packages/server-utils/src/integrations/graphql/spans.ts +++ b/packages/server-utils/src/integrations/graphql/spans.ts @@ -10,16 +10,11 @@ import { GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GRAPHQL } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; -import { - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, - startInactiveSpan, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, SPAN_STATUS_ERROR, startInactiveSpan } from '@sentry/core'; import type { GraphqlDocumentNode } from './types'; import { collectGraphqlDocument, getOperationSpanName, hasResultErrors, renameRootSpanWithOperation } from './utils'; import { @@ -44,7 +39,7 @@ import type { } from './types'; const BASE_ATTRIBUTES = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: GRAPHQL, } as const; diff --git a/packages/server-utils/src/integrations/hapi/hapi-utils.ts b/packages/server-utils/src/integrations/hapi/hapi-utils.ts index 21c27d91eec5..5c7afa11a268 100644 --- a/packages/server-utils/src/integrations/hapi/hapi-utils.ts +++ b/packages/server-utils/src/integrations/hapi/hapi-utils.ts @@ -16,10 +16,9 @@ import { isObjectLike, REQUEST_HANDLER_SPAN_NAME_FALLBACK, ROUTER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, } from '@sentry/core'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HANDLER, MIDDLEWARE, ROUTER } from '@sentry/conventions/op'; import type { HapiRequest, @@ -179,7 +178,7 @@ function startMetadataSpan(metadata: SpanMetadata, original: () => unknown): unk attributes: { ...metadata.attributes, [SENTRY_OP]: op, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.hapi', + [SENTRY_ORIGIN]: 'auto.http.hapi', }, }, original, diff --git a/packages/server-utils/src/integrations/hono/honoIntegration.ts b/packages/server-utils/src/integrations/hono/honoIntegration.ts index 6c30f31ccafb..d62e949125ef 100644 --- a/packages/server-utils/src/integrations/hono/honoIntegration.ts +++ b/packages/server-utils/src/integrations/hono/honoIntegration.ts @@ -1,9 +1,9 @@ import * as diagnosticsChannel from '../../utils/diagnosticsChannel'; import { createRequire } from 'node:module'; -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; import type { IntegrationFn } from '@sentry/core'; -import { debug, defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { debug, defineIntegration, startInactiveSpan } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import type { Env, GetConnInfo, Hono, MiddlewareHandler } from './honoTypes'; import { CHANNELS } from '../../orchestrion/channels'; @@ -171,7 +171,7 @@ function instrumentInternalRequests(): void { name: `${method} ${extractPathname(input)}`, attributes: { [SENTRY_OP]: HTTP_SERVER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, + [SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, }, }); }, diff --git a/packages/server-utils/src/integrations/hono/patchAppRequest.ts b/packages/server-utils/src/integrations/hono/patchAppRequest.ts index bc54e3716b32..15bb20cc21fd 100644 --- a/packages/server-utils/src/integrations/hono/patchAppRequest.ts +++ b/packages/server-utils/src/integrations/hono/patchAppRequest.ts @@ -1,13 +1,6 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; -import { - debug, - getActiveSpan, - getOriginalFunction, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startSpan, - type WrappedFunction, -} from '@sentry/core'; +import { debug, getActiveSpan, getOriginalFunction, startSpan, type WrappedFunction } from '@sentry/core'; import { INTERNAL_REQUEST_ORIGIN } from './constants'; import type { Env, Hono } from './honoTypes'; import { DEBUG_BUILD } from '../../debug-build'; @@ -104,7 +97,7 @@ export function patchAppRequest(app: Hono): void { onlyIfParent: true, attributes: { [SENTRY_OP]: INTERNAL_REQUEST_OP, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, + [SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN, }, }, () => { diff --git a/packages/server-utils/src/integrations/hono/wrapMiddlewareSpan.ts b/packages/server-utils/src/integrations/hono/wrapMiddlewareSpan.ts index e3e451247614..86f96e05039c 100644 --- a/packages/server-utils/src/integrations/hono/wrapMiddlewareSpan.ts +++ b/packages/server-utils/src/integrations/hono/wrapMiddlewareSpan.ts @@ -1,10 +1,9 @@ -import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { MIDDLEWARE } from '@sentry/conventions/op'; import { getActiveSpan, getOriginalFunction, getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, type WrappedFunction, @@ -43,7 +42,7 @@ export function wrapMiddlewareWithSpan(handler: MiddlewareHandler): MiddlewareHa parentSpan: rootSpan, attributes: { [SENTRY_OP]: MIDDLEWARE, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: MIDDLEWARE_ORIGIN, + [SENTRY_ORIGIN]: MIDDLEWARE_ORIGIN, }, }); diff --git a/packages/server-utils/src/integrations/kafkajs/spans.ts b/packages/server-utils/src/integrations/kafkajs/spans.ts index 4aef66e08395..fdae5a0d46bd 100644 --- a/packages/server-utils/src/integrations/kafkajs/spans.ts +++ b/packages/server-utils/src/integrations/kafkajs/spans.ts @@ -18,6 +18,7 @@ import { MESSAGING_SYSTEM, SENTRY_KIND, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { QUEUE_PROCESS, QUEUE_PUBLISH, QUEUE_RECEIVE } from '@sentry/conventions/op'; import type { Span, SpanAttributes, SpanLink } from '@sentry/core'; @@ -26,7 +27,6 @@ import { getTraceData, hasSpanStreamingEnabled, propagationContextFromHeaders, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; @@ -135,7 +135,7 @@ export function startConsumerSpan({ topic, message, operationType, links, attrib [ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset as string | undefined, // Mirror the upstream behavior of only tagging per-message processing spans (not the batch // receiving span, which carries no message) with the auto origin. - ...(message ? { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}), + ...(message ? { [SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}), }, }); } @@ -155,7 +155,7 @@ export function startProducerSpan(topic: string, message: Message): Span { message.partition !== undefined ? String(message.partition) : undefined, [MESSAGING_OPERATION_NAME]: 'send', [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN, + [SENTRY_ORIGIN]: PRODUCER_ORIGIN, }, }); diff --git a/packages/server-utils/src/integrations/knex.ts b/packages/server-utils/src/integrations/knex.ts index 5d85d1491682..781d26aa70c8 100644 --- a/packages/server-utils/src/integrations/knex.ts +++ b/packages/server-utils/src/integrations/knex.ts @@ -10,7 +10,6 @@ import { getActiveSpan, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, truncate, @@ -28,6 +27,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import { DEBUG_BUILD } from '../debug-build'; @@ -182,7 +182,7 @@ function subscribeQuery(): void { const attributes: SpanAttributes = { [SENTRY_OP]: DB, [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, 'knex.version': data.moduleVersion, [DB_SYSTEM_NAME]: dbSystem, [ATTR_DB_SQL_TABLE]: table, diff --git a/packages/server-utils/src/integrations/koa/index.ts b/packages/server-utils/src/integrations/koa/index.ts index 3ee982041147..e3f1c10690c0 100644 --- a/packages/server-utils/src/integrations/koa/index.ts +++ b/packages/server-utils/src/integrations/koa/index.ts @@ -10,10 +10,9 @@ import { getIsolationScope, hasSpanStreamingEnabled, ROUTER_SPAN_NAME_FALLBACK, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan, } from '@sentry/core'; -import { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_TYPE, SENTRY_OP } from '@sentry/conventions/attributes'; +import { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_TYPE, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { MIDDLEWARE, ROUTER } from '@sentry/conventions/op'; import { DEBUG_BUILD } from '../../debug-build'; import { CHANNELS } from '../../orchestrion/channels'; @@ -213,7 +212,7 @@ function patchLayer( attributes: { ...metadata.attributes, [SENTRY_OP]: layerType === LAYER_TYPE.MIDDLEWARE ? MIDDLEWARE : ROUTER, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }, }, () => { diff --git a/packages/server-utils/src/integrations/mistral.ts b/packages/server-utils/src/integrations/mistral.ts index 117f0f965c0b..f70d026cf358 100644 --- a/packages/server-utils/src/integrations/mistral.ts +++ b/packages/server-utils/src/integrations/mistral.ts @@ -1,11 +1,7 @@ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as diagnosticsChannel from '../utils/diagnosticsChannel'; import type { IntegrationFn, Span, SpanAttributeValue } from '@sentry/core'; -import { - _INTERNAL_shouldSkipAiProviderWrapping, - defineIntegration, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { _INTERNAL_shouldSkipAiProviderWrapping, defineIntegration, startInactiveSpan } from '@sentry/core'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../ai/core/utils'; import { addRequestAttributes, extractRequestAttributes } from '../ai/mistral'; import { MISTRAL_INTEGRATION_NAME, MISTRAL_ORIGIN } from '../ai/mistral/constants'; @@ -86,7 +82,7 @@ function createGenAiSpan( const { recordInputs } = resolveAIRecordingOptions(options); const attributes = extractRequestAttributes(args, operation, recordInputs, streaming); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = MISTRAL_ORIGIN; + attributes[SENTRY_ORIGIN] = MISTRAL_ORIGIN; const span = startInactiveSpan({ name: getSpanName(operation, attributes), diff --git a/packages/server-utils/src/integrations/mongodb/mongodb-span.ts b/packages/server-utils/src/integrations/mongodb/mongodb-span.ts index 455b86653ac5..2f0a86721314 100644 --- a/packages/server-utils/src/integrations/mongodb/mongodb-span.ts +++ b/packages/server-utils/src/integrations/mongodb/mongodb-span.ts @@ -8,16 +8,11 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { - getClient, - hasSpanStreamingEnabled, - isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from '@sentry/core'; // `db.connection_string` is not part of `@sentry/conventions`, so it stays inlined to match // what `@opentelemetry/instrumentation-mongodb` emitted. @@ -127,7 +122,7 @@ export function getSpanAttributes( origin: string, ): SpanAttributes { const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, + [SENTRY_ORIGIN]: origin, [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MONGODB, [DB_NAMESPACE]: dbName, [DB_COLLECTION_NAME]: dbCollection, diff --git a/packages/server-utils/src/integrations/mongoose/mongoose-dc-subscriber.ts b/packages/server-utils/src/integrations/mongoose/mongoose-dc-subscriber.ts index 7e4230b84fbe..9739ba070096 100644 --- a/packages/server-utils/src/integrations/mongoose/mongoose-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/mongoose/mongoose-dc-subscriber.ts @@ -9,16 +9,10 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { - debug, - getClient, - hasSpanStreamingEnabled, - isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { debug, getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import { bindTracingChannelToSpan } from '../../tracing-channel'; @@ -138,7 +132,7 @@ function setupChannel(tracingChannel: MongooseTracingChannelFactory, channelName return startInactiveSpan({ name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB, [DB_OPERATION_NAME]: data.operation, diff --git a/packages/server-utils/src/integrations/mongoose/mongoose-legacy-span.ts b/packages/server-utils/src/integrations/mongoose/mongoose-legacy-span.ts index b279343435f8..d22e7c8a1063 100644 --- a/packages/server-utils/src/integrations/mongoose/mongoose-legacy-span.ts +++ b/packages/server-utils/src/integrations/mongoose/mongoose-legacy-span.ts @@ -8,10 +8,11 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { getClient, hasSpanStreamingEnabled, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, startInactiveSpan } from '@sentry/core'; const DB_SYSTEM_NAME_VALUE_MONGODB = 'mongodb'; @@ -59,7 +60,7 @@ export function startMongooseLegacySpan({ [SERVER_PORT]: collection?.conn?.port, [DB_OPERATION_NAME]: operation, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MONGODB, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin, + [SENTRY_ORIGIN]: origin, }; const client = getClient(); diff --git a/packages/server-utils/src/integrations/mysql.ts b/packages/server-utils/src/integrations/mysql.ts index ccbbad5a1565..e4049b65d30a 100644 --- a/packages/server-utils/src/integrations/mysql.ts +++ b/packages/server-utils/src/integrations/mysql.ts @@ -9,6 +9,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { IntegrationFn, Scope } from '@sentry/core'; @@ -19,7 +20,6 @@ import { getClient, getCurrentScope, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { sanitizeSqlQueryWithSummary } from '../utils/sql'; @@ -102,7 +102,7 @@ function instrumentMysql(): void { [SENTRY_OP]: DB, [SENTRY_KIND]: 'client', [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.mysql', + [SENTRY_ORIGIN]: 'auto.db.mysql', [ATTR_DB_CONNECTION_STRING]: getJDBCString(host, portIsNumber ? portNumber : undefined, database), ...(database ? { [DB_NAMESPACE]: database } : {}), ...(user ? { [DB_USER]: user } : {}), diff --git a/packages/server-utils/src/integrations/mysql2/index.ts b/packages/server-utils/src/integrations/mysql2/index.ts index 4d01b681f1ce..b8f6501a26ba 100644 --- a/packages/server-utils/src/integrations/mysql2/index.ts +++ b/packages/server-utils/src/integrations/mysql2/index.ts @@ -5,7 +5,6 @@ import { getClient, hasSpanStreamingEnabled, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, waitForTracingChannelBinding, } from '@sentry/core'; @@ -26,6 +25,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; @@ -96,7 +96,7 @@ function subscribeQueryChannel(channelName: ChannelName): void { name, attributes: { [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MYSQL, [DB_QUERY_TEXT]: queryText || undefined, diff --git a/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts b/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts index 71264c73565f..6ba7d1699d01 100644 --- a/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts @@ -8,9 +8,10 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { getClient, hasSpanStreamingEnabled, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../../tracing-channel'; import { sanitizeSqlQueryWithSummary } from '../../utils/sql'; @@ -109,7 +110,7 @@ function setupQueryChannel(tracingChannel: MySQL2TracingChannelFactory, channelN return startInactiveSpan({ name, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL, [DB_QUERY_TEXT]: queryText, @@ -132,7 +133,7 @@ function setupConnectChannel(tracingChannel: MySQL2TracingChannelFactory, channe return startInactiveSpan({ name: spanName, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_MYSQL, [DB_NAMESPACE]: data.database || undefined, diff --git a/packages/server-utils/src/integrations/openai-compatible.ts b/packages/server-utils/src/integrations/openai-compatible.ts index be98c3de7a9e..2c23c711b60f 100644 --- a/packages/server-utils/src/integrations/openai-compatible.ts +++ b/packages/server-utils/src/integrations/openai-compatible.ts @@ -4,10 +4,9 @@ import { _INTERNAL_shouldSkipAiProviderWrapping, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; -import { GEN_AI_PROVIDER_NAME } from '@sentry/conventions/attributes'; +import { GEN_AI_PROVIDER_NAME, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../ai/core/utils'; import { wrapApiPromiseResponse } from '../ai/core/apiPromise'; import { addRequestAttributes, extractRequestAttributes } from '../ai/openai'; @@ -117,7 +116,7 @@ function createGenAiSpan( // `extractRequestAttributes` defaults the provider to openai; override it for the concrete provider. const attributes = extractRequestAttributes(args, operation, recordInputs); attributes[GEN_AI_PROVIDER_NAME] = provider.providerName; - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = provider.origin; + attributes[SENTRY_ORIGIN] = provider.origin; const model = (params?.model as string) || 'unknown'; const client = getClient(); diff --git a/packages/server-utils/src/integrations/openai.ts b/packages/server-utils/src/integrations/openai.ts index ada6e60411a2..a5375794033e 100644 --- a/packages/server-utils/src/integrations/openai.ts +++ b/packages/server-utils/src/integrations/openai.ts @@ -1,3 +1,4 @@ +import { SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import * as diagnosticsChannel from '../utils/diagnosticsChannel'; import type { IntegrationFn, Span, SpanAttributeValue } from '@sentry/core'; import { @@ -5,7 +6,6 @@ import { defineIntegration, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { getGenAiSpanOp, resolveAIRecordingOptions } from '../ai/core/utils'; @@ -93,7 +93,7 @@ function createGenAiSpan(data: OpenAiChatChannelContext, operation: string, opti const { recordInputs } = resolveAIRecordingOptions(options); const attributes = extractRequestAttributes(args, operation, recordInputs); - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN; + attributes[SENTRY_ORIGIN] = ORIGIN; const model = (params?.model as string) || 'unknown'; const client = getClient(); diff --git a/packages/server-utils/src/integrations/postgres-js.ts b/packages/server-utils/src/integrations/postgres-js.ts index afb8d5ecc099..5d3b865cd20d 100644 --- a/packages/server-utils/src/integrations/postgres-js.ts +++ b/packages/server-utils/src/integrations/postgres-js.ts @@ -7,6 +7,7 @@ import { ERROR_TYPE, SENTRY_KIND, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { IntegrationFn, Span } from '@sentry/core'; @@ -15,7 +16,6 @@ import { defineIntegration, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; @@ -299,7 +299,7 @@ function instrumentPostgresJs(options: PostgresJsIntegrationOptions): void { attributes: { [SENTRY_OP]: DB, [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_POSTGRES, [DB_QUERY_TEXT]: sanitizedSqlQuery, [DB_QUERY_SUMMARY]: querySummary, diff --git a/packages/server-utils/src/integrations/postgres.ts b/packages/server-utils/src/integrations/postgres.ts index 1e7f0fdeb018..5d93ac17769f 100644 --- a/packages/server-utils/src/integrations/postgres.ts +++ b/packages/server-utils/src/integrations/postgres.ts @@ -9,6 +9,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import type { IntegrationFn, Scope, SpanAttributes } from '@sentry/core'; @@ -19,7 +20,6 @@ import { getClient, getCurrentScope, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; import { sanitizeSqlQueryWithSummary } from '../utils/sql'; @@ -191,7 +191,7 @@ function querySpanOptions(ctx: PgChannelContext): { name: string; attributes: Sp attributes: { [SENTRY_OP]: DB, ...getConnectionAttributes(params), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [DB_QUERY_TEXT]: queryText || undefined, [DB_QUERY_SUMMARY]: querySummary, [ATTR_PG_PLAN]: typeof queryConfig?.name === 'string' ? queryConfig.name : undefined, diff --git a/packages/server-utils/src/integrations/prisma/orchestrion.ts b/packages/server-utils/src/integrations/prisma/orchestrion.ts index b85f7c7d8d45..656b7cf8fc75 100644 --- a/packages/server-utils/src/integrations/prisma/orchestrion.ts +++ b/packages/server-utils/src/integrations/prisma/orchestrion.ts @@ -1,14 +1,7 @@ import * as diagnosticsChannel from '../../utils/diagnosticsChannel'; import type { Span } from '@sentry/core'; -import { - getActiveSpan, - getRootSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - spanIsIgnored, - startInactiveSpan, - withActiveSpan, -} from '@sentry/core'; -import { DB_COLLECTION_NAME, DB_OPERATION_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { getActiveSpan, getRootSpan, spanIsIgnored, startInactiveSpan, withActiveSpan } from '@sentry/core'; +import { DB_COLLECTION_NAME, DB_OPERATION_NAME, SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import { prismaChannels, PRISMA_LAZY_TERMINALS } from '../../orchestrion/config/prisma'; import type { TracingChannelLifeCycleOptions } from '../../tracing-channel'; @@ -84,7 +77,7 @@ function startOperationSpan(method: string, data: PrismaTerminalChannelContext): name: OPERATION_SPAN_NAME, parentSpan, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRISMA_ORIGIN, + [SENTRY_ORIGIN]: PRISMA_ORIGIN, [SENTRY_OP]: DB, [DB_OPERATION_NAME]: method, [DB_COLLECTION_NAME]: table ?? model, diff --git a/packages/server-utils/src/integrations/prisma/tracing-helper.ts b/packages/server-utils/src/integrations/prisma/tracing-helper.ts index 0cfe6cf471d0..218e7c788134 100644 --- a/packages/server-utils/src/integrations/prisma/tracing-helper.ts +++ b/packages/server-utils/src/integrations/prisma/tracing-helper.ts @@ -20,7 +20,6 @@ import { getClient, hasSpanStreamingEnabled, LRUMap, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, startSpanManual, } from '@sentry/core'; @@ -34,6 +33,7 @@ import { DB_SYSTEM_NAME, SENTRY_KIND, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { getSqlQuerySummary, sanitizeSqlQuery, type SqlDialect, toSqlDialect } from '../../utils/sql'; @@ -98,7 +98,7 @@ function registerPrismaSpan(id: string, span: Span): void { function buildSpanAttributes(name: string, attributes: Record | undefined): SpanAttributes { const merged: SpanAttributes = { ...(attributes as SpanAttributes | undefined), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRISMA_ORIGIN, + [SENTRY_ORIGIN]: PRISMA_ORIGIN, }; // Prisma itself emits the deprecated `db.system` on older versions, so both spellings are checked diff --git a/packages/server-utils/src/integrations/redis/index.ts b/packages/server-utils/src/integrations/redis/index.ts index fb19018aa598..4140156cee57 100644 --- a/packages/server-utils/src/integrations/redis/index.ts +++ b/packages/server-utils/src/integrations/redis/index.ts @@ -8,6 +8,7 @@ import { SERVER_ADDRESS, SERVER_PORT, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB_QUERY, DB } from '@sentry/conventions/op'; import type { IntegrationFn, Span, SpanAttributes } from '@sentry/core'; @@ -15,7 +16,6 @@ import { isObjectLike, defineIntegration, getActiveSpan, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, withActiveSpan, @@ -104,7 +104,7 @@ function nodeRedisAttributes(options: NodeRedisClientOptions | undefined): SpanA [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS, [SERVER_ADDRESS]: host, ...(port != null ? { [SERVER_PORT]: port } : {}), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }; } @@ -160,7 +160,7 @@ function subscribeLegacyRedisCommand(cacheOptions: RedisCacheOptions): void { const client = data.self as LegacyRedisClient | undefined; const attributes: SpanAttributes = { [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }; if (client?.connection_options?.host != null) { diff --git a/packages/server-utils/src/integrations/redis/ioredis-channel-subscriber.ts b/packages/server-utils/src/integrations/redis/ioredis-channel-subscriber.ts index f50060a29a8e..0e91d59c03bb 100644 --- a/packages/server-utils/src/integrations/redis/ioredis-channel-subscriber.ts +++ b/packages/server-utils/src/integrations/redis/ioredis-channel-subscriber.ts @@ -7,10 +7,11 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB_QUERY, DB } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core'; import { CHANNELS } from '../../orchestrion/channels'; import { bindTracingChannelToSpan } from '../../tracing-channel'; import type { RedisCacheOptions } from './redis-cache'; @@ -50,7 +51,7 @@ function connectionAttributes(host: string | undefined, port: number | undefined [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_REDIS, ...(host != null ? { [SERVER_ADDRESS]: host } : {}), ...(port != null ? { [SERVER_PORT]: port } : {}), - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, }; } diff --git a/packages/server-utils/src/integrations/redis/redis-dc-subscriber.ts b/packages/server-utils/src/integrations/redis/redis-dc-subscriber.ts index 090b02d7272e..de092c109bd7 100644 --- a/packages/server-utils/src/integrations/redis/redis-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/redis/redis-dc-subscriber.ts @@ -7,10 +7,11 @@ import { SERVER_ADDRESS, SERVER_PORT, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB_QUERY, DB } from '@sentry/conventions/op'; import type { SpanAttributes } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../../tracing-channel'; import type { RedisCacheOptions } from './redis-cache'; import { applyCacheResponseAttributes, getRedisCacheAttributes } from './redis-cache'; @@ -148,7 +149,7 @@ function setupCommandChannel( port: data.serverPort, }); const attributes: SpanAttributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB_QUERY, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, [DB_OPERATION_NAME]: data.command, @@ -182,7 +183,7 @@ function setupBatchChannel( return startInactiveSpan({ name: operation, attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB_QUERY, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, [DB_OPERATION_NAME]: operation, @@ -201,7 +202,7 @@ function setupConnectChannel(tracingChannel: RedisTracingChannelFactory, channel return startInactiveSpan({ name: 'redis-connect', attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [SENTRY_OP]: DB, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, ...(data.serverAddress != null ? { [SERVER_ADDRESS]: data.serverAddress } : {}), diff --git a/packages/server-utils/src/integrations/tedious.ts b/packages/server-utils/src/integrations/tedious.ts index a2b3ea352791..21ff279dd13f 100644 --- a/packages/server-utils/src/integrations/tedious.ts +++ b/packages/server-utils/src/integrations/tedious.ts @@ -9,7 +9,6 @@ import { defineIntegration, getClient, hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; @@ -23,6 +22,7 @@ import { SENTRY_OP, SERVER_ADDRESS, SERVER_PORT, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; import { CHANNELS } from '../orchestrion/channels'; @@ -138,7 +138,7 @@ function subscribeQuery(channelName: string, operation: string): void { const attributes: SpanAttributes = { [SENTRY_OP]: DB, [SENTRY_KIND]: 'client', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, [DB_SYSTEM_NAME]: DB_SYSTEM_VALUE_MSSQL, [DB_NAMESPACE]: databaseName, // `>=4` uses the `authentication` object; older versions expose `userName` directly. diff --git a/packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts b/packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts index 78b4763f0240..d1b420635876 100644 --- a/packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts @@ -25,6 +25,7 @@ import { GEN_AI_USAGE_REASONING_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_EMBEDDINGS, @@ -39,7 +40,6 @@ import { captureException, getClient, isObjectLike, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, spanToJSON, spanToTraceContext, @@ -418,7 +418,7 @@ export function createSpanFromMessage( } const baseAttributes: Record = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, ...(provider ? { [GEN_AI_PROVIDER_NAME]: provider, [VERCEL_AI_MODEL_PROVIDER_ATTRIBUTE]: provider } : {}), ...(modelId ? { [GEN_AI_REQUEST_MODEL]: modelId } : {}), ...(maxRetries !== undefined ? { [VERCEL_AI_SETTINGS_MAX_RETRIES_ATTRIBUTE]: maxRetries } : {}), @@ -533,7 +533,7 @@ function buildToolSpan(event: Record, recordInputs: boolean): S const description = recordInputs && toolName ? resolveToolDescription(asString(event.callId), toolName, event.tools) : undefined; return startGenAiSpan('execute_tool', toolName, { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, + [SENTRY_ORIGIN]: ORIGIN, ...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}), ...(toolCallId ? { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: toolCallId } : {}), ...(description ? { [GEN_AI_TOOL_DESCRIPTION]: description } : {}), diff --git a/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts b/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts index 8e7c4d840d11..f2784635c5f2 100644 --- a/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts +++ b/packages/server-utils/test/ai/lib/tracing/workers-ai.test.ts @@ -12,11 +12,11 @@ import { GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, SENTRY_OP, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { getMainCarrier, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, spanToStaticSpanJSON, @@ -69,7 +69,7 @@ describe('instrumentWorkersAiClient', () => { * are on here because the `run` call is the root span in these tests, with no active parent. */ const ALWAYS_RECORDED = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', + [SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', [SENTRY_OP]: 'gen_ai.chat', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', @@ -187,7 +187,7 @@ describe('instrumentWorkersAiClient', () => { const span = spanToStaticSpanJSON(endedSpans[0]!); expect(span.description).toBe('evaluate typesafe/jev'); expect(span.data).toEqual({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', + [SENTRY_ORIGIN]: 'auto.ai.cloudflare.workers_ai', [SENTRY_OP]: 'gen_ai.evaluate', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SENTRY_SEGMENT_NAME_SOURCE]: 'custom', diff --git a/packages/server-utils/test/ai/lib/utils/workers-ai-utils.test.ts b/packages/server-utils/test/ai/lib/utils/workers-ai-utils.test.ts index 57a43b0a80ff..9976ff52706a 100644 --- a/packages/server-utils/test/ai/lib/utils/workers-ai-utils.test.ts +++ b/packages/server-utils/test/ai/lib/utils/workers-ai-utils.test.ts @@ -1,5 +1,4 @@ import { describe, expect, it } from 'vitest'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type { Span } from '@sentry/core'; import { GEN_AI_PROVIDER_NAME, @@ -21,6 +20,7 @@ import { GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, + SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../../../../src/ai/core/gen-ai-attributes'; import { WORKERS_AI_ORIGIN, WORKERS_AI_PROVIDER_NAME } from '../../../../src/ai/workers-ai/constants'; @@ -89,7 +89,7 @@ describe('workers-ai utils', () => { expect(extractRequestAttributes(MODEL, { prompt: 'Hello' }, 'chat')).toEqual({ [GEN_AI_PROVIDER_NAME]: WORKERS_AI_PROVIDER_NAME, [GEN_AI_OPERATION_NAME]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, + [SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, [GEN_AI_REQUEST_MODEL]: MODEL, }); }); @@ -113,7 +113,7 @@ describe('workers-ai utils', () => { ).toEqual({ [GEN_AI_PROVIDER_NAME]: WORKERS_AI_PROVIDER_NAME, [GEN_AI_OPERATION_NAME]: 'chat', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, + [SENTRY_ORIGIN]: WORKERS_AI_ORIGIN, [GEN_AI_REQUEST_MODEL]: MODEL, [GEN_AI_REQUEST_TEMPERATURE]: 0.5, [GEN_AI_REQUEST_MAX_TOKENS]: 100,