]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.ts
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / services / prometheus-alert-formatter.ts
index 573704f935e5fc058da3167e040d7ac895d300b2..47cb0307c1fa86933c5789cd5d1cf5f07a1e249a 100644 (file)
@@ -5,9 +5,9 @@ import * as _ from 'lodash';
 import { NotificationType } from '../enum/notification-type.enum';
 import { CdNotificationConfig } from '../models/cd-notification';
 import {
-  PrometheusAlert,
-  PrometheusCustomAlert,
-  PrometheusNotificationAlert
+  AlertmanagerAlert,
+  AlertmanagerNotificationAlert,
+  PrometheusCustomAlert
 } from '../models/prometheus-alerts';
 import { NotificationService } from './notification.service';
 
@@ -22,18 +22,18 @@ export class PrometheusAlertFormatter {
   }
 
   convertToCustomAlerts(
-    alerts: (PrometheusNotificationAlert | PrometheusAlert)[]
+    alerts: (AlertmanagerNotificationAlert | AlertmanagerAlert)[]
   ): PrometheusCustomAlert[] {
     return _.uniqWith(
       alerts.map((alert) => {
         return {
           status: _.isObject(alert.status)
-            ? (alert as PrometheusAlert).status.state
-            : this.getPrometheusNotificationStatus(alert as PrometheusNotificationAlert),
+            ? (alert as AlertmanagerAlert).status.state
+            : this.getPrometheusNotificationStatus(alert as AlertmanagerNotificationAlert),
           name: alert.labels.alertname,
           url: alert.generatorURL,
           summary: alert.annotations.summary,
-          fingerprint: _.isObject(alert.status) && (alert as PrometheusAlert).fingerprint
+          fingerprint: _.isObject(alert.status) && (alert as AlertmanagerAlert).fingerprint
         };
       }),
       _.isEqual
@@ -43,7 +43,7 @@ export class PrometheusAlertFormatter {
   /*
    * This is needed because NotificationAlerts don't use 'active'
    */
-  private getPrometheusNotificationStatus(alert: PrometheusNotificationAlert): string {
+  private getPrometheusNotificationStatus(alert: AlertmanagerNotificationAlert): string {
     const state = alert.status;
     return state === 'firing' ? 'active' : state;
   }