From 706be812b907f2a3d0749199c61b6f5f11add5a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Szcze=C5=9Bniak?= <89735111+aszniak@users.noreply.github.com> Date: Tue, 30 Jan 2024 22:32:41 +0000 Subject: [PATCH] integrations: Fix confusing wording in alertmanager integration. We use Alertmanager as an aggregation place for example for failing CI pipelines, and `graph` does not always reflect the source of the alert. It's called `source` originally and I think it should stay this way. --- zerver/webhooks/alertmanager/tests.py | 6 +++--- zerver/webhooks/alertmanager/view.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zerver/webhooks/alertmanager/tests.py b/zerver/webhooks/alertmanager/tests.py index a3c522834b..2d7453f75c 100644 --- a/zerver/webhooks/alertmanager/tests.py +++ b/zerver/webhooks/alertmanager/tests.py @@ -10,8 +10,8 @@ class AlertmanagerHookTests(WebhookTestCase): expected_topic_name = "andromeda" expected_message = """ :alert: **FIRING** -* CPU core temperature is 34.75C ([graph](http://cobalt:9090/graph?g0.expr=avg+by%28host%29+%28sensors_temp_input%7Bfeature%3D~%22core_%5B0-9%5D%2B%22%7D%29+%3E+15&g0.tab=0)) -* CPU core temperature is 17.625C ([graph](http://cobalt:9090/graph?g0.expr=avg+by%28host%29+%28sensors_temp_input%7Bfeature%3D~%22core_%5B0-9%5D%2B%22%7D%29+%3E+15&g0.tab=0)) +* CPU core temperature is 34.75C ([source](http://cobalt:9090/graph?g0.expr=avg+by%28host%29+%28sensors_temp_input%7Bfeature%3D~%22core_%5B0-9%5D%2B%22%7D%29+%3E+15&g0.tab=0)) +* CPU core temperature is 17.625C ([source](http://cobalt:9090/graph?g0.expr=avg+by%28host%29+%28sensors_temp_input%7Bfeature%3D~%22core_%5B0-9%5D%2B%22%7D%29+%3E+15&g0.tab=0)) """.strip() self.check_webhook( @@ -24,7 +24,7 @@ class AlertmanagerHookTests(WebhookTestCase): def test_single_error_issue_message(self) -> None: expected_topic_name = "andromeda" expected_message = """ -:squared_ok: **Resolved** CPU core temperature is 34.75C ([graph](http://cobalt:9090/graph?g0.expr=avg+by%28host%29+%28sensors_temp_input%7Bfeature%3D~%22core_%5B0-9%5D%2B%22%7D%29+%3E+15&g0.tab=0)) +:squared_ok: **Resolved** CPU core temperature is 34.75C ([source](http://cobalt:9090/graph?g0.expr=avg+by%28host%29+%28sensors_temp_input%7Bfeature%3D~%22core_%5B0-9%5D%2B%22%7D%29+%3E+15&g0.tab=0)) """.strip() self.check_webhook( diff --git a/zerver/webhooks/alertmanager/view.py b/zerver/webhooks/alertmanager/view.py index 9ba6dbff23..b337d4f911 100644 --- a/zerver/webhooks/alertmanager/view.py +++ b/zerver/webhooks/alertmanager/view.py @@ -35,7 +35,7 @@ def api_alertmanager_webhook( url = alert["generatorURL"].tame(check_string).replace("tab=1", "tab=0") - body = f"{desc} ([graph]({url}))" + body = f"{desc} ([source]({url}))" if name not in topics: topics[name] = {"firing": [], "resolved": []} topics[name][alert["status"].tame(check_string)].append(body)