Skip to content

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

chore: add projectid to ingestion logs (#3665)

Max Deichmannfa51789ac263
diff --git a/worker/src/queues/legacyIngestionQueue.ts b/worker/src/queues/legacyIngestionQueue.ts
index 38bb1ab221..1a07ce983e 100644
--- a/worker/src/queues/legacyIngestionQueue.ts
+++ b/worker/src/queues/legacyIngestionQueue.ts
@@ -38,7 +38,7 @@ const getS3StorageServiceClient = (bucketName: string): S3StorageService => {
};
export const legacyIngestionQueueProcessor: Processor = async (
- job: Job<TQueueJobTypes[QueueName.LegacyIngestionQueue]>,
+ job: Job<TQueueJobTypes[QueueName.LegacyIngestionQueue]>
) => {
try {
const startTime = Date.now();
@@ -50,19 +50,19 @@ export const legacyIngestionQueueProcessor: Processor = async (
!env.LANGFUSE_S3_EVENT_UPLOAD_BUCKET
) {
throw new Error(
- "S3 event store is not enabled but useS3EventStore is true",
+ "S3 event store is not enabled but useS3EventStore is true"
);
}
// If we used the S3 store we need to fetch the ingestionEvents from S3
const s3Client = getS3StorageServiceClient(
- env.LANGFUSE_S3_EVENT_UPLOAD_BUCKET,
+ env.LANGFUSE_S3_EVENT_UPLOAD_BUCKET
);
ingestionEvents = (
await Promise.all(
job.data.payload.data.map(async (record) => {
const eventName = record.type.split("-").shift();
const file = await s3Client.download(
- `${env.LANGFUSE_S3_EVENT_UPLOAD_PREFIX}${job.data.payload.authCheck.scope.projectId}/${eventName}/${record.eventBodyId}/${record.eventId}.json`,
+ `${env.LANGFUSE_S3_EVENT_UPLOAD_PREFIX}${job.data.payload.authCheck.scope.projectId}/${eventName}/${record.eventBodyId}/${record.eventId}.json`
);
const parsedFile = JSON.parse(file);
const parsed = ingestionBatchEvent.safeParse(parsedFile);
@@ -75,11 +75,11 @@ export const legacyIngestionQueueProcessor: Processor = async (
return [parsed.data];
} else {
throw new Error(
- `Failed to parse event from S3: ${parsed.error.message}`,
+ `Failed to parse event from S3: ${parsed.error.message}`
);
}
}
- }),
+ })
)
).flat();
} else {
@@ -88,6 +88,7 @@ export const legacyIngestionQueueProcessor: Processor = async (
}
logger.info("Processing legacy ingestion", {
+ projectId: job.data.payload.authCheck.scope.projectId,
payload: ingestionEvents.map(({ body, ...rest }) => {
let modifiedBody = body;
if (body && "input" in modifiedBody) {
@@ -116,13 +117,13 @@ export const legacyIngestionQueueProcessor: Processor = async (
const result = await handleBatch(
ingestionEvents,
job.data.payload.authCheck,
- tokenCount,
+ tokenCount
);
// send out REDIS requests to worker for all trace types
await addTracesToTraceUpsertQueue(
result.results,
- job.data.payload.authCheck.scope.projectId,
+ job.data.payload.authCheck.scope.projectId
);
// Log queue size
@@ -139,12 +140,12 @@ export const legacyIngestionQueueProcessor: Processor = async (
recordHistogram(
"langfuse.queue.legacy_ingestion.processing_time",
Date.now() - startTime,
- { unit: "milliseconds" },
+ { unit: "milliseconds" }
);
} catch (e) {
logger.error(
`Failed job legacy ingestion processing for ${job.data.payload.authCheck.scope.projectId}`,
- e,
+ e
);
traceException(e);
throw e;