Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: correctly parse input and output on traces_mt ingestion (#8242)

Steffen Schmitz8cf67fe329e0
diff --git a/worker/src/services/IngestionService/index.ts b/worker/src/services/IngestionService/index.ts
index fe75b93e53..a5771a62ef 100644
--- a/worker/src/services/IngestionService/index.ts
+++ b/worker/src/services/IngestionService/index.ts
@@ -445,11 +445,14 @@ export class IngestionService {
if (
env.LANGFUSE_EXPERIMENT_INSERT_INTO_AGGREGATING_MERGE_TREES === "true"
) {
- traceRecords
- .map(convertTraceToTraceMt)
- .forEach((r) =>
- this.clickHouseWriter.addToQueue(TableName.TracesMt, r),
- );
+ traceRecords.map(convertTraceToTraceMt).forEach((r) =>
+ this.clickHouseWriter.addToQueue(TableName.TracesMt, {
+ ...r,
+ // We need to re-add input and output here as they were excluded in a previous mapping step
+ input: finalTraceRecord.input ?? "",
+ output: finalTraceRecord.output ?? "",
+ }),
+ );
}
// Add trace into trace upsert queue for eval processing
diff --git a/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts b/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
index 678e5014ce..4c46162ee4 100644
--- a/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
+++ b/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
@@ -78,6 +78,8 @@ describe("Ingestion end-to-end tests", () => {
name: traceName,
timestamp,
environment,
+ input: "foo",
+ output: "bar",
},
},
];
@@ -102,8 +104,8 @@ describe("Ingestion end-to-end tests", () => {
expect(trace.public).toBe(false);
expect(trace.bookmarked).toBe(false);
expect(trace.tags).toEqual([]);
- expect(["", null]).toContain(trace.input);
- expect(["", null]).toContain(trace.output);
+ expect(trace.input).toBe("foo");
+ expect(trace.output).toBe("bar");
expect(trace.session_id).toBeNull();
expect(trace.timestamp).toBe(timestamp);
});