Skip to content

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

chore: skip s3 LIST for projects configured in env (#7541)

Max Deichmann2c25c27b51a8
diff --git a/packages/shared/src/env.ts b/packages/shared/src/env.ts
index 81f386b7bc..ee9fb56728 100644
--- a/packages/shared/src/env.ts
+++ b/packages/shared/src/env.ts
@@ -105,6 +105,7 @@ const EnvSchema = z.object({
.number()
.default(80e6), // 80MB
LANGFUSE_CLICKHOUSE_DELETION_TIMEOUT_MS: z.coerce.number().default(240_000), // 4 minutes
+ LANGFUSE_SKIP_S3_LIST_FOR_OBSERVATIONS_PROJECT_IDS: z.string().optional(),
});
export const env: z.infer<typeof EnvSchema> =
diff --git a/packages/shared/src/server/ingestion/processEventBatch.ts b/packages/shared/src/server/ingestion/processEventBatch.ts
index 0008ebafb0..412e9fc779 100644
--- a/packages/shared/src/server/ingestion/processEventBatch.ts
+++ b/packages/shared/src/server/ingestion/processEventBatch.ts
@@ -229,12 +229,21 @@ export const processEventBatch = async (
throw new Error("Redis not initialized, aborting event processing");
}
+ const projectIdsToSkipS3List =
+ env.LANGFUSE_SKIP_S3_LIST_FOR_OBSERVATIONS_PROJECT_IDS?.split(",") ?? [];
+
await Promise.all(
Object.keys(sortedBatchByEventBodyId).map(async (id) => {
const eventData = sortedBatchByEventBodyId[id];
const shardingKey = `${authCheck.scope.projectId}-${eventData.eventBodyId}`;
const queue = IngestionQueue.getInstance({ shardingKey });
+ const shouldSkipS3List =
+ getClickhouseEntityType(eventData.type) === "observation" &&
+ authCheck.scope.projectId !== null &&
+ (projectIdsToSkipS3List.includes(authCheck.scope.projectId) ||
+ source === "otel");
+
return queue
? queue.add(
QueueJobs.IngestionJob,
@@ -247,9 +256,7 @@ export const processEventBatch = async (
type: eventData.type,
eventBodyId: eventData.eventBodyId,
fileKey: eventData.key,
- skipS3List:
- source === "otel" &&
- getClickhouseEntityType(eventData.type) === "observation",
+ skipS3List: shouldSkipS3List,
},
authCheck: authCheck as {
validKey: true;