Skip to content
Open
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 @@ -254,6 +254,7 @@ Affected SDKs: All SDKs.
- 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`.
- The `gen_ai.system` span attribute was renamed to `gen_ai.provider.name` across all AI integrations.
- The `gen_ai.request.available_tools` span attribute was renamed to `gen_ai.tool.definitions` across all AI integrations.
- The `gen_ai.tool.input` span attribute was renamed to `gen_ai.tool.call.arguments` across all AI integrations.
- 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 @@ -6,9 +6,9 @@ import {
GEN_AI_OUTPUT_MESSAGES,
GEN_AI_REQUEST_MODEL,
GEN_AI_RESPONSE_MODEL,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
GEN_AI_TOOL_TYPE,
Expand Down Expand Up @@ -233,7 +233,7 @@ describe('Vercel AI integration (streaming v4)', () => {
attributes: expect.objectContaining({
[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'),
[GEN_AI_TOOL_DESCRIPTION]: attr('Get the current weather for a location'),
[GEN_AI_TOOL_INPUT]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_CALL_ARGUMENTS]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_NAME]: attr('getWeather'),
[GEN_AI_TOOL_OUTPUT]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_TYPE]: attr('function'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
GEN_AI_OUTPUT_MESSAGES,
GEN_AI_REQUEST_MODEL,
GEN_AI_RESPONSE_MODEL,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
GEN_AI_TOOL_TYPE,
Expand Down Expand Up @@ -227,7 +227,7 @@ describe('Vercel AI integration (streaming, v6)', () => {
attributes: expect.objectContaining({
[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'),
[GEN_AI_TOOL_DESCRIPTION]: attr('Get the current weather for a location'),
[GEN_AI_TOOL_INPUT]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_CALL_ARGUMENTS]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_NAME]: attr('getWeather'),
[GEN_AI_TOOL_OUTPUT]: expect.objectContaining({ value: expect.any(String) }),
[GEN_AI_TOOL_TYPE]: attr('function'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
GEN_AI_REQUEST_MODEL,
GEN_AI_RESPONSE_MODEL,
GEN_AI_SYSTEM_INSTRUCTIONS,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
GEN_AI_TOOL_TYPE,
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('Vercel AI integration (v4)', () => {
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_DESCRIPTION].value).toBe(
'Get the current weather for a location',
);
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_INPUT]).toBeDefined();
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
GEN_AI_PROVIDER_NAME,
GEN_AI_REQUEST_MODEL,
GEN_AI_RESPONSE_MODEL,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
GEN_AI_TOOL_TYPE,
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('Vercel AI integration (v5)', () => {
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_DESCRIPTION].value).toBe(
'Get the current weather for a location',
);
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_INPUT]).toBeDefined();
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
GEN_AI_RESPONSE_FINISH_REASONS,
GEN_AI_RESPONSE_MODEL,
GEN_AI_SYSTEM_INSTRUCTIONS,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
GEN_AI_TOOL_TYPE,
Expand Down Expand Up @@ -150,7 +150,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_DESCRIPTION]?.value).toBe(
'Get the current weather for a location',
);
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_INPUT]).toBeDefined();
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
},
})
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/tracing/langchain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type { Span, SpanAttributeValue } from '../../types/span';
import {
GEN_AI_OPERATION_NAME,
GEN_AI_REQUEST_MODEL,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
} from '@sentry/conventions/attributes';
Expand Down Expand Up @@ -299,7 +299,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}):
};

if (recordInputs) {
attributes[GEN_AI_TOOL_INPUT] = input;
attributes[GEN_AI_TOOL_CALL_ARGUMENTS] = input;
}

startSpanManual(
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/tracing/langgraph/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
GEN_AI_RESPONSE_MODEL,
GEN_AI_RESPONSE_TEXT,
GEN_AI_RESPONSE_TOOL_CALLS,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
GEN_AI_TOOL_TYPE,
Expand Down Expand Up @@ -106,7 +106,7 @@ export function wrapToolsWithSpans(tools: unknown[], options: LangGraphOptions,
if (options.recordInputs) {
const toolArgs = 'args' in input && typeof input.args === 'object' ? input.args : input;
try {
spanAttributes[GEN_AI_TOOL_INPUT] = JSON.stringify(toolArgs);
spanAttributes[GEN_AI_TOOL_CALL_ARGUMENTS] = JSON.stringify(toolArgs);
} catch {
// skip if not serializable
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/tracing/vercel-ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {
GEN_AI_PROVIDER_NAME,
GEN_AI_REQUEST_MODEL,
GEN_AI_RESPONSE_MODEL,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_DESCRIPTION,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
GEN_AI_TOOL_TYPE,
Expand Down Expand Up @@ -319,7 +319,7 @@ export function processVercelAiSpanAttributes(attributes: Record<string, unknown
renameAttributeKey(attributes, AI_RESPONSE_OBJECT_ATTRIBUTE, 'gen_ai.response.object');
renameAttributeKey(attributes, AI_PROMPT_TOOLS_ATTRIBUTE, GEN_AI_TOOL_DEFINITIONS);

renameAttributeKey(attributes, AI_TOOL_CALL_ARGS_ATTRIBUTE, GEN_AI_TOOL_INPUT);
renameAttributeKey(attributes, AI_TOOL_CALL_ARGS_ATTRIBUTE, GEN_AI_TOOL_CALL_ARGUMENTS);
renameAttributeKey(attributes, AI_TOOL_CALL_RESULT_ATTRIBUTE, GEN_AI_TOOL_OUTPUT);

renameAttributeKey(attributes, AI_SCHEMA_ATTRIBUTE, 'gen_ai.request.schema');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
GEN_AI_RESPONSE_MODEL,
GEN_AI_RESPONSE_STREAMING,
GEN_AI_SYSTEM_INSTRUCTIONS,
GEN_AI_TOOL_CALL_ARGUMENTS,
GEN_AI_TOOL_DEFINITIONS,
GEN_AI_TOOL_INPUT,
GEN_AI_TOOL_NAME,
GEN_AI_TOOL_OUTPUT,
GEN_AI_TOOL_TYPE,
Expand Down Expand Up @@ -486,7 +486,7 @@ function buildToolSpan(event: Record<string, unknown>, recordInputs: boolean): S
...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}),
...(toolCallId ? { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: toolCallId } : {}),
...(description ? { [GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE]: description } : {}),
...(recordInputs && toolInput !== undefined ? { [GEN_AI_TOOL_INPUT]: stringify(toolInput) } : {}),
...(recordInputs && toolInput !== undefined ? { [GEN_AI_TOOL_CALL_ARGUMENTS]: stringify(toolInput) } : {}),
});
}

Expand Down
Loading