]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix regression caused by cephPgImabalance alert 51524/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:23:06 +0000 (12:53 +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 d9a360799d9eb9403d2d81da0321b63aabe79239..213c6b646e319898d8b34e1735f6c9ed7fb04c24 100644 (file)
@@ -108,11 +108,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