From a06876fb01a36de5066b52f3419909d6399dc1ff Mon Sep 17 00:00:00 2001 From: jacoblee93 Date: Fri, 23 Aug 2024 14:05:02 -0700 Subject: [PATCH] Fix dotted_order and trace_id for nested JS interop traces --- js/src/run_trees.ts | 2 ++ js/src/tests/lcls_handoff.int.test.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/js/src/run_trees.ts b/js/src/run_trees.ts index 4427305e0..a2dad8bcb 100644 --- a/js/src/run_trees.ts +++ b/js/src/run_trees.ts @@ -421,6 +421,8 @@ export class RunTree implements BaseRun { const parentRunTree = new RunTree({ name: parentRun.name, id: parentRun.id, + trace_id: parentRun.trace_id, + dotted_order: parentRun.dotted_order, client, tracingEnabled, project_name: projectName, diff --git a/js/src/tests/lcls_handoff.int.test.ts b/js/src/tests/lcls_handoff.int.test.ts index 3a064a07f..e0ec379be 100644 --- a/js/src/tests/lcls_handoff.int.test.ts +++ b/js/src/tests/lcls_handoff.int.test.ts @@ -54,10 +54,12 @@ test.concurrent( timeout_ms: 30_000, }); try { + const runId = uuidv4(); const result = await app.invoke( [new HumanMessage({ content: "Hello!" })], { callbacks: [tracer], + runId, } ); expect(result[result.length - 1].content).toEqual("Hello! world"); @@ -84,6 +86,7 @@ test.concurrent( const trace = traces[0]; expect(trace.name).toEqual("add_negligible_value"); expect(trace.parent_run_id).not.toBeNull(); + expect(trace.trace_id).toEqual(runId); } catch (e) { console.error(e); throw e;