Skip to content

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

perf: limit concurrency for eval job creations (#5660)

Max Deichmann2edc2487aea1
diff --git a/worker/src/app.ts b/worker/src/app.ts
index 55efcb0411..60122334fb 100644
--- a/worker/src/app.ts
+++ b/worker/src/app.ts
@@ -74,7 +74,7 @@ if (env.QUEUE_CONSUMER_TRACE_UPSERT_QUEUE_IS_ENABLED === "true") {
QueueName.TraceUpsert,
evalJobTraceCreatorQueueProcessor,
{
- concurrency: env.LANGFUSE_EVAL_CREATOR_WORKER_CONCURRENCY,
+ concurrency: env.LANGFUSE_TRACE_UPSERT_WORKER_CONCURRENCY,
},
);
}
diff --git a/worker/src/env.ts b/worker/src/env.ts
index 6515686009..956c84683e 100644
--- a/worker/src/env.ts
+++ b/worker/src/env.ts
@@ -91,8 +91,11 @@ const EnvSchema = z.object({
CLICKHOUSE_CLUSTER_NAME: z.string().default("default"),
CLICKHOUSE_DB: z.string().default("default"),
CLICKHOUSE_PASSWORD: z.string(),
-
LANGFUSE_EVAL_CREATOR_WORKER_CONCURRENCY: z.coerce
+ .number()
+ .positive()
+ .default(5),
+ LANGFUSE_TRACE_UPSERT_WORKER_CONCURRENCY: z.coerce
.number()
.positive()
.default(25),
diff --git a/worker/src/features/batchAction/handleBatchActionJob.ts b/worker/src/features/batchAction/handleBatchActionJob.ts
index cdf5e4d58e..be54078227 100644
--- a/worker/src/features/batchAction/handleBatchActionJob.ts
+++ b/worker/src/features/batchAction/handleBatchActionJob.ts
@@ -1,6 +1,7 @@
import {
BatchActionProcessingEventType,
CreateEvalQueue,
+ getCurrentSpan,
logger,
QueueJobs,
QueueName,
@@ -112,6 +113,18 @@ export const handleBatchActionJob = async (
const { actionId } = batchActionEvent;
+ const span = getCurrentSpan();
+ if (span) {
+ span.setAttribute(
+ "messaging.bullmq.job.input.projectId",
+ batchActionEvent.projectId,
+ );
+ span.setAttribute(
+ "messaging.bullmq.job.input.actionId",
+ batchActionEvent.actionId,
+ );
+ }
+
if (
actionId === "trace-delete" ||
actionId === "trace-add-to-annotation-queue"