Skip to content

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

chore: prefix batch export logs (#13246)

Steffen Schmitzf3ad6ae99955
diff --git a/web/src/features/batch-exports/server/batchExport.ts b/web/src/features/batch-exports/server/batchExport.ts
index 75d8ccb011..a3dec45c08 100644
--- a/web/src/features/batch-exports/server/batchExport.ts
+++ b/web/src/features/batch-exports/server/batchExport.ts
@@ -30,7 +30,7 @@ export const batchExportRouter = createTRPCRouter({
});
const { projectId, query, format, name } = input;
- logger.info("[TRPC] Creating export job", { job: input });
+ logger.info("[BATCH EXPORT] Creating export job", { job: input });
const userId = ctx.session.user.id;
// Create export job
@@ -66,7 +66,7 @@ export const batchExportRouter = createTRPCRouter({
},
});
} catch (e) {
- logger.error(e);
+ logger.error("[BATCH EXPORT] Failed to create export job", e);
if (e instanceof TRPCError) {
throw e;
}
diff --git a/worker/src/features/batchExport/handleBatchExportJob.ts b/worker/src/features/batchExport/handleBatchExportJob.ts
index 420c2bdcd8..7434965c7a 100644
--- a/worker/src/features/batchExport/handleBatchExportJob.ts
+++ b/worker/src/features/batchExport/handleBatchExportJob.ts
@@ -42,7 +42,9 @@ export const handleBatchExportJob = async (
const { projectId, batchExportId } = batchExportJob;
- logger.info(`Starting batch export for ${projectId} and ${batchExportId}`);
+ logger.info(
+ `[BATCH EXPORT] Starting batch export for ${projectId} and ${batchExportId}`,
+ );
const span = getCurrentSpan();
if (span) {
@@ -70,7 +72,7 @@ export const handleBatchExportJob = async (
// Check if the batch export has been cancelled
if (jobDetails.status === BatchExportStatus.CANCELLED) {
logger.info(
- `Batch export ${batchExportId} has been cancelled. Skipping processing.`,
+ `[BATCH EXPORT] Batch export ${batchExportId} has been cancelled. Skipping processing.`,
);
return; // Exit early without processing
}
@@ -97,7 +99,7 @@ export const handleBatchExportJob = async (
});
logger.info(
- `Batch export ${batchExportId} is older than 30 days. Marked as failed with retry message.`,
+ `[BATCH EXPORT] Batch export ${batchExportId} is older than 30 days. Marked as failed with retry message.`,
);
return; // Exit early without processing
@@ -105,7 +107,7 @@ export const handleBatchExportJob = async (
if (jobDetails.status !== BatchExportStatus.QUEUED) {
logger.warn(
- `Job ${batchExportId} has invalid status: ${jobDetails.status}. Retrying anyway.`,
+ `[BATCH EXPORT] Job ${batchExportId} has invalid status: ${jobDetails.status}. Retrying anyway.`,
);
}
@@ -150,7 +152,7 @@ export const handleBatchExportJob = async (
if (hasNoMatches) {
// No matching items - complete export with empty results
logger.info(
- `Batch export ${batchExportId}: comment filter matched no items, completing with empty export`,
+ `[BATCH EXPORT] Batch export ${batchExportId}: comment filter matched no items, completing with empty export`,
);
// Create an empty stream by using a filter that matches nothing
@@ -208,7 +210,7 @@ export const handleBatchExportJob = async (
rowCount++;
if (rowCount % 5000 === 0) {
logger.info(
- `Batch export ${batchExportId}: processed ${rowCount} rows`,
+ `[BATCH EXPORT] Batch export ${batchExportId}: processed ${rowCount} rows`,
);
}
callback(null, chunk);
@@ -221,10 +223,13 @@ export const handleBatchExportJob = async (
streamTransformations[jobDetails.format as BatchExportFileFormat](),
(err) => {
if (err) {
- logger.error("Getting data from DB and transform failed: ", err);
+ logger.error(
+ "[BATCH EXPORT] Getting data from DB and transform failed: ",
+ err,
+ );
} else {
logger.info(
- `Batch export ${batchExportId}: completed processing ${rowCount} total rows`,
+ `[BATCH EXPORT] Batch export ${batchExportId}: completed processing ${rowCount} total rows`,
);
}
},
@@ -270,7 +275,7 @@ export const handleBatchExportJob = async (
expiresInSeconds,
);
- logger.info(`Batch export file ${fileName} uploaded`);
+ logger.info(`[BATCH EXPORT] Batch export file ${fileName} uploaded`);
// Update job status
await prisma.batchExport.update({
@@ -303,7 +308,7 @@ export const handleBatchExportJob = async (
});
logger.info(
- `Batch export with id ${batchExportId} for project ${projectId} successful. Email sent to user ${user.id}`,
+ `[BATCH EXPORT] Batch export with id ${batchExportId} for project ${projectId} successful. Email sent to user ${user.id}`,
);
}
};
diff --git a/worker/src/queues/batchExportQueue.ts b/worker/src/queues/batchExportQueue.ts
index cd37ad91e3..4debd8e785 100644
--- a/worker/src/queues/batchExportQueue.ts
+++ b/worker/src/queues/batchExportQueue.ts
@@ -15,16 +15,16 @@ export const batchExportQueueProcessor = async (
job: Job<TQueueJobTypes[QueueName.BatchExport]>,
) => {
try {
- logger.info("Executing Batch Export Job", job.data.payload);
+ logger.info("[BATCH EXPORT] Executing Batch Export Job", job.data.payload);
await handleBatchExportJob(job.data.payload);
- logger.info("Finished Batch Export Job", job.data.payload);
+ logger.info("[BATCH EXPORT] Finished Batch Export Job", job.data.payload);
return true;
} catch (e) {
if (e instanceof LangfuseNotFoundError) {
logger.warn(
- `Batch export ${job.data.payload.batchExportId} not found. Job will be skipped.`,
+ `[BATCH EXPORT] Batch export ${job.data.payload.batchExportId} not found. Job will be skipped.`,
);
return true;
}
@@ -44,7 +44,7 @@ export const batchExportQueueProcessor = async (
});
logger.error(
- `Failed Batch Export job for id ${job.data.payload.batchExportId} and project id ${job.data.payload.projectId}`,
+ `[BATCH EXPORT] Failed Batch Export job for id ${job.data.payload.batchExportId} and project id ${job.data.payload.projectId}`,
e,
);
traceException(e);