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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott

- **ref(core): Unify .do\* span ops to `gen_ai.generate_content` ([#20074](https://github.com/getsentry/sentry-javascript/pull/20074))**

All Vercel AI `do*` spans (`ai.generateText.doGenerate`, `ai.streamText.doStream`, `ai.generateObject.doGenerate`, `ai.streamObject.doStream`) now use a single unified span op `gen_ai.generate_content` instead of separate ops like `gen_ai.generate_text`, `gen_ai.stream_text`, `gen_ai.generate_object`, and `gen_ai.stream_object`.

- **ref(core): Remove provider-specific AI span attributes in favor of `gen_ai` attributes in sentry conventions ([#20011](https://github.com/getsentry/sentry-javascript/pull/20011))**

The following provider-specific span attributes have been removed from the OpenAI and Anthropic AI integrations. Use the standardized `gen_ai.*` equivalents instead:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('should create AI pipeline spans with Vercel AI SDK', async ({ baseURL }) =
const aiSpans = spans.filter(
(span: any) =>
span.op === 'gen_ai.invoke_agent' ||
span.op === 'gen_ai.generate_text' ||
span.op === 'gen_ai.generate_content' ||
span.op === 'otel.span' ||
span.description?.includes('ai.generateText'),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('should create AI spans with correct attributes and error linking', async (
// because of this, only spans that are manually opted-in at call time will be captured
// this may be fixed by https://github.com/vercel/ai/pull/6716 in the future
const aiPipelineSpans = spans.filter(span => span.op === 'gen_ai.invoke_agent');
const aiGenerateSpans = spans.filter(span => span.op === 'gen_ai.generate_text');
const aiGenerateSpans = spans.filter(span => span.op === 'gen_ai.generate_content');
const toolCallSpans = spans.filter(span => span.op === 'gen_ai.execute_tool');

expect(aiPipelineSpans.length).toBeGreaterThanOrEqual(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('should create AI spans with correct attributes', async ({ page }) => {
// because of this, only spans that are manually opted-in at call time will be captured
// this may be fixed by https://github.com/vercel/ai/pull/6716 in the future
const aiPipelineSpans = spans.filter(span => span.op === 'gen_ai.invoke_agent');
const aiGenerateSpans = spans.filter(span => span.op === 'gen_ai.generate_text');
const aiGenerateSpans = spans.filter(span => span.op === 'gen_ai.generate_content');
const toolCallSpans = spans.filter(span => span.op === 'gen_ai.execute_tool');

expect(aiPipelineSpans.length).toBeGreaterThanOrEqual(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('should create AI spans with correct attributes and error linking', async (
// because of this, only spans that are manually opted-in at call time will be captured
// this may be fixed by https://github.com/vercel/ai/pull/6716 in the future
const aiPipelineSpans = spans.filter(span => span.op === 'gen_ai.invoke_agent');
const aiGenerateSpans = spans.filter(span => span.op === 'gen_ai.generate_text');
const aiGenerateSpans = spans.filter(span => span.op === 'gen_ai.generate_content');
const toolCallSpans = spans.filter(span => span.op === 'gen_ai.execute_tool');

expect(aiPipelineSpans.length).toBeGreaterThanOrEqual(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('should create AI spans with correct attributes', async ({ page }) => {
// because of this, only spans that are manually opted-in at call time will be captured
// this may be fixed by https://github.com/vercel/ai/pull/6716 in the future
const aiPipelineSpans = spans.filter(span => span.op === 'gen_ai.invoke_agent');
const aiGenerateSpans = spans.filter(span => span.op === 'gen_ai.generate_text');
const aiGenerateSpans = spans.filter(span => span.op === 'gen_ai.generate_content');
const toolCallSpans = spans.filter(span => span.op === 'gen_ai.execute_tool');

expect(aiPipelineSpans.length).toBeGreaterThanOrEqual(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Vercel AI integration - generateObject', () => {
expect.objectContaining({
data: expect.objectContaining({
'sentry.origin': 'auto.vercelai.otel',
'sentry.op': 'gen_ai.generate_object',
'sentry.op': 'gen_ai.generate_content',
'gen_ai.operation.name': 'generate_content',
'vercel.ai.operationId': 'ai.generateObject.doGenerate',
'vercel.ai.model.provider': 'mock-provider',
Expand All @@ -52,7 +52,7 @@ describe('Vercel AI integration - generateObject', () => {
'gen_ai.usage.total_tokens': 40,
}),
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_object',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down
38 changes: 19 additions & 19 deletions dev-packages/node-integration-tests/suites/tracing/vercelai/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('Vercel AI integration', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 20,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 30,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
'vercel.ai.model.provider': 'mock-provider',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
Expand All @@ -83,7 +83,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.streaming': false,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('Vercel AI integration', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 20,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 30,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
'vercel.ai.model.provider': 'mock-provider',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
Expand All @@ -146,7 +146,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.streaming': false,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('Vercel AI integration', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 25,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 40,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
'vercel.ai.model.provider': 'mock-provider',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
Expand All @@ -199,7 +199,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.streaming': false,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('Vercel AI integration', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 20,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 30,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
'vercel.ai.model.provider': 'mock-provider',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
Expand All @@ -294,7 +294,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.streaming': false,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
parent_span_id: expect.any(String),
Expand Down Expand Up @@ -353,7 +353,7 @@ describe('Vercel AI integration', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 20,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 30,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
'vercel.ai.model.provider': 'mock-provider',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
Expand All @@ -367,7 +367,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.streaming': false,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
parent_span_id: expect.any(String),
Expand Down Expand Up @@ -427,7 +427,7 @@ describe('Vercel AI integration', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 25,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 40,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
'vercel.ai.model.provider': 'mock-provider',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
Expand All @@ -442,7 +442,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.streaming': false,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
parent_span_id: expect.any(String),
Expand Down Expand Up @@ -528,7 +528,7 @@ describe('Vercel AI integration', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 25,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 40,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
'vercel.ai.model.provider': 'mock-provider',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
Expand All @@ -541,7 +541,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.streaming': false,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -648,7 +648,7 @@ describe('Vercel AI integration', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 25,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 40,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
'vercel.ai.model.provider': 'mock-provider',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
Expand All @@ -661,7 +661,7 @@ describe('Vercel AI integration', () => {
'vercel.ai.streaming': false,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -757,11 +757,11 @@ describe('Vercel AI integration', () => {
// The doGenerate span - name stays as 'generateText.doGenerate' since model ID is missing
expect.objectContaining({
description: 'generateText.doGenerate',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
data: expect.objectContaining({
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
}),
Expand Down Expand Up @@ -938,7 +938,7 @@ describe('Vercel AI integration', () => {
}),
}),
expect.objectContaining({
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
data: expect.objectContaining({
'gen_ai.conversation.id': 'conv-a',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Vercel AI integration (V5)', () => {
expect.objectContaining({
data: {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
'vercel.ai.model.provider': 'mock-provider',
Expand All @@ -80,7 +80,7 @@ describe('Vercel AI integration (V5)', () => {
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 30,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('Vercel AI integration (V5)', () => {
expect.objectContaining({
data: {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
'vercel.ai.model.provider': 'mock-provider',
Expand All @@ -141,7 +141,7 @@ describe('Vercel AI integration (V5)', () => {
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 30,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -189,11 +189,11 @@ describe('Vercel AI integration (V5)', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 25,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 40,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -277,11 +277,11 @@ describe('Vercel AI integration (V5)', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 20,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 30,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -317,7 +317,7 @@ describe('Vercel AI integration (V5)', () => {
expect.objectContaining({
data: {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
'vercel.ai.operationId': 'ai.generateText.doGenerate',
'vercel.ai.model.provider': 'mock-provider',
Expand All @@ -342,7 +342,7 @@ describe('Vercel AI integration (V5)', () => {
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 30,
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -401,11 +401,11 @@ describe('Vercel AI integration (V5)', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 25,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 40,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
}),
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down Expand Up @@ -513,11 +513,11 @@ describe('Vercel AI integration (V5)', () => {
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: 25,
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: 40,
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: 'generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_text',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'gen_ai.generate_content',
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.vercelai.otel',
},
description: 'generate_content mock-model-id',
op: 'gen_ai.generate_text',
op: 'gen_ai.generate_content',
origin: 'auto.vercelai.otel',
status: 'ok',
}),
Expand Down
Loading
Loading