Skip to content

Commit 6d11e37

Browse files
nicohrubecclaude
andcommitted
ref(core)!: Rename gen_ai.system to gen_ai.provider.name
Emit the `gen_ai.provider.name` attribute from `@sentry/conventions` instead of the deprecated `gen_ai.system` alias across all AI integrations (OpenAI, Anthropic, Google GenAI, LangChain, Bedrock, Vercel AI). The OTel-based Vercel AI processor now renames the SDK-native `gen_ai.system` attribute to match. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 203efd8 commit 6d11e37

33 files changed

Lines changed: 145 additions & 149 deletions

File tree

MIGRATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ Affected SDKs: All SDKs.
252252
- `network.*` span attributes were aligned across SDKs.
253253
- Legacy messaging (`messaging.*`) and database (`db.statement`, …) span attributes on the AMQP and Redis instrumentations were replaced by their current semantic-convention equivalents.
254254
- The gen_ai cache token attributes `gen_ai.usage.cache_creation_input_tokens` and `gen_ai.usage.cache_read_input_tokens` were renamed to `gen_ai.usage.cache_creation.input_tokens` and `gen_ai.usage.cache_read.input_tokens`.
255+
- The `gen_ai.system` span attribute was renamed to `gen_ai.provider.name` across all AI integrations.
255256
- Span attributes now use the shared `@sentry/conventions` package under the hood.
256257

257258
If you reference these attributes in custom instrumentation, `beforeSendSpan`, dashboards, or alerts, update them to the new names.

dev-packages/cloudflare-integration-tests/suites/tracing/anthropic-ai/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { expect, it } from 'vitest';
22
import {
33
GEN_AI_INPUT_MESSAGES,
44
GEN_AI_OPERATION_NAME,
5+
GEN_AI_PROVIDER_NAME,
56
GEN_AI_REQUEST_MAX_TOKENS,
67
GEN_AI_REQUEST_MODEL,
78
GEN_AI_REQUEST_TEMPERATURE,
89
GEN_AI_RESPONSE_ID,
910
GEN_AI_RESPONSE_MODEL,
1011
GEN_AI_RESPONSE_TEXT,
11-
GEN_AI_SYSTEM,
1212
GEN_AI_USAGE_INPUT_TOKENS,
1313
GEN_AI_USAGE_OUTPUT_TOKENS,
1414
GEN_AI_USAGE_TOTAL_TOKENS,
@@ -42,7 +42,7 @@ it('traces a basic message creation request with the anthropic SDK', async ({ si
4242
attributes: {
4343
'sentry.origin': { value: 'auto.ai.anthropic', type: 'string' },
4444
'sentry.op': { value: 'gen_ai.chat', type: 'string' },
45-
[GEN_AI_SYSTEM]: { value: 'anthropic', type: 'string' },
45+
[GEN_AI_PROVIDER_NAME]: { value: 'anthropic', type: 'string' },
4646
[GEN_AI_OPERATION_NAME]: { value: 'chat', type: 'string' },
4747
[GEN_AI_REQUEST_MODEL]: { value: 'claude-3-haiku-20240307', type: 'string' },
4848
[GEN_AI_REQUEST_TEMPERATURE]: { value: 0.7, type: 'double' },

dev-packages/cloudflare-integration-tests/suites/tracing/google-genai/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import {
44
GEN_AI_EMBEDDINGS_INPUT,
55
GEN_AI_INPUT_MESSAGES,
66
GEN_AI_OPERATION_NAME,
7+
GEN_AI_PROVIDER_NAME,
78
GEN_AI_REQUEST_MAX_TOKENS,
89
GEN_AI_REQUEST_MODEL,
910
GEN_AI_REQUEST_TEMPERATURE,
1011
GEN_AI_REQUEST_TOP_P,
1112
GEN_AI_RESPONSE_TEXT,
12-
GEN_AI_SYSTEM,
1313
GEN_AI_USAGE_INPUT_TOKENS,
1414
GEN_AI_USAGE_OUTPUT_TOKENS,
1515
GEN_AI_USAGE_TOTAL_TOKENS,
@@ -46,7 +46,7 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({
4646
attributes: {
4747
'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' },
4848
'sentry.op': { value: 'gen_ai.chat', type: 'string' },
49-
[GEN_AI_SYSTEM]: { value: 'google_genai', type: 'string' },
49+
[GEN_AI_PROVIDER_NAME]: { value: 'google_genai', type: 'string' },
5050
[GEN_AI_OPERATION_NAME]: { value: 'chat', type: 'string' },
5151
[GEN_AI_REQUEST_MODEL]: { value: 'gemini-1.5-pro', type: 'string' },
5252
// collect LLM input and outputs (default true)
@@ -70,7 +70,7 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({
7070
attributes: {
7171
'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' },
7272
'sentry.op': { value: 'gen_ai.generate_content', type: 'string' },
73-
[GEN_AI_SYSTEM]: { value: 'google_genai', type: 'string' },
73+
[GEN_AI_PROVIDER_NAME]: { value: 'google_genai', type: 'string' },
7474
[GEN_AI_OPERATION_NAME]: { value: 'generate_content', type: 'string' },
7575
[GEN_AI_REQUEST_MODEL]: { value: 'gemini-1.5-flash', type: 'string' },
7676
[GEN_AI_REQUEST_TEMPERATURE]: { value: 0.7, type: 'double' },
@@ -99,7 +99,7 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({
9999
attributes: {
100100
'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' },
101101
'sentry.op': { value: 'gen_ai.embeddings', type: 'string' },
102-
[GEN_AI_SYSTEM]: { value: 'google_genai', type: 'string' },
102+
[GEN_AI_PROVIDER_NAME]: { value: 'google_genai', type: 'string' },
103103
[GEN_AI_OPERATION_NAME]: { value: 'embeddings', type: 'string' },
104104
[GEN_AI_REQUEST_MODEL]: { value: 'text-embedding-004', type: 'string' },
105105
[GEN_AI_EMBEDDINGS_INPUT]: { value: 'Hello world', type: 'string' },

dev-packages/cloudflare-integration-tests/suites/tracing/langchain/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { expect, it } from 'vitest';
22
import {
33
GEN_AI_OPERATION_NAME,
4+
GEN_AI_PROVIDER_NAME,
45
GEN_AI_REQUEST_MAX_TOKENS,
56
GEN_AI_REQUEST_MODEL,
67
GEN_AI_REQUEST_TEMPERATURE,
78
GEN_AI_RESPONSE_FINISH_REASONS,
89
GEN_AI_RESPONSE_ID,
910
GEN_AI_RESPONSE_MODEL,
10-
GEN_AI_SYSTEM,
1111
GEN_AI_USAGE_INPUT_TOKENS,
1212
GEN_AI_USAGE_OUTPUT_TOKENS,
1313
GEN_AI_USAGE_TOTAL_TOKENS,
@@ -42,7 +42,7 @@ it('traces a LangChain chat model invocation', async ({ signal }) => {
4242
attributes: {
4343
'sentry.origin': { value: 'auto.ai.langchain', type: 'string' },
4444
'sentry.op': { value: 'gen_ai.chat', type: 'string' },
45-
[GEN_AI_SYSTEM]: { value: 'openai', type: 'string' },
45+
[GEN_AI_PROVIDER_NAME]: { value: 'openai', type: 'string' },
4646
[GEN_AI_OPERATION_NAME]: { value: 'chat', type: 'string' },
4747
[GEN_AI_REQUEST_MODEL]: { value: 'gpt-3.5-turbo', type: 'string' },
4848
[GEN_AI_REQUEST_TEMPERATURE]: { value: 0.7, type: 'double' },

dev-packages/cloudflare-integration-tests/suites/tracing/openai/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { expect, it } from 'vitest';
22
import {
33
GEN_AI_INPUT_MESSAGES,
44
GEN_AI_OPERATION_NAME,
5+
GEN_AI_PROVIDER_NAME,
56
GEN_AI_REQUEST_MODEL,
67
GEN_AI_REQUEST_TEMPERATURE,
78
GEN_AI_RESPONSE_FINISH_REASONS,
89
GEN_AI_RESPONSE_ID,
910
GEN_AI_RESPONSE_MODEL,
10-
GEN_AI_SYSTEM,
1111
GEN_AI_SYSTEM_INSTRUCTIONS,
1212
GEN_AI_USAGE_INPUT_TOKENS,
1313
GEN_AI_USAGE_OUTPUT_TOKENS,
@@ -42,7 +42,7 @@ it('traces a basic chat completion request with the openai SDK', async ({ signal
4242
attributes: {
4343
'sentry.origin': { value: 'auto.ai.openai', type: 'string' },
4444
'sentry.op': { value: 'gen_ai.chat', type: 'string' },
45-
[GEN_AI_SYSTEM]: { value: 'openai', type: 'string' },
45+
[GEN_AI_PROVIDER_NAME]: { value: 'openai', type: 'string' },
4646
[GEN_AI_OPERATION_NAME]: { value: 'chat', type: 'string' },
4747
[GEN_AI_REQUEST_MODEL]: { value: 'gpt-3.5-turbo', type: 'string' },
4848
[GEN_AI_REQUEST_TEMPERATURE]: { value: 0.7, type: 'double' },

dev-packages/deno-integration-tests/suites/orchestrion-anthropic/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Deno.test('anthropic instrumentation: orchestrion @anthropic-ai/sdk:chat channel
5151
const aiSpan = parent.spans?.find(s => s.op === 'gen_ai.chat');
5252
assertExists(aiSpan, `expected a gen_ai.chat child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`);
5353
assertEquals(aiSpan!.description, 'chat claude-3-5-sonnet-latest');
54-
assertEquals(aiSpan!.data?.['gen_ai.system'], 'anthropic');
54+
assertEquals(aiSpan!.data?.['gen_ai.provider.name'], 'anthropic');
5555
assertEquals(aiSpan!.data?.['gen_ai.operation.name'], 'chat');
5656
assertEquals(aiSpan!.data?.['gen_ai.request.model'], 'claude-3-5-sonnet-latest');
5757
assertEquals(aiSpan!.data?.['gen_ai.response.model'], 'claude-3-5-sonnet-20241022');

dev-packages/deno-integration-tests/suites/orchestrion-google-genai/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Deno.test('google-genai instrumentation: orchestrion @google/genai:generate-cont
5353
`expected a gen_ai.generate_content child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`,
5454
);
5555
assertEquals(aiSpan!.description, 'generate_content gemini-1.5-flash');
56-
assertEquals(aiSpan!.data?.['gen_ai.system'], 'google_genai');
56+
assertEquals(aiSpan!.data?.['gen_ai.provider.name'], 'google_genai');
5757
assertEquals(aiSpan!.data?.['gen_ai.operation.name'], 'generate_content');
5858
assertEquals(aiSpan!.data?.['gen_ai.request.model'], 'gemini-1.5-flash');
5959
assertEquals(aiSpan!.data?.['gen_ai.response.model'], 'gemini-1.5-flash-002');

dev-packages/deno-integration-tests/suites/orchestrion-langchain/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Deno.test('langchain instrumentation: orchestrion @langchain/openai:embedQuery c
4848
const aiSpan = parent.spans?.find(s => s.op === 'gen_ai.embeddings');
4949
assertExists(aiSpan, `expected a gen_ai.embeddings child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`);
5050
assertEquals(aiSpan!.description, 'embeddings text-embedding-3-small');
51-
assertEquals(aiSpan!.data?.['gen_ai.system'], 'openai');
51+
assertEquals(aiSpan!.data?.['gen_ai.provider.name'], 'openai');
5252
assertEquals(aiSpan!.data?.['gen_ai.operation.name'], 'embeddings');
5353
assertEquals(aiSpan!.data?.['gen_ai.request.model'], 'text-embedding-3-small');
5454
assertEquals(aiSpan!.data?.['sentry.origin'], 'auto.ai.langchain');

dev-packages/deno-integration-tests/suites/orchestrion-openai/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Deno.test('openai instrumentation: orchestrion:openai:chat channel produces a ne
5151
const aiSpan = parent.spans?.find(s => s.op === 'gen_ai.chat');
5252
assertExists(aiSpan, `expected a gen_ai.chat child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`);
5353
assertEquals(aiSpan!.description, 'chat gpt-4o');
54-
assertEquals(aiSpan!.data?.['gen_ai.system'], 'openai');
54+
assertEquals(aiSpan!.data?.['gen_ai.provider.name'], 'openai');
5555
assertEquals(aiSpan!.data?.['gen_ai.operation.name'], 'chat');
5656
assertEquals(aiSpan!.data?.['gen_ai.request.model'], 'gpt-4o');
5757
assertEquals(aiSpan!.data?.['gen_ai.response.model'], 'gpt-4o-2024-08-06');

dev-packages/deno-integration-tests/suites/orchestrion-vercel-ai/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Deno.test('vercel-ai instrumentation: orchestrion:ai:generateText channel produc
5353
`expected a gen_ai.invoke_agent child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`,
5454
);
5555
assertEquals(aiSpan!.description, 'invoke_agent');
56-
assertEquals(aiSpan!.data?.['gen_ai.system'], 'openai');
56+
assertEquals(aiSpan!.data?.['gen_ai.provider.name'], 'openai');
5757
assertEquals(aiSpan!.data?.['gen_ai.operation.name'], 'invoke_agent');
5858
assertEquals(aiSpan!.data?.['gen_ai.request.model'], 'gpt-4o');
5959
assertEquals(aiSpan!.data?.['vercel.ai.operationId'], 'ai.generateText');

0 commit comments

Comments
 (0)