fix: checkAlerts - add error handling (#177)

This commit is contained in:
Shorpo 2024-01-02 20:42:09 -07:00 committed by GitHub
parent 807736c7aa
commit 619bd1a952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 10 deletions

View file

@ -0,0 +1,5 @@
---
'@hyperdx/api': patch
---
fix: checkAlerts - add error handling

View file

@ -485,16 +485,25 @@ export const processAlert = async (now: Date, alert: AlertDocument) => {
checkData,
});
await fireChannelEvent({
alert,
dashboard: targetDashboard,
endTime: fns.addMinutes(bucketStart, windowSizeInMins),
group: checkData.group,
logView,
startTime: bucketStart,
totalCount,
windowSizeInMins,
});
try {
await fireChannelEvent({
alert,
dashboard: targetDashboard,
endTime: fns.addMinutes(bucketStart, windowSizeInMins),
group: checkData.group,
logView,
startTime: bucketStart,
totalCount,
windowSizeInMins,
});
} catch (e) {
logger.error({
message: 'Failed to fire channel event',
alert,
error: serializeError(e),
});
}
history.counts += 1;
}
history.lastValues.push({ count: totalCount, startTime: bucketStart });