🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(topics): read observation level and status message in trace batches (#18037)
Lysander Kieselb89e08378232
diff --git a/packages/shared/src/server/repositories/trace-batch.ts b/packages/shared/src/server/repositories/trace-batch.tsindex d975b7bea1..c7a018c1ed 100644--- a/packages/shared/src/server/repositories/trace-batch.ts+++ b/packages/shared/src/server/repositories/trace-batch.ts@@ -20,6 +20,8 @@ type TraceBatchEventRow = {tool_definitions: Record<string, string>;tool_calls: string[];tool_call_names: string[];+ level: string;+ status_message: string | null;};const TRACE_QUERY_BUFFER_MS = 2 * 60_000;@@ -144,6 +146,9 @@ const buildTraceBatchEventQuery = (props: TraceBatchEventStreamProps) => {"e.event_ts","e.type","e.name",+ // The Topics renderer turns ERROR/WARNING levels into transcript error signals.+ "e.level",+ "e.status_message",)// Load full input/output (false = no truncation) and every metadata key..selectIO(false)diff --git a/worker/src/__tests__/traceBatching.test.ts b/worker/src/__tests__/traceBatching.test.tsindex 39ee12b54d..cb0165f835 100644--- a/worker/src/__tests__/traceBatching.test.ts+++ b/worker/src/__tests__/traceBatching.test.ts@@ -964,6 +964,7 @@ describe("trace micro-batch scheduling with Redis", () => {kind: 1,startTimeUnixNano: timestamp,endTimeUnixNano: timestamp,+ status: { code: 2, message: "tool call failed" },attributes: Object.entries({"langfuse.observation.type": "span","langfuse.observation.input": input,@@ -1047,7 +1048,11 @@ describe("trace micro-batch scheduling with Redis", () => {},],})) {- expect(observation.trace_id).toBe(excludedTraceId);+ expect(observation).toMatchObject({+ trace_id: excludedTraceId,+ level: "ERROR",+ status_message: "tool call failed",+ });excludedObservations++;}expect(excludedObservations).toBe(2);