Skip to content

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

perf: add a global concurrency limit to the createEvalQueue (#9077)

Steffen Schmitz26045d089c86
diff --git a/packages/shared/src/server/repositories/traces.ts b/packages/shared/src/server/repositories/traces.ts
index 6a3e877834..96261ab6cf 100644
--- a/packages/shared/src/server/repositories/traces.ts
+++ b/packages/shared/src/server/repositories/traces.ts
@@ -90,6 +90,8 @@ export const getTimeframesTracesAMT = (
* @param {string} traceId - ID of the trace to check
* @param {Date} timestamp - Timestamp for time-based filtering, uses event payload or job timestamp
* @param {FilterState} filter - Filter for the trace
+ * @param {Date} maxTimeStamp - Upper bound on timestamp
+ * @param {Date} exactTimestamp - Exact match for the trace
* @returns {Promise<boolean>} - True if trace exists
*
* Notes:
diff --git a/worker/src/app.ts b/worker/src/app.ts
index 5ed634d5d8..084cd2ef16 100644
--- a/worker/src/app.ts
+++ b/worker/src/app.ts
@@ -112,6 +112,11 @@ if (env.QUEUE_CONSUMER_CREATE_EVAL_QUEUE_IS_ENABLED === "true") {
evalJobCreatorQueueProcessor,
{
concurrency: env.LANGFUSE_EVAL_CREATOR_WORKER_CONCURRENCY,
+ limiter: {
+ // Process at most `max` jobs per 2 seconds globally
+ max: env.LANGFUSE_EVAL_CREATOR_WORKER_CONCURRENCY,
+ duration: 2_000,
+ },
},
);
}