Skip to content

Commit 04a6b37

Browse files
committed
fix
1 parent d4a565a commit 04a6b37

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/traceloop-sdk/src/lib/tracing/ai-sdk-transformations.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ const AI_USAGE_PROMPT_TOKENS = "ai.usage.promptTokens";
1414
const AI_USAGE_COMPLETION_TOKENS = "ai.usage.completionTokens";
1515
const AI_MODEL_PROVIDER = "ai.model.provider";
1616

17-
18-
1917
export const transformAiSdkSpanName = (span: ReadableSpan): void => {
20-
// Unfortunately, the span name is not writable as this is not the intended behavior
21-
// but it is a workaround to set the correct span name
18+
// Unfortunately, the span name is not writable as this is not the intended behavior
19+
// but it is a workaround to set the correct span name
20+
if (span.name in HANDLED_SPAN_NAMES) {
2221
(span as any).name = HANDLED_SPAN_NAMES[span.name];
22+
}
2323
};
2424

2525
export const transformResponseText = (
@@ -114,7 +114,7 @@ export const shouldHandleSpan = (span: ReadableSpan): boolean => {
114114
export const transformAiSdkSpan = (span: ReadableSpan): void => {
115115
if (!shouldHandleSpan(span)) {
116116
return;
117-
}
117+
}
118118
transformAiSdkSpanName(span);
119119
transformAiSdkAttributes(span.attributes);
120120
};

0 commit comments

Comments
 (0)