@@ -9,33 +9,6 @@ import {
99 transformAiSdkSpanNames ,
1010} from "../src/lib/tracing/ai-sdk-transformations" ;
1111
12- // Helper function to create a mock ReadableSpan
13- const createMockSpan = (
14- name : string ,
15- attributes : Record < string , any > = { } ,
16- ) : ReadableSpan => {
17- return {
18- name,
19- attributes,
20- instrumentationScope : { name : "ai" , version : "1.0.0" } ,
21- } as ReadableSpan ;
22- } ;
23-
24- // Helper function to create a mock span with updateName capability
25- const createMockSpanWithUpdate = (
26- name : string ,
27- attributes : Record < string , any > = { } ,
28- ) => {
29- const span = {
30- name,
31- attributes,
32- instrumentationScope : { name : "ai" , version : "1.0.0" } ,
33- updateName : ( newName : string ) => {
34- span . name = newName ;
35- } ,
36- } ;
37- return span as ReadableSpan & { updateName : ( name : string ) => void } ;
38- } ;
3912
4013describe ( "AI SDK Transformations" , ( ) => {
4114 describe ( "transformAiSdkAttributes - response text" , ( ) => {
@@ -991,7 +964,7 @@ describe("AI SDK Transformations", () => {
991964
992965 it ( "should not calculate total when input tokens are missing" , ( ) => {
993966 const attributes = {
994- [ SpanAttributes . LLM_USAGE_OUTPUT_TOKENS ] : 25 ,
967+ [ SpanAttributes . ATTR_GEN_AI_USAGE_OUTPUT_TOKENS ] : 25 ,
995968 } ;
996969
997970 transformLLMSpans ( attributes ) ;
@@ -1223,7 +1196,7 @@ describe("AI SDK Transformations", () => {
12231196 // Check token transformations - should keep input/output tokens
12241197 assert . strictEqual ( attributes [ SpanAttributes . ATTR_GEN_AI_USAGE_INPUT_TOKENS ] , 10 ) ;
12251198 assert . strictEqual ( attributes [ SpanAttributes . ATTR_GEN_AI_USAGE_OUTPUT_TOKENS ] , 5 ) ;
1226- assert . strictEqual ( attributes [ SpanAttributes . ATTR_GEN_AI_USAGE_TOTAL_TOKENS ] , 15 ) ;
1199+ assert . strictEqual ( attributes [ SpanAttributes . LLM_USAGE_TOTAL_TOKENS ] , 15 ) ;
12271200
12281201 // Check vendor transformation
12291202 assert . strictEqual ( attributes [ SpanAttributes . ATTR_GEN_AI_PROVIDER_NAME ] , "Azure" ) ;
0 commit comments