diff --git a/server/notification-providers/flashduty.js b/server/notification-providers/flashduty.js index 0d6f69e59..77638798e 100644 --- a/server/notification-providers/flashduty.js +++ b/server/notification-providers/flashduty.js @@ -59,6 +59,17 @@ class FlashDuty extends NotificationProvider { * @returns {string} */ async postNotification(notification, title, body, monitorInfo, eventStatus) { + let labels = { + resource: this.genMonitorUrl(monitorInfo), + check: monitorInfo.name, + }; + if (monitorInfo?.tags?.length > 0) { + labels = monitorInfo?.tags?.reduce( + (acc, item) => ({ ...acc, + [item.name]: item.value }), + labels + ); + } const options = { method: "POST", url: "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + notification.flashdutyIntegrationKey, @@ -68,9 +79,7 @@ class FlashDuty extends NotificationProvider { title, event_status: eventStatus || "Info", alert_key: String(monitorInfo.id) || Math.random().toString(36).substring(7), - labels: monitorInfo?.tags?.reduce((acc, item) => ({ ...acc, - [item.name]: item.value - }), { resource: this.genMonitorUrl(monitorInfo) }), + labels, } };