Skip to content

Commit

Permalink
chore: fix span
Browse files Browse the repository at this point in the history
  • Loading branch information
KishenKumarrrrr committed Nov 25, 2024
1 parent 5d07b87 commit a28bcb6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions backend/src/email/utils/callback/parsers/ses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,13 @@ const shouldBlacklist = ({
const parseNotificationAndEvent = async (
type: SesEventType,
message: any,
metadata: Metadata
metadata: Metadata,
parentSpan?: tracer.Span
): Promise<void> => {
const parseNotificationAndEventSpan = tracer.startSpan(
'parseNotificationAndEvent',
{ childOf: parentSpan }
)
if (!isNotificationAndEventForMainRecipient(message, type)) {
logger.info({
message: 'SES notification or event is not for the main recipient',
Expand Down Expand Up @@ -177,6 +182,7 @@ const parseNotificationAndEvent = async (
})
return
}
parseNotificationAndEventSpan.finish()
}

// Validate SES record hash, returns message ID if valid, otherwise throw errors
Expand Down Expand Up @@ -275,9 +281,7 @@ const parseRecord = async (record: SesRecord): Promise<void> => {
parseRecordSpan
)
}
return tracer.wrap('parseNotificationAndEvent', () =>
parseNotificationAndEvent(type, message, metadata)
)()
return parseNotificationAndEvent(type, message, metadata, parseRecordSpan)
}
parseRecordSpan.finish()
}
Expand Down

0 comments on commit a28bcb6

Please sign in to comment.