Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

webhooks/opensearch: Remove the alert's trigger time field.

Niloth P97cc3f8cd524
diff --git a/static/images/integrations/opensearch/001.png b/static/images/integrations/opensearch/001.png
index f3c50255d39..890edfa66e5 100644
Binary files a/static/images/integrations/opensearch/001.png and b/static/images/integrations/opensearch/001.png differ
diff --git a/zerver/webhooks/opensearch/doc.md b/zerver/webhooks/opensearch/doc.md
index 9bf40e069b6..3badcc661cb 100644
--- a/zerver/webhooks/opensearch/doc.md
+++ b/zerver/webhooks/opensearch/doc.md
@@ -54,7 +54,7 @@ Get OpenSearch alerts in Zulip!
```
{% raw %}
topic: {{ctx.monitor.name}}
- Alert of severity **{{ctx.trigger.severity}}** triggered by **{{ctx.trigger.name}}** at <time:{{ctx.periodStart}}>.
+ Alert of severity **{{ctx.trigger.severity}}** triggered by **{{ctx.trigger.name}}**.
{% endraw %}
```
diff --git a/zerver/webhooks/opensearch/fixtures/default_template.txt b/zerver/webhooks/opensearch/fixtures/default_template.txt
index b7b76cf5f74..ab4e85b453c 100644
--- a/zerver/webhooks/opensearch/fixtures/default_template.txt
+++ b/zerver/webhooks/opensearch/fixtures/default_template.txt
@@ -1,5 +1,5 @@
Monitor Storage size monitor just entered alert status. Please investigate the issue.
- Trigger: Storage size over 1TB
- Severity: 1
-- Period start: <time:2025-02-25T00:58:39.607Z>
-- Period end: <time:2025-02-25T00:59:39.607Z>
+- Period start: 2025-02-25T00:58:39.607Z
+- Period end: 2025-02-25T00:59:39.607Z
diff --git a/zerver/webhooks/opensearch/fixtures/example_template.txt b/zerver/webhooks/opensearch/fixtures/example_template.txt
index 9f186c2b446..cf3256555cc 100644
--- a/zerver/webhooks/opensearch/fixtures/example_template.txt
+++ b/zerver/webhooks/opensearch/fixtures/example_template.txt
@@ -1,2 +1,2 @@
topic: Resource Monitor
-Alert of severity **3** triggered by **Insufficient memory** at <time:2025-03-04T15:52:59.372Z>.
+Alert of severity **3** triggered by **Insufficient memory**.
diff --git a/zerver/webhooks/opensearch/tests.py b/zerver/webhooks/opensearch/tests.py
index 648a97e1e68..d17a8f06761 100644
--- a/zerver/webhooks/opensearch/tests.py
+++ b/zerver/webhooks/opensearch/tests.py
@@ -20,20 +20,28 @@ class OpensearchHookTests(WebhookTestCase):
return body
def test_test_notification_from_channel(self) -> None:
+ """
+ Tests the message template that OpenSearch uses for
+ test-notifications when setting up the webhook.
+ """
message = "Test message content body for config id Uz5bK5UBeE4fYdADfbg0"
self.check_webhook("test_notification", self.TOPIC_NAME, message, content_type="text/plain")
def test_test_notification_from_monitor_action(self) -> None:
+ """Tests the default message template provided by OpenSearch."""
message = (
"Monitor Storage size monitor just entered alert status. Please investigate the issue.\n"
"- Trigger: Storage size over 1TB\n"
"- Severity: 1\n"
- "- Period start: <time:2025-02-25T00:58:39.607Z>\n"
- "- Period end: <time:2025-02-25T00:59:39.607Z>"
+ "- Period start: 2025-02-25T00:58:39.607Z\n"
+ "- Period end: 2025-02-25T00:59:39.607Z"
)
self.check_webhook("default_template", self.TOPIC_NAME, message, content_type="text/plain")
def test_example_template_notification(self) -> None:
- message = "Alert of severity **3** triggered by **Insufficient memory** at <time:2025-03-04T15:52:59.372Z>."
+ """
+ Tests the copyable example message template we provide in the integration documentation.
+ """
+ message = "Alert of severity **3** triggered by **Insufficient memory**."
expected_topic = "Resource Monitor"
self.check_webhook("example_template", expected_topic, message, content_type="text/plain")