From fa2454a3c9c524773891e53d2d61f9227a9a2d46 Mon Sep 17 00:00:00 2001 From: Martin Chacon Piza Date: Fri, 18 Jun 2021 09:59:47 +0200 Subject: [PATCH] Fix Grafana URL in email notification - Remove prefix 'dim_' from dimensions in Drilldown Dashboard - Same was done for Monasca-UI [1] [1] https://review.opendev.org/c/openstack/monasca-ui/+/782599 Change-Id: I69e3e7db54b995e45810532a1dd940ac8b68921f --- monasca_notification/plugins/email_notifier.py | 2 +- tests/test_email_notification.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/monasca_notification/plugins/email_notifier.py b/monasca_notification/plugins/email_notifier.py index 73fa7b0..edb341f 100644 --- a/monasca_notification/plugins/email_notifier.py +++ b/monasca_notification/plugins/email_notifier.py @@ -259,7 +259,7 @@ class EmailNotifier(abstract_notifier.AbstractNotifier): dimensions = metric['dimensions'] for key, value in dimensions.items(): - metric_query += "&dim_%s=%s" % (key, value) + metric_query += "&%s=%s" % (key, value) # Show the graph within a range of ten minutes before and after the alarm occurred. offset = 600000 diff --git a/tests/test_email_notification.py b/tests/test_email_notification.py index 7a79a7c..c56a01e 100644 --- a/tests/test_email_notification.py +++ b/tests/test_email_notification.py @@ -475,7 +475,7 @@ class TestEmail(base.PluginTestCase): # Then the following link to Grafana (including the metric info and timestamp) is expected. expected_url = "http://127.0.0.1:3000/dashboard/script/drilldown.js" \ - "?metric=cpu.percent&dim_hostname=foo1&dim_service=bar1" \ + "?metric=cpu.percent&hostname=foo1&service=bar1" \ "&from=%s&to=%s" % (expected_from_ms, expected_to_ms) self._assert_equal_urls(expected_url, result_url)