Skip to content

Commit

Permalink
chore: add more spans
Browse files Browse the repository at this point in the history
  • Loading branch information
KishenKumarrrrr committed Nov 26, 2024
1 parent bcce0e3 commit 987bd0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/src/email/services/email-callback.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ const parseEvent = async (req: Request): Promise<void> => {
// 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
Expand All @@ -44,7 +48,7 @@ const parseEvent = async (req: Request): Promise<void> => {
throw new Error('Unable to handle this event')
}
const parseNotificationAndEventSpan = tracer.startSpan(
'parseNotificationAndEvent',
'parseAllNotificationAndEvents',
{ childOf: tracer.scope().active() || undefined }
)
await Promise.all(records)
Expand Down

0 comments on commit 987bd0c

Please sign in to comment.