🪢 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
feat: add 5-minute and 20-minute blob storage export frequency options (#13126)
Nelson Auner52fa068d9054
diff --git a/fern/apis/server/definition/blob-storage-integrations.yml b/fern/apis/server/definition/blob-storage-integrations.ymlindex 3d200b8d96..33c844f53f 100644--- a/fern/apis/server/definition/blob-storage-integrations.yml+++ b/fern/apis/server/definition/blob-storage-integrations.yml@@ -56,6 +56,7 @@ types:BlobStorageExportFrequency:enum:+ - every_20_minutes- hourly- daily- weekly@@ -138,8 +139,8 @@ types:- `up_to_date` — all available data has been exported; next export is scheduled for the future**ETL usage**: poll this endpoint and check for `up_to_date` status. Compare `lastSyncAt` against your- ETL bookmark to determine if new data is available. Note that exports run with a 30-minute lag buffer,- so `lastSyncAt` will always be at least 30 minutes behind real-time.+ ETL bookmark to determine if new data is available. Note that exports run with a 20-minute lag buffer,+ so `lastSyncAt` will always be at least 20 minutes behind real-time.enum:- idle- queueddiff --git a/packages/shared/src/server/redis/blobStorageIntegrationQueue.ts b/packages/shared/src/server/redis/blobStorageIntegrationQueue.tsindex 27c42add01..6d22ee360f 100644--- a/packages/shared/src/server/redis/blobStorageIntegrationQueue.ts+++ b/packages/shared/src/server/redis/blobStorageIntegrationQueue.ts@@ -42,12 +42,25 @@ export class BlobStorageIntegrationQueue {if (BlobStorageIntegrationQueue.instance) {logger.debug("Scheduling jobs for BlobStorageIntegrationQueue");+ // Remove the old hourly cron pattern — BullMQ keys repeatable jobs by+ // name + pattern, so changing the pattern creates a second schedule+ // while the old one keeps firing.+ BlobStorageIntegrationQueue.instance+ .removeRepeatable(QueueJobs.BlobStorageIntegrationJob, {+ pattern: "20 * * * *",+ })+ .catch((err) => {+ logger.error(+ "Error removing legacy BlobStorageIntegrationJob schedule",+ err,+ );+ });BlobStorageIntegrationQueue.instance.add(QueueJobs.BlobStorageIntegrationJob,{},{- repeat: { pattern: "20 * * * *" }, // every hour at 20 minutes past+ repeat: { pattern: "*/20 * * * *" }, // every 20 minutes},).catch((err) => {diff --git a/web/src/features/blobstorage-integration/types.ts b/web/src/features/blobstorage-integration/types.tsindex 88270364fe..8fabad6062 100644--- a/web/src/features/blobstorage-integration/types.ts+++ b/web/src/features/blobstorage-integration/types.ts@@ -21,7 +21,7 @@ export const blobStorageIntegrationFormSchemaBase = z.object({}).optional().or(z.literal("")),- exportFrequency: z.enum(["hourly", "daily", "weekly"]),+ exportFrequency: z.enum(["every_20_minutes", "hourly", "daily", "weekly"]),enabled: z.boolean(),forcePathStyle: z.boolean(),fileType: zdiff --git a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsxindex dc038527e3..d2f3fc6d63 100644--- a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx+++ b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx@@ -246,6 +246,7 @@ const BlobStorageIntegrationSettingsForm = ({secretAccessKey: state?.secretAccessKey || null,prefix: state?.prefix || "",exportFrequency: (state?.exportFrequency || "daily") as+ | "every_20_minutes"| "daily"| "weekly"| "hourly",@@ -275,6 +276,7 @@ const BlobStorageIntegrationSettingsForm = ({secretAccessKey: state?.secretAccessKey || null,prefix: state?.prefix || "",exportFrequency: (state?.exportFrequency || "daily") as+ | "every_20_minutes"| "daily"| "weekly"| "hourly",@@ -571,6 +573,9 @@ const BlobStorageIntegrationSettingsForm = ({<SelectValue placeholder="Select frequency" /></SelectTrigger><SelectContent>+ <SelectItem value="every_20_minutes">+ Every 20 Minutes+ </SelectItem><SelectItem value="hourly">Hourly</SelectItem><SelectItem value="daily">Daily</SelectItem><SelectItem value="weekly">Weekly</SelectItem>diff --git a/worker/src/__tests__/blobStorageIntegrationProcessing.test.ts b/worker/src/__tests__/blobStorageIntegrationProcessing.test.tsindex 9d99c6d635..b290139717 100644--- a/worker/src/__tests__/blobStorageIntegrationProcessing.test.ts+++ b/worker/src/__tests__/blobStorageIntegrationProcessing.test.ts@@ -18,7 +18,10 @@ import {} from "@langfuse/shared/src/server";import { prisma } from "@langfuse/shared/src/db";import { Job } from "bullmq";-import { handleBlobStorageIntegrationProjectJob } from "../features/blobstorage/handleBlobStorageIntegrationProjectJob";+import {+ handleBlobStorageIntegrationProjectJob,+ BLOB_STORAGE_LAG_BUFFER_MS,+} from "../features/blobstorage/handleBlobStorageIntegrationProjectJob";import {BlobStorageIntegrationType,BlobStorageIntegrationFileType,@@ -149,7 +152,7 @@ describe("BlobStorageIntegrationProcessingJob", () => {});// Create test data within the export window (2 hours ago to 1 hour ago)- // With 30-min lag buffer, actual window is 2h ago to (1h ago or now-30min, whichever is earlier)+ // With 20-min lag buffer, actual window is 2h ago to (1h ago or now-20min, whichever is earlier)const traceId = randomUUID();const observationId = randomUUID();const scoreId = randomUUID();@@ -424,9 +427,9 @@ describe("BlobStorageIntegrationProcessingJob", () => {},);- // Should be set to 7 days in the future from maxTimestamp (now - 30min)+ // Should be set to 7 days in the future from maxTimestamp (now - lag buffer)const expectedNextSync = new Date(- now.getTime() - 30 * 60 * 1000 + 7 * 24 * 60 * 60 * 1000,+ now.getTime() - BLOB_STORAGE_LAG_BUFFER_MS + 7 * 24 * 60 * 60 * 1000,);if (updatedIntegration?.nextSyncAt) {diff --git a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.tsindex 97432cd14c..addf60d9f0 100644--- a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts+++ b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts@@ -31,6 +31,8 @@ import { decrypt } from "@langfuse/shared/encryption";import { randomUUID } from "crypto";import { env } from "../../env";+export const BLOB_STORAGE_LAG_BUFFER_MS = 20 * 60 * 1000; // 20-minute lag buffer+async function* enrichObservationStream(stream: AsyncGenerator<Record<string, unknown>>,projectId: string,@@ -146,6 +148,8 @@ const getMinTimestampForExport = async (*/const getFrequencyIntervalMs = (frequency: string): number => {switch (frequency) {+ case "every_20_minutes":+ return 20 * 60 * 1000; // 20 minutescase "hourly":return 60 * 60 * 1000; // 1 hourcase "daily":@@ -366,7 +370,9 @@ export const handleBlobStorageIntegrationProjectJob = async ();const now = new Date();- const uncappedMaxTimestamp = new Date(now.getTime() - 30 * 60 * 1000); // 30-minute lag buffer+ const uncappedMaxTimestamp = new Date(+ now.getTime() - BLOB_STORAGE_LAG_BUFFER_MS,+ );const frequencyIntervalMs = getFrequencyIntervalMs(blobStorageIntegration.exportFrequency,);