From 29269ad85409682eb38a075b9a5e379f393105dc Mon Sep 17 00:00:00 2001 From: Manu Goyal Date: Mon, 18 Dec 2023 13:41:33 -0800 Subject: [PATCH] Fix binding issue when tracing inside autoevals. (#46) --- js/util.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/util.ts b/js/util.ts index 3dcb19a..1a2f186 100644 --- a/js/util.ts +++ b/js/util.ts @@ -13,7 +13,11 @@ export function currentSpanTraced( if (globalThis.__inherited_braintrust_state) { const currentSpan = globalThis.__inherited_braintrust_state.currentSpan.getStore(); - return currentSpan.traced(name, (span: any) => callback(span.log), args); + return currentSpan.traced( + name, + (span: any) => callback(span.log.bind(span)), + args + ); } else { return callback(() => {}); }