Add threshold to pingMsg

This commit is contained in:
Stephen Papierski 2023-11-15 17:17:14 -07:00
parent d1af449079
commit 9cfaf9841a
No known key found for this signature in database

View file

@ -1565,7 +1565,7 @@ class Monitor extends BeanModel {
// Create stats to append to messages/logs // Create stats to append to messages/logs
const methodDescription = [ "average", "max" ].includes(method) ? `${method} of last ${windowDuration}s` : method; const methodDescription = [ "average", "max" ].includes(method) ? `${method} of last ${windowDuration}s` : method;
let msgStats = `Response: ${actualResponseTime}ms (${methodDescription}) | Threshold: ${threshold}ms (${thresholdDescription})`; let msgStats = `Response: ${actualResponseTime}ms (${methodDescription}) | Threshold: ${threshold}ms (${thresholdDescription})`;
let pingMsg = `${actualResponseTime}ms response (${methodDescription})`; let pingMsg = `${actualResponseTime}ms resp. (${methodDescription})`;
// Verify valid response time was calculated // Verify valid response time was calculated
if (actualResponseTime === 0 || !Number.isInteger(actualResponseTime)) { if (actualResponseTime === 0 || !Number.isInteger(actualResponseTime)) {
@ -1593,6 +1593,7 @@ class Monitor extends BeanModel {
Monitor.sendSlowResponseNotification(monitor, bean, msg); Monitor.sendSlowResponseNotification(monitor, bean, msg);
// Mark important (SLOW -> NOMINAL) // Mark important (SLOW -> NOMINAL)
pingMsg += ` < ${threshold}ms`;
bean.pingImportant = true; bean.pingImportant = true;
bean.pingMsg = pingMsg; bean.pingMsg = pingMsg;
} }
@ -1612,6 +1613,7 @@ class Monitor extends BeanModel {
Monitor.sendSlowResponseNotification(monitor, bean, msg); Monitor.sendSlowResponseNotification(monitor, bean, msg);
// Mark important (NOMINAL -> SLOW) // Mark important (NOMINAL -> SLOW)
pingMsg += ` > ${threshold}ms`;
bean.pingImportant = true; bean.pingImportant = true;
bean.pingMsg = pingMsg; bean.pingMsg = pingMsg;