diff --git a/backend/src/email/services/email-callback.service.ts b/backend/src/email/services/email-callback.service.ts index efe0a0c2d..d4c76d77b 100644 --- a/backend/src/email/services/email-callback.service.ts +++ b/backend/src/email/services/email-callback.service.ts @@ -35,7 +35,11 @@ const parseEvent = async (req: Request): Promise => { // body could be one record or an array of records, hence we concat const body: ses.SesRecord[] = [] const sesHttpEvent = body.concat(parsed) + const parseAllRecordsSpan = tracer.startSpan('parseAllRecords', { + childOf: tracer.scope().active() || undefined, + }) records = sesHttpEvent.map(ses.parseRecord) + parseAllRecordsSpan.finish() } else if (sendgrid.isEvent(req)) { // body is always an array const sgEvent = parsed @@ -44,7 +48,7 @@ const parseEvent = async (req: Request): Promise => { throw new Error('Unable to handle this event') } const parseNotificationAndEventSpan = tracer.startSpan( - 'parseNotificationAndEvent', + 'parseAllNotificationAndEvents', { childOf: tracer.scope().active() || undefined } ) await Promise.all(records)