fix: handle null ratio value (alerting) (#383)

This commit is contained in:
Warren 2024-04-22 17:54:32 -07:00 committed by GitHub
parent c3bc132d6e
commit 288c763977
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'@hyperdx/api': patch
---
fix: handle null ratio value (alerting)

View file

@ -801,8 +801,15 @@ export const processAlert = async (now: Date, alert: AlertDocument) => {
createdAt: nowInMinsRoundDown,
state: alertState,
}).save();
if (checksData?.rows && checksData?.rows > 0) {
for (const checkData of checksData.data) {
// TODO: we might want to fix the null value from the upstream
// this happens when the ratio is 0/0
if (checkData.data == null) {
continue;
}
const totalCount = isString(checkData.data)
? parseInt(checkData.data)
: checkData.data;