From 5c1dd767b208f95f83243c4e996683c9582ab5ba Mon Sep 17 00:00:00 2001 From: Kathleen Koh Date: Wed, 13 Mar 2024 19:26:53 +0800 Subject: [PATCH] chore: adding duration logs for virus scan file download --- src/app/modules/submission/submission.service.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/modules/submission/submission.service.ts b/src/app/modules/submission/submission.service.ts index 3ee78d48f5..6161d24cd7 100644 --- a/src/app/modules/submission/submission.service.ts +++ b/src/app/modules/submission/submission.service.ts @@ -385,6 +385,7 @@ export const downloadCleanFile = (cleanFileKey: string, versionId: string) => { }) .createReadStream() + const timeDownloadStart = Date.now() logger.info({ message: 'File download from S3 has started', meta: logMeta, @@ -399,6 +400,12 @@ export const downloadCleanFile = (cleanFileKey: string, versionId: string) => { message: 'Successfully downloaded file from S3', meta: logMeta, }) + const timeDownloadEnd = Date.now() + logger.info({ + message: 'File download from S3 duration', + meta: { ...logMeta, time: timeDownloadEnd - timeDownloadStart }, + }) + resolve(buffer) })