Skip to content

Commit caa6430

Browse files
committed
fixup! fixup! fixup! fixup! fix(tracing): Add missing attributes in vercel-ai spans (#18333)
1 parent 71b949b commit caa6430

File tree

1 file changed

+3
-0
lines changed
  • packages/core/src/tracing/vercel-ai

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
GEN_AI_REQUEST_MESSAGES_ATTRIBUTE,
88
GEN_AI_USAGE_INPUT_TOKENS_CACHE_WRITE_ATTRIBUTE,
99
GEN_AI_USAGE_INPUT_TOKENS_CACHED_ATTRIBUTE,
10+
GEN_AI_OPERATION_NAME_ATTRIBUTE,
1011
} from '../ai/gen-ai-attributes';
1112
import { toolCallSpanMap } from './constants';
1213
import type { TokenSummary } from './types';
@@ -19,6 +20,7 @@ import {
1920
import type { ProviderMetadata } from './vercel-ai-attributes';
2021
import {
2122
AI_MODEL_ID_ATTRIBUTE,
23+
OPERATION_NAME_ATTRIBUTE,
2224
AI_MODEL_PROVIDER_ATTRIBUTE,
2325
AI_PROMPT_MESSAGES_ATTRIBUTE,
2426
AI_PROMPT_TOOLS_ATTRIBUTE,
@@ -136,6 +138,7 @@ function processEndedVercelAiSpan(span: SpanJSON): void {
136138
}
137139

138140
// Rename AI SDK attributes to standardized gen_ai attributes
141+
renameAttributeKey(attributes, OPERATION_NAME_ATTRIBUTE, GEN_AI_OPERATION_NAME_ATTRIBUTE);
139142
renameAttributeKey(attributes, AI_PROMPT_MESSAGES_ATTRIBUTE, GEN_AI_REQUEST_MESSAGES_ATTRIBUTE);
140143
renameAttributeKey(attributes, AI_RESPONSE_TEXT_ATTRIBUTE, 'gen_ai.response.text');
141144
renameAttributeKey(attributes, AI_RESPONSE_TOOL_CALLS_ATTRIBUTE, 'gen_ai.response.tool_calls');

0 commit comments

Comments
 (0)