]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix for alert notification message being undefined 40332/head
authorNizamudeen A <nia@redhat.com>
Tue, 23 Mar 2021 07:10:46 +0000 (12:40 +0530)
committerNizamudeen A <nia@redhat.com>
Tue, 23 Mar 2021 07:10:46 +0000 (12:40 +0530)
Prometheus alert notification message in the dashboard always comes up
as undefined. Its because we were showing the alert.summary instead of
alert.description for displaying the message. I couldn't find the
summary field in the ceph_default_alerts.yml file. So removed all the
Summary fields from the dashboard code.

Fixes: https://tracker.ceph.com/issues/49342
Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/models/prometheus-alerts.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.ts
src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts

index f5e8f850b15bb1011e52100d4843c7f7ebf3f166..1239dcccdfe247e28bbd289df03cab4aae1daf3d 100644 (file)
@@ -7,7 +7,6 @@ export class PrometheusAlertLabels {
 
 class Annotations {
   description: string;
-  summary: string;
 }
 
 class CommonAlertmanagerAlert {
@@ -80,6 +79,6 @@ export class PrometheusCustomAlert {
   status: 'resolved' | 'unprocessed' | 'active' | 'suppressed';
   name: string;
   url: string;
-  summary: string;
+  description: string;
   fingerprint?: string | boolean;
 }
index 8ee698ff5241a36c69b02a52debf4562b803ae27..1384637bbd8b2194ebd1ce31e798048f2f6ad24f 100644 (file)
@@ -51,7 +51,7 @@ describe('PrometheusAlertFormatter', () => {
         {
           status: 'active',
           name: 'Something',
-          summary: 'Something is active',
+          description: 'Something is active',
           url: 'http://Something',
           fingerprint: 'Something'
         } as PrometheusCustomAlert
@@ -66,7 +66,7 @@ describe('PrometheusAlertFormatter', () => {
           fingerprint: false,
           status: 'active',
           name: 'Something',
-          summary: 'Something is firing',
+          description: 'Something is firing',
           url: 'http://Something'
         } as PrometheusCustomAlert
       ]);
@@ -77,7 +77,7 @@ describe('PrometheusAlertFormatter', () => {
     const alert: PrometheusCustomAlert = {
       status: 'active',
       name: 'Some alert',
-      summary: 'Some alert is active',
+      description: 'Some alert is active',
       url: 'http://some-alert',
       fingerprint: '42'
     };
index 9af9ce18c7f6f3a1c0e63d1851bcc889542663b6..96ad5f96f71bfa9479167f5effd5d2652d88a6af 100644 (file)
@@ -33,7 +33,7 @@ export class PrometheusAlertFormatter {
             : this.getPrometheusNotificationStatus(alert as AlertmanagerNotificationAlert),
           name: alert.labels.alertname,
           url: alert.generatorURL,
-          summary: alert.annotations.summary,
+          description: alert.annotations.description,
           fingerprint: _.isObject(alert.status) && (alert as AlertmanagerAlert).fingerprint
         };
       }),
@@ -53,7 +53,7 @@ export class PrometheusAlertFormatter {
     return new CdNotificationConfig(
       this.formatType(alert.status),
       `${alert.name} (${alert.status})`,
-      this.appendSourceLink(alert, alert.summary),
+      this.appendSourceLink(alert, alert.description),
       undefined,
       'Prometheus'
     );
index c45f480a700e648b69be7b0db1ad3778d6957983..7b2386b990c2ce13fb1f328d7b96ff11d7b55ea2 100644 (file)
@@ -324,7 +324,7 @@ export class PrometheusHelper {
         severity: 'someSeverity'
       },
       annotations: {
-        summary: `${name} is ${state}`
+        description: `${name} is ${state}`
       },
       generatorURL: `http://${name}`,
       startsAt: new Date(new Date('2022-02-22').getTime() * timeMultiplier).toString()
@@ -338,7 +338,7 @@ export class PrometheusHelper {
         alertname: name
       },
       annotations: {
-        summary: `${name} is ${status}`
+        description: `${name} is ${status}`
       },
       generatorURL: `http://${name}`
     } as AlertmanagerNotificationAlert;