Skip to content

Commit ecd8bab

Browse files
committed
Stabilize span origin e2e snapshots
1 parent b3576c0 commit ecd8bab

3 files changed

Lines changed: 66 additions & 7 deletions

File tree

e2e/helpers/normalize.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ function normalizeObject(
283283
return [[key, tokenFor(tokenMaps.ids, entry, "signature")]];
284284
}
285285

286+
if (
287+
key === "environment" &&
288+
entry &&
289+
typeof entry === "object" &&
290+
!Array.isArray(entry) &&
291+
"type" in entry
292+
) {
293+
return [];
294+
}
295+
286296
return [[key, normalizeValue(entry as Json, tokenMaps, options, key)]];
287297
}),
288298
);

e2e/scenarios/trace-context-and-continuation/__snapshots__/late-update-payloads.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
"context": {
44
"caller_filename": "<repo>/e2e/scenarios/trace-context-and-continuation/scenario.ts",
55
"caller_functionname": "main",
6-
"caller_lineno": 0
6+
"caller_lineno": 0,
7+
"span_origin": {
8+
"instrumentation": {
9+
"name": "braintrust-js-logger"
10+
},
11+
"name": "braintrust.sdk.javascript",
12+
"version": "<xact:1>"
13+
}
714
},
815
"created": "<timestamp>",
916
"id": "<span:1>",

e2e/scenarios/trace-primitives-basic/__snapshots__/request-flow.json

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@
3838
"context": {
3939
"caller_filename": "<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts",
4040
"caller_functionname": "main",
41-
"caller_lineno": 0
41+
"caller_lineno": 0,
42+
"span_origin": {
43+
"instrumentation": {
44+
"name": "braintrust-js-logger"
45+
},
46+
"name": "braintrust.sdk.javascript",
47+
"version": "<xact:1>"
48+
}
4249
},
4350
"created": "<timestamp>",
4451
"id": "<span:2>",
@@ -71,7 +78,14 @@
7178
"context": {
7279
"caller_filename": "<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts",
7380
"caller_functionname": "logger.traced.name",
74-
"caller_lineno": 0
81+
"caller_lineno": 0,
82+
"span_origin": {
83+
"instrumentation": {
84+
"name": "braintrust-js-logger"
85+
},
86+
"name": "braintrust.sdk.javascript",
87+
"version": "<xact:1>"
88+
}
7589
},
7690
"created": "<timestamp>",
7791
"id": "<span:6>",
@@ -106,7 +120,14 @@
106120
"context": {
107121
"caller_filename": "<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts",
108122
"caller_functionname": "logger.traced.name",
109-
"caller_lineno": 0
123+
"caller_lineno": 0,
124+
"span_origin": {
125+
"instrumentation": {
126+
"name": "braintrust-js-logger"
127+
},
128+
"name": "braintrust.sdk.javascript",
129+
"version": "<xact:1>"
130+
}
110131
},
111132
"created": "<timestamp>",
112133
"error": "basic boom\n\nError: basic boom\n at logger.traced.name (<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts:0:0)\n at <repo>/js/dist/index.mjs:0:0\n at AsyncLocalStorage.run (node:<internal>:0:0)\n at BraintrustContextManager.runInContext (<repo>/js/dist/index.mjs:0:0)\n at withCurrent (<repo>/js/dist/index.mjs:0:0)\n at <repo>/js/dist/index.mjs:0:0\n at runCatchFinally (<repo>/js/dist/index.mjs:0:0)\n at Logger.traced (<repo>/js/dist/index.mjs:0:0)\n at main (<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts:0:0)\n at runMain (<repo>/e2e/helpers/scenario-runtime.ts:0:0)",
@@ -143,7 +164,14 @@
143164
"context": {
144165
"caller_filename": "<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts",
145166
"caller_functionname": "main",
146-
"caller_lineno": 0
167+
"caller_lineno": 0,
168+
"span_origin": {
169+
"instrumentation": {
170+
"name": "braintrust-js-logger"
171+
},
172+
"name": "braintrust.sdk.javascript",
173+
"version": "<xact:1>"
174+
}
147175
},
148176
"created": "<timestamp>",
149177
"id": "<span:2>",
@@ -176,7 +204,14 @@
176204
"context": {
177205
"caller_filename": "<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts",
178206
"caller_functionname": "logger.traced.name",
179-
"caller_lineno": 0
207+
"caller_lineno": 0,
208+
"span_origin": {
209+
"instrumentation": {
210+
"name": "braintrust-js-logger"
211+
},
212+
"name": "braintrust.sdk.javascript",
213+
"version": "<xact:1>"
214+
}
180215
},
181216
"created": "<timestamp>",
182217
"id": "<span:6>",
@@ -211,7 +246,14 @@
211246
"context": {
212247
"caller_filename": "<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts",
213248
"caller_functionname": "logger.traced.name",
214-
"caller_lineno": 0
249+
"caller_lineno": 0,
250+
"span_origin": {
251+
"instrumentation": {
252+
"name": "braintrust-js-logger"
253+
},
254+
"name": "braintrust.sdk.javascript",
255+
"version": "<xact:1>"
256+
}
215257
},
216258
"created": "<timestamp>",
217259
"error": "basic boom\n\nError: basic boom\n at logger.traced.name (<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts:0:0)\n at <repo>/js/dist/index.mjs:0:0\n at AsyncLocalStorage.run (node:<internal>:0:0)\n at BraintrustContextManager.runInContext (<repo>/js/dist/index.mjs:0:0)\n at withCurrent (<repo>/js/dist/index.mjs:0:0)\n at <repo>/js/dist/index.mjs:0:0\n at runCatchFinally (<repo>/js/dist/index.mjs:0:0)\n at Logger.traced (<repo>/js/dist/index.mjs:0:0)\n at main (<repo>/e2e/scenarios/trace-primitives-basic/scenario.ts:0:0)\n at runMain (<repo>/e2e/helpers/scenario-runtime.ts:0:0)",

0 commit comments

Comments
 (0)