Skip to content

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

chore: add env setting to limit the blob storage export for specific projects (#10607)

Steffen Schmitzaa65ae5a4ff5
diff --git a/worker/src/env.ts b/worker/src/env.ts
index fe6bf4615e..e9256be29f 100644
--- a/worker/src/env.ts
+++ b/worker/src/env.ts
@@ -150,6 +150,12 @@ const EnvSchema = z.object({
.enum(["true", "false"])
.default("true"),
+ // Comma-separated list of project IDs that should only export traces table (skip observations and scores)
+ LANGFUSE_BLOB_STORAGE_EXPORT_TRACE_ONLY_PROJECT_IDS: z
+ .string()
+ .optional()
+ .transform((s) => (s ? s.split(",").map((id) => id.trim()) : [])),
+
// Flags to toggle queue consumers on or off.
QUEUE_CONSUMER_CLOUD_USAGE_METERING_QUEUE_IS_ENABLED: z
.enum(["true", "false"])
diff --git a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
index 7cac6256fb..22559d764d 100644
--- a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
+++ b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
@@ -23,6 +23,7 @@ import {
} from "@langfuse/shared";
import { decrypt } from "@langfuse/shared/encryption";
import { randomUUID } from "crypto";
+import { env } from "../../env";
const getMinTimestampForExport = async (
projectId: string,
@@ -345,11 +346,26 @@ export const handleBlobStorageIntegrationProjectJob = async (
fileType: blobStorageIntegration.fileType,
};
- await Promise.all([
- processBlobStorageExport({ ...executionConfig, table: "traces" }),
- processBlobStorageExport({ ...executionConfig, table: "observations" }),
- processBlobStorageExport({ ...executionConfig, table: "scores" }),
- ]);
+ // Check if this project should only export traces
+ const isTraceOnlyProject =
+ env.LANGFUSE_BLOB_STORAGE_EXPORT_TRACE_ONLY_PROJECT_IDS.includes(
+ projectId,
+ );
+
+ if (isTraceOnlyProject) {
+ // Only process traces table for projects in the trace-only list
+ logger.info(
+ `[BLOB INTEGRATION] Project ${projectId} is configured for trace-only export, skipping observations and scores`,
+ );
+ await processBlobStorageExport({ ...executionConfig, table: "traces" });
+ } else {
+ // Process all tables for projects not in the trace-only list
+ await Promise.all([
+ processBlobStorageExport({ ...executionConfig, table: "traces" }),
+ processBlobStorageExport({ ...executionConfig, table: "observations" }),
+ processBlobStorageExport({ ...executionConfig, table: "scores" }),
+ ]);
+ }
// Determine if we've caught up with present-day data
const caughtUp = maxTimestamp.getTime() >= uncappedMaxTimestamp.getTime();