Skip to content

Commit 4b9fa48

Browse files
committed
fix(core): Remove name.split('.') Check and Always Respect experimental_telemetry.functionId for Vercel AI gen spans
1 parent 0e19673 commit 4b9fa48

File tree

1 file changed

+3
-2
lines changed
  • packages/core/src/utils/vercel-ai

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,10 @@ function processGenerateSpan(span: Span, name: string, attributes: SpanAttribute
178178
span.setAttribute('ai.pipeline.name', nameWthoutAi);
179179
span.updateName(nameWthoutAi);
180180

181-
// If a Telemetry name is set and it is a pipeline span, use that as the operation name
181+
// If a telemetry name is set and the span represents a pipeline, use it as the operation name.
182+
// This name can be set at the request level by adding `experimental_telemetry.functionId`.
182183
const functionId = attributes[AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE];
183-
if (functionId && typeof functionId === 'string' && name.split('.').length - 1 === 1) {
184+
if (functionId && typeof functionId === 'string') {
184185
span.updateName(`${nameWthoutAi} ${functionId}`);
185186
span.setAttribute('gen_ai.function_id', functionId);
186187
}

0 commit comments

Comments
 (0)