Skip to content

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

perf: improve single trace public API performance (#4537)

Max Deichmann3dd616a3dc40
diff --git a/web/src/pages/api/public/traces/[traceId].ts b/web/src/pages/api/public/traces/[traceId].ts
index 39c87ccb29..383307caf5 100644
--- a/web/src/pages/api/public/traces/[traceId].ts
+++ b/web/src/pages/api/public/traces/[traceId].ts
@@ -84,15 +84,19 @@ export default withMiddlewares({
};
},
clickhouseExecution: async () => {
- const [trace, observations, scores] = await Promise.all([
- getTraceById(traceId, auth.scope.projectId),
+ const trace = await getTraceById(traceId, auth.scope.projectId);
+ const [observations, scores] = await Promise.all([
getObservationsViewForTrace(
traceId,
auth.scope.projectId,
- undefined,
+ trace?.timestamp,
true,
),
- getScoresForTraces(auth.scope.projectId, [traceId]),
+ getScoresForTraces(
+ auth.scope.projectId,
+ [traceId],
+ trace?.timestamp,
+ ),
]);
const uniqueModels: string[] = Array.from(