]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix regression caused by cephPgImabalance alert 51525/head
authorAashish Sharma <aasharma@li-e74156cc-2f67-11b2-a85c-e98659a63c5c.ibm.com>
Mon, 8 May 2023 07:19:13 +0000 (12:49 +0530)
committerAashish Sharma <aasharma@li-e74156cc-2f67-11b2-a85c-e98659a63c5c.ibm.com>
Wed, 17 May 2023 07:25:22 +0000 (12:55 +0530)
because of an earlier fix delivered, there is a regression caused by it
due to which alerts are not getting displayed in the active alerts tab.
This PR intends to fix this issue.

Fixes: https://tracker.ceph.com/issues/59666
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
(cherry picked from commit d0a1431fb836f1dd227df85f9e75e098edfdeac9)

src/pybind/mgr/dashboard/controllers/prometheus.py

index d49f3436333fcde71321e2e63cc9937ac0471884..7989a29563b19c94b0023b1e41fdfd9418405934 100644 (file)
@@ -66,11 +66,7 @@ class PrometheusRESTController(RESTController):
             alerts_info = []
             if 'data' in content:
                 if balancer_status['active'] and balancer_status['no_optimization_needed'] and path == '/alerts':  # noqa E501  #pylint: disable=line-too-long
-                    for alert in content['data']:
-                        for k, v in alert.items():
-                            if k == 'labels':
-                                alerts_info.append(v)
-                    alerts_info = [i for i in alerts_info if i['alertname'] != 'CephPGImbalance']
+                    alerts_info = [alert for alert in content['data'] if alert['labels']['alertname'] != 'CephPGImbalance']  # noqa E501  #pylint: disable=line-too-long
                     return alerts_info
                 return content['data']
             return content