Skip to content

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

chore(worker): blob export heartbeat gauge (LFE-10063) (#14441)

Niklas Semmler48eaa545b77b
diff --git a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
index 37487a59f0..6ac5bd4813 100644
--- a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
+++ b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
@@ -348,6 +348,7 @@ const processBlobStorageExport = async (config: {
// Outside the try so the catch can distinguish a real upload success from
// a failure.
let uploadSucceeded = false;
+ let heartbeat: ReturnType<typeof setInterval> | undefined;
try {
const blobStorageProps = getFileTypeProperties(config.fileType);
@@ -407,6 +408,24 @@ const processBlobStorageExport = async (config: {
// raw row text rather than parsed objects, but still iterates).
const sourceStats = { rows: 0, sourceWaitMs: 0 };
+ const HEARTBEAT_INTERVAL_MS = 5 * 60 * 1000;
+ const heartbeatTags = {
+ table: config.table,
+ projectId: config.projectId,
+ };
+ heartbeat = setInterval(() => {
+ recordGauge(
+ "langfuse.blobstorage.export_heartbeat.rows",
+ sourceStats.rows,
+ heartbeatTags,
+ );
+ recordGauge(
+ "langfuse.blobstorage.export_heartbeat.serialized_bytes",
+ serializedCounter.bytes,
+ heartbeatTags,
+ );
+ }, HEARTBEAT_INTERVAL_MS);
+
let fileStream: Readable;
if (passthroughEligible) {
@@ -633,6 +652,7 @@ const processBlobStorageExport = async (config: {
);
throw error;
} finally {
+ clearInterval(heartbeat);
unregisterInFlightBlobExport(inFlightHandle);
// ns → ms; the histogram yields NaN/Infinity with zero samples.