Skip to content

Commit 89a85bb

Browse files
nicohrubecclaude
andcommitted
ref(core)!: Rename gen_ai.tool.input to gen_ai.tool.call.arguments
Emit the `gen_ai.tool.call.arguments` attribute from `@sentry/conventions` instead of the deprecated `gen_ai.tool.input` alias across all AI integrations (LangChain, LangGraph, Vercel AI). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 69fd4c9 commit 89a85bb

10 files changed

Lines changed: 19 additions & 18 deletions

File tree

MIGRATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ Affected SDKs: All SDKs.
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`.
255255
- The `gen_ai.system` span attribute was renamed to `gen_ai.provider.name` across all AI integrations.
256256
- The `gen_ai.request.available_tools` span attribute was renamed to `gen_ai.tool.definitions` across all AI integrations.
257+
- The `gen_ai.tool.input` span attribute was renamed to `gen_ai.tool.call.arguments` across all AI integrations.
257258
- Span attributes now use the shared `@sentry/conventions` package under the hood.
258259

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

dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
GEN_AI_OUTPUT_MESSAGES,
77
GEN_AI_REQUEST_MODEL,
88
GEN_AI_RESPONSE_MODEL,
9+
GEN_AI_TOOL_CALL_ARGUMENTS,
910
GEN_AI_TOOL_DEFINITIONS,
1011
GEN_AI_TOOL_DESCRIPTION,
11-
GEN_AI_TOOL_INPUT,
1212
GEN_AI_TOOL_NAME,
1313
GEN_AI_TOOL_OUTPUT,
1414
GEN_AI_TOOL_TYPE,
@@ -233,7 +233,7 @@ describe('Vercel AI integration (streaming v4)', () => {
233233
attributes: expect.objectContaining({
234234
[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'),
235235
[GEN_AI_TOOL_DESCRIPTION]: attr('Get the current weather for a location'),
236-
[GEN_AI_TOOL_INPUT]: expect.objectContaining({ value: expect.any(String) }),
236+
[GEN_AI_TOOL_CALL_ARGUMENTS]: expect.objectContaining({ value: expect.any(String) }),
237237
[GEN_AI_TOOL_NAME]: attr('getWeather'),
238238
[GEN_AI_TOOL_OUTPUT]: expect.objectContaining({ value: expect.any(String) }),
239239
[GEN_AI_TOOL_TYPE]: attr('function'),

dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
GEN_AI_OUTPUT_MESSAGES,
77
GEN_AI_REQUEST_MODEL,
88
GEN_AI_RESPONSE_MODEL,
9+
GEN_AI_TOOL_CALL_ARGUMENTS,
910
GEN_AI_TOOL_DEFINITIONS,
1011
GEN_AI_TOOL_DESCRIPTION,
11-
GEN_AI_TOOL_INPUT,
1212
GEN_AI_TOOL_NAME,
1313
GEN_AI_TOOL_OUTPUT,
1414
GEN_AI_TOOL_TYPE,
@@ -227,7 +227,7 @@ describe('Vercel AI integration (streaming, v6)', () => {
227227
attributes: expect.objectContaining({
228228
[GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: attr('call-1'),
229229
[GEN_AI_TOOL_DESCRIPTION]: attr('Get the current weather for a location'),
230-
[GEN_AI_TOOL_INPUT]: expect.objectContaining({ value: expect.any(String) }),
230+
[GEN_AI_TOOL_CALL_ARGUMENTS]: expect.objectContaining({ value: expect.any(String) }),
231231
[GEN_AI_TOOL_NAME]: attr('getWeather'),
232232
[GEN_AI_TOOL_OUTPUT]: expect.objectContaining({ value: expect.any(String) }),
233233
[GEN_AI_TOOL_TYPE]: attr('function'),

dev-packages/node-integration-tests/suites/tracing/vercelai/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
GEN_AI_REQUEST_MODEL,
1010
GEN_AI_RESPONSE_MODEL,
1111
GEN_AI_SYSTEM_INSTRUCTIONS,
12+
GEN_AI_TOOL_CALL_ARGUMENTS,
1213
GEN_AI_TOOL_DEFINITIONS,
1314
GEN_AI_TOOL_DESCRIPTION,
14-
GEN_AI_TOOL_INPUT,
1515
GEN_AI_TOOL_NAME,
1616
GEN_AI_TOOL_OUTPUT,
1717
GEN_AI_TOOL_TYPE,
@@ -241,7 +241,7 @@ describe('Vercel AI integration (v4)', () => {
241241
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_DESCRIPTION].value).toBe(
242242
'Get the current weather for a location',
243243
);
244-
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_INPUT]).toBeDefined();
244+
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
245245
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
246246
},
247247
})

dev-packages/node-integration-tests/suites/tracing/vercelai/v5/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
GEN_AI_PROVIDER_NAME,
77
GEN_AI_REQUEST_MODEL,
88
GEN_AI_RESPONSE_MODEL,
9+
GEN_AI_TOOL_CALL_ARGUMENTS,
910
GEN_AI_TOOL_DEFINITIONS,
1011
GEN_AI_TOOL_DESCRIPTION,
11-
GEN_AI_TOOL_INPUT,
1212
GEN_AI_TOOL_NAME,
1313
GEN_AI_TOOL_OUTPUT,
1414
GEN_AI_TOOL_TYPE,
@@ -247,7 +247,7 @@ describe('Vercel AI integration (v5)', () => {
247247
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_DESCRIPTION].value).toBe(
248248
'Get the current weather for a location',
249249
);
250-
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_INPUT]).toBeDefined();
250+
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
251251
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
252252
},
253253
})

dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import {
1010
GEN_AI_RESPONSE_FINISH_REASONS,
1111
GEN_AI_RESPONSE_MODEL,
1212
GEN_AI_SYSTEM_INSTRUCTIONS,
13+
GEN_AI_TOOL_CALL_ARGUMENTS,
1314
GEN_AI_TOOL_DEFINITIONS,
1415
GEN_AI_TOOL_DESCRIPTION,
15-
GEN_AI_TOOL_INPUT,
1616
GEN_AI_TOOL_NAME,
1717
GEN_AI_TOOL_OUTPUT,
1818
GEN_AI_TOOL_TYPE,
@@ -150,7 +150,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe
150150
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_DESCRIPTION]?.value).toBe(
151151
'Get the current weather for a location',
152152
);
153-
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_INPUT]).toBeDefined();
153+
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
154154
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
155155
},
156156
})

packages/core/src/tracing/langchain/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import type { Span, SpanAttributeValue } from '../../types/span';
88
import {
99
GEN_AI_OPERATION_NAME,
1010
GEN_AI_REQUEST_MODEL,
11+
GEN_AI_TOOL_CALL_ARGUMENTS,
1112
GEN_AI_TOOL_DEFINITIONS,
12-
GEN_AI_TOOL_INPUT,
1313
GEN_AI_TOOL_NAME,
1414
GEN_AI_TOOL_OUTPUT,
1515
} from '@sentry/conventions/attributes';
@@ -299,7 +299,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}):
299299
};
300300

301301
if (recordInputs) {
302-
attributes[GEN_AI_TOOL_INPUT] = input;
302+
attributes[GEN_AI_TOOL_CALL_ARGUMENTS] = input;
303303
}
304304

305305
startSpanManual(

packages/core/src/tracing/langgraph/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
GEN_AI_RESPONSE_MODEL,
1111
GEN_AI_RESPONSE_TEXT,
1212
GEN_AI_RESPONSE_TOOL_CALLS,
13+
GEN_AI_TOOL_CALL_ARGUMENTS,
1314
GEN_AI_TOOL_DESCRIPTION,
14-
GEN_AI_TOOL_INPUT,
1515
GEN_AI_TOOL_NAME,
1616
GEN_AI_TOOL_OUTPUT,
1717
GEN_AI_TOOL_TYPE,
@@ -106,7 +106,7 @@ export function wrapToolsWithSpans(tools: unknown[], options: LangGraphOptions,
106106
if (options.recordInputs) {
107107
const toolArgs = 'args' in input && typeof input.args === 'object' ? input.args : input;
108108
try {
109-
spanAttributes[GEN_AI_TOOL_INPUT] = JSON.stringify(toolArgs);
109+
spanAttributes[GEN_AI_TOOL_CALL_ARGUMENTS] = JSON.stringify(toolArgs);
110110
} catch {
111111
// skip if not serializable
112112
}

packages/core/src/tracing/vercel-ai/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import {
1818
GEN_AI_PROVIDER_NAME,
1919
GEN_AI_REQUEST_MODEL,
2020
GEN_AI_RESPONSE_MODEL,
21+
GEN_AI_TOOL_CALL_ARGUMENTS,
2122
GEN_AI_TOOL_DEFINITIONS,
2223
GEN_AI_TOOL_DESCRIPTION,
23-
GEN_AI_TOOL_INPUT,
2424
GEN_AI_TOOL_NAME,
2525
GEN_AI_TOOL_OUTPUT,
2626
GEN_AI_TOOL_TYPE,
@@ -319,7 +319,7 @@ export function processVercelAiSpanAttributes(attributes: Record<string, unknown
319319
renameAttributeKey(attributes, AI_RESPONSE_OBJECT_ATTRIBUTE, 'gen_ai.response.object');
320320
renameAttributeKey(attributes, AI_PROMPT_TOOLS_ATTRIBUTE, GEN_AI_TOOL_DEFINITIONS);
321321

322-
renameAttributeKey(attributes, AI_TOOL_CALL_ARGS_ATTRIBUTE, GEN_AI_TOOL_INPUT);
322+
renameAttributeKey(attributes, AI_TOOL_CALL_ARGS_ATTRIBUTE, GEN_AI_TOOL_CALL_ARGUMENTS);
323323
renameAttributeKey(attributes, AI_TOOL_CALL_RESULT_ATTRIBUTE, GEN_AI_TOOL_OUTPUT);
324324

325325
renameAttributeKey(attributes, AI_SCHEMA_ATTRIBUTE, 'gen_ai.request.schema');

packages/server-utils/src/vercel-ai/vercel-ai-dc-subscriber.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import {
1313
GEN_AI_RESPONSE_MODEL,
1414
GEN_AI_RESPONSE_STREAMING,
1515
GEN_AI_SYSTEM_INSTRUCTIONS,
16+
GEN_AI_TOOL_CALL_ARGUMENTS,
1617
GEN_AI_TOOL_DEFINITIONS,
17-
GEN_AI_TOOL_INPUT,
1818
GEN_AI_TOOL_NAME,
1919
GEN_AI_TOOL_OUTPUT,
2020
GEN_AI_TOOL_TYPE,
@@ -486,7 +486,7 @@ function buildToolSpan(event: Record<string, unknown>, recordInputs: boolean): S
486486
...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}),
487487
...(toolCallId ? { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: toolCallId } : {}),
488488
...(description ? { [GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE]: description } : {}),
489-
...(recordInputs && toolInput !== undefined ? { [GEN_AI_TOOL_INPUT]: stringify(toolInput) } : {}),
489+
...(recordInputs && toolInput !== undefined ? { [GEN_AI_TOOL_CALL_ARGUMENTS]: stringify(toolInput) } : {}),
490490
});
491491
}
492492

0 commit comments

Comments
 (0)