🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
chore: fetch file list for worker processing from s3 event log (#5405)
Steffen Schmitz431f8ed941ec
diff --git a/worker/src/env.ts b/worker/src/env.tsindex 2d6ff0712e..75223ca387 100644--- a/worker/src/env.ts+++ b/worker/src/env.ts@@ -38,6 +38,9 @@ const EnvSchema = z.object({LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE: z.enum(["true", "false"]).default("false"),+ LANGFUSE_S3_EVENT_UPLOAD_POSTGRES_LOG_ENABLED: z+ .enum(["true", "false"])+ .default("false"),BATCH_EXPORT_ROW_LIMIT: z.coerce.number().positive().default(50_000),BATCH_EXPORT_DOWNLOAD_LINK_EXPIRATION_HOURS: z.coercediff --git a/worker/src/queues/ingestionQueue.ts b/worker/src/queues/ingestionQueue.tsindex db96551b3c..4aba8392de 100644--- a/worker/src/queues/ingestionQueue.ts+++ b/worker/src/queues/ingestionQueue.ts@@ -101,6 +101,38 @@ export const ingestionQueueProcessorBuilder = (const eventFiles = await s3Client.listFiles(`${env.LANGFUSE_S3_EVENT_UPLOAD_PREFIX}${job.data.payload.authCheck.scope.projectId}/${clickhouseEntityType}/${job.data.payload.data.eventBodyId}/`,);++ // Load file list from Postgres event log if enabled and compare with S3 List Result+ if (env.LANGFUSE_S3_EVENT_UPLOAD_POSTGRES_LOG_ENABLED === "true") {+ try {+ const files = await prisma.eventLog.findMany({+ select: {+ bucketPath: true,+ createdAt: true,+ },+ where: {+ projectId: job.data.payload.authCheck.scope.projectId,+ entityType: clickhouseEntityType,+ entityId: job.data.payload.data.eventBodyId,+ },+ });++ // Compare files from Postgres with S3 result+ if (files.length !== eventFiles.length) {+ logger.warn(`Mismatch between Postgres and S3 file list`, {+ postgres: files,+ s3: eventFiles,+ });+ }+ } catch (e) {+ logger.error(+ `Failed to load event log from Postgres for project ${job.data.payload.authCheck.scope.projectId}`,+ e,+ );+ // Fail silently while feature is experimental+ }+ }+recordDistribution("langfuse.ingestion.count_files_distribution",eventFiles.length,