diff --git a/src/config.ts b/src/config.ts index fa32afa2..ed95ac9c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -164,11 +164,14 @@ export function getConfig(): StorageConfigType { webhookQueuePullInterval: parseInt( getOptionalConfigFromEnv('WEBHOOK_QUEUE_PULL_INTERVAL') || '700' ), - webhookQueueTeamSize: parseInt('QUEUE_WEBHOOKS_TEAM_SIZE') || 50, - webhookQueueConcurrency: parseInt('QUEUE_WEBHOOK_CONCURRENCY') || 5, - adminDeleteQueueTeamSize: parseInt('QUEUE_ADMIN_DELETE_TEAM_SIZE') || 50, - adminDeleteConcurrency: parseInt('QUEUE_ADMIN_DELETE_CONCURRENCY') || 5, - + webhookQueueTeamSize: parseInt(getOptionalConfigFromEnv('QUEUE_WEBHOOKS_TEAM_SIZE') || '50'), + webhookQueueConcurrency: parseInt(getOptionalConfigFromEnv('QUEUE_WEBHOOK_CONCURRENCY') || '5'), + adminDeleteQueueTeamSize: parseInt( + getOptionalConfigFromEnv('QUEUE_ADMIN_DELETE_TEAM_SIZE') || '50' + ), + adminDeleteConcurrency: parseInt( + getOptionalConfigFromEnv('QUEUE_ADMIN_DELETE_CONCURRENCY') || '5' + ), enableImageTransformation: getOptionalConfigFromEnv('ENABLE_IMAGE_TRANSFORMATION') === 'true', imgProxyRequestTimeout: parseInt( getOptionalConfigFromEnv('IMGPROXY_REQUEST_TIMEOUT') || '15', diff --git a/src/queue/events/base-event.ts b/src/queue/events/base-event.ts index fcce589d..e5c82dcc 100644 --- a/src/queue/events/base-event.ts +++ b/src/queue/events/base-event.ts @@ -80,11 +80,12 @@ export abstract class BaseEvent> { } catch (e) { logger.error( { + error: e, event: { type: eventType, $version: (this as any).version, applyTime: Date.now(), - payload, + payload: JSON.stringify(payload), }, tenant: payload.tenant, }, diff --git a/src/queue/events/object-admin-delete.ts b/src/queue/events/object-admin-delete.ts index 046a1ce9..2f88dfad 100644 --- a/src/queue/events/object-admin-delete.ts +++ b/src/queue/events/object-admin-delete.ts @@ -45,11 +45,21 @@ export class ObjectAdminDelete extends BaseEvent { withOptionalVersion(s3Key, version) + '.info', ]) } catch (e) { + const s3Key = `${job.data.tenant.ref}/${job.data.bucketId}/${job.data.name}` + logger.error( { error: e, + jodId: job.id, + type: 'event', + event: 'ObjectAdminDelete', + payload: JSON.stringify(job.data), + objectPath: s3Key, + tenantId: job.data.tenant.ref, + project: job.data.tenant.ref, + reqId: job.data.reqId, }, - 'Error Deleting files from queue' + `[Admin]: ObjectAdminDelete ${s3Key} - FAILED` ) throw e } diff --git a/src/queue/events/webhook.ts b/src/queue/events/webhook.ts index e3f6b489..ab53f898 100644 --- a/src/queue/events/webhook.ts +++ b/src/queue/events/webhook.ts @@ -16,11 +16,10 @@ interface WebhookEvent { event: { $version: string type: string - payload: object + payload: object & { reqId?: string } applyTime: number } sentAt: string - traceId?: string tenant: { ref: string host: string @@ -55,7 +54,7 @@ export class Webhook extends BaseEvent { objectPath: path, tenantId: job.data.tenant.ref, project: job.data.tenant.ref, - reqId: job.data.traceId, + reqId: job.data.event.payload.reqId, }) try { @@ -74,7 +73,20 @@ export class Webhook extends BaseEvent { } ) } catch (e) { - logger.error({ error: e }, 'Webhook failed') + logger.error( + { + error: e, + jodId: job.id, + type: 'event', + event: job.data.event.type, + payload: JSON.stringify(job.data.event.payload), + objectPath: path, + tenantId: job.data.tenant.ref, + project: job.data.tenant.ref, + reqId: job.data.event.payload.reqId, + }, + `[Lifecycle]: ${job.data.event.type} ${path} - FAILED` + ) throw e }