Skip to content
Draft
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
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ Affected SDKs: All SDKs.
- The `gen_ai.tool.input` span attribute was renamed to `gen_ai.tool.call.arguments` across all AI integrations.
- The `gen_ai.tool.output` span attribute was renamed to `gen_ai.tool.call.result` across all AI integrations.
- The Vercel AI token attributes `gen_ai.usage.input_tokens.cached`, `gen_ai.usage.input_tokens.cache_write`, and `gen_ai.usage.output_tokens.reasoning` were renamed to `gen_ai.usage.cache_read.input_tokens`, `gen_ai.usage.cache_creation.input_tokens`, and `gen_ai.usage.reasoning.output_tokens`.
- The deprecated `gen_ai.tool.type` span attribute is no longer set on tool spans.
- Span attributes now use the shared `@sentry/conventions` package under the hood.

If you reference these attributes in custom instrumentation, `beforeSendSpan`, dashboards, or alerts, update them to the new names.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ describe('LangGraph integration', () => {
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.execute_tool' }),
[GEN_AI_OPERATION_NAME]: expect.objectContaining({ value: 'execute_tool' }),
[GEN_AI_TOOL_NAME]: expect.objectContaining({ value: 'add' }),
'gen_ai.tool.type': expect.objectContaining({ value: 'function' }),
}),
}),
);
Expand All @@ -445,7 +444,6 @@ describe('LangGraph integration', () => {
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: expect.objectContaining({ value: 'gen_ai.execute_tool' }),
[GEN_AI_OPERATION_NAME]: expect.objectContaining({ value: 'execute_tool' }),
[GEN_AI_TOOL_NAME]: expect.objectContaining({ value: 'multiply' }),
'gen_ai.tool.type': expect.objectContaining({ value: 'function' }),
}),
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_TYPE,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
Expand Down Expand Up @@ -124,7 +123,6 @@ describe('Vercel AI integration (streaming v4)', () => {
attributes: expect.objectContaining({
[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'),
[GEN_AI_TOOL_NAME]: attr('getWeather'),
[GEN_AI_TOOL_TYPE]: attr('function'),
[GEN_AI_OPERATION_NAME]: attr('execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin),
Expand Down Expand Up @@ -236,7 +234,6 @@ describe('Vercel AI integration (streaming v4)', () => {
[GEN_AI_TOOL_CALL_ARGUMENTS]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_NAME]: attr('getWeather'),
[GEN_AI_TOOL_CALL_RESULT]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_TYPE]: attr('function'),
[GEN_AI_OPERATION_NAME]: attr('execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin),
Expand Down Expand Up @@ -275,7 +272,6 @@ describe('Vercel AI integration (streaming v4)', () => {
attributes: expect.objectContaining({
[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'),
[GEN_AI_TOOL_NAME]: attr('getWeather'),
[GEN_AI_TOOL_TYPE]: attr('function'),
[GEN_AI_OPERATION_NAME]: attr('execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(expectedOrigin),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_TYPE,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
Expand Down Expand Up @@ -118,7 +117,6 @@ describe('Vercel AI integration (streaming, v6)', () => {
attributes: expect.objectContaining({
[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'),
[GEN_AI_TOOL_NAME]: attr('getWeather'),
[GEN_AI_TOOL_TYPE]: attr('function'),
[GEN_AI_OPERATION_NAME]: attr('execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin),
Expand Down Expand Up @@ -230,7 +228,6 @@ describe('Vercel AI integration (streaming, v6)', () => {
[GEN_AI_TOOL_CALL_ARGUMENTS]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_NAME]: attr('getWeather'),
[GEN_AI_TOOL_CALL_RESULT]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_TYPE]: attr('function'),
[GEN_AI_OPERATION_NAME]: attr('execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin),
Expand Down Expand Up @@ -268,7 +265,6 @@ describe('Vercel AI integration (streaming, v6)', () => {
attributes: expect.objectContaining({
[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'),
[GEN_AI_TOOL_NAME]: attr('getWeather'),
[GEN_AI_TOOL_TYPE]: attr('function'),
[GEN_AI_OPERATION_NAME]: attr('execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'),
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: attr(origin),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_TYPE,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
Expand Down Expand Up @@ -133,7 +132,6 @@ describe('Vercel AI integration (v4)', () => {
expect(toolExecutionSpan!.attributes['sentry.op'].value).toBe('gen_ai.execute_tool');
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_NAME].value).toBe('getWeather');
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ID_ATTRIBUTE].value).toBe('call-1');
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_TYPE].value).toBe('function');
},
})
.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_TYPE,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
Expand Down Expand Up @@ -129,7 +128,6 @@ describe('Vercel AI integration (v5)', () => {
expect(toolExecutionSpan!.attributes['sentry.origin'].value).toBe(expectedOrigin);
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_NAME].value).toBe('getWeather');
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ID_ATTRIBUTE].value).toBe('call-1');
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_TYPE].value).toBe('function');
},
})
.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_TYPE,
GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
Expand Down Expand Up @@ -277,7 +276,6 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe
expect(toolExecutionSpan.attributes['sentry.op']?.value).toBe('gen_ai.execute_tool');
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_NAME]?.value).toBe('getWeather');
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]?.value).toBe('call-1');
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_TYPE]?.value).toBe('function');
},
})
.start()
Expand Down Expand Up @@ -444,7 +442,6 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe
expect(toolSpan.attributes['sentry.op']?.value).toBe('gen_ai.execute_tool');
expect(toolSpan.attributes[GEN_AI_TOOL_NAME]?.value).toBe('getWeather');
expect(toolSpan.attributes[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]?.value).toBe('call-1');
expect(toolSpan.attributes[GEN_AI_TOOL_TYPE]?.value).toBe('function');

const finalGenerateContentSpan = container.items.find(
span => span.attributes[GEN_AI_RESPONSE_FINISH_REASONS]?.value === '["stop"]',
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/tracing/langgraph/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
GEN_AI_TOOL_CALL_RESULT,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_TYPE,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
Expand Down Expand Up @@ -81,7 +80,6 @@ export function wrapToolsWithSpans(tools: unknown[], options: LangGraphOptions,
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: GEN_AI_EXECUTE_TOOL_OPERATION_ATTRIBUTE,
[GEN_AI_OPERATION_NAME]: 'execute_tool',
[GEN_AI_TOOL_NAME]: toolName,
[GEN_AI_TOOL_TYPE]: 'function',
};

// Read agent name from LangChain's propagated config metadata at call time,
Expand Down
6 changes: 0 additions & 6 deletions packages/core/src/tracing/vercel-ai/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable typescript-eslint/no-deprecated */
/* eslint-disable max-lines */
import type { Client } from '../../client';
import { getClient } from '../../currentScopes';
Expand All @@ -23,7 +22,6 @@ import {
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_TYPE,
GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS,
GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS,
GEN_AI_USAGE_INPUT_TOKENS,
Expand Down Expand Up @@ -427,10 +425,6 @@ function processToolCallSpan(span: Span, attributes: SpanAttributes): void {
toolCallSpanContextMap.set(toolCallId, span.spanContext());
}

// https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-tool-type
if (!attributes[GEN_AI_TOOL_TYPE]) {
span.setAttribute(GEN_AI_TOOL_TYPE, 'function');
}
const toolName = attributes[GEN_AI_TOOL_NAME];
if (toolName) {
span.updateName(`execute_tool ${toolName}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable max-lines */
/* eslint-disable typescript-eslint/no-deprecated */
import {
GEN_AI_EMBEDDINGS_INPUT,
GEN_AI_FUNCTION_ID,
Expand All @@ -17,7 +16,6 @@ import {
GEN_AI_TOOL_CALL_RESULT,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_TYPE,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
Expand Down Expand Up @@ -482,7 +480,6 @@ function buildToolSpan(event: Record<string, unknown>, recordInputs: boolean): S
recordInputs && toolName ? resolveToolDescription(asString(event.callId), toolName, event.tools) : undefined;
return startGenAiSpan(GEN_AI_EXECUTE_TOOL_SPAN_OP, toolName, {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
[GEN_AI_TOOL_TYPE]: 'function',
...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}),
...(toolCallId ? { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: toolCallId } : {}),
...(description ? { [GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE]: description } : {}),
Expand Down
Loading