From f288e0bcacfde7ce90454a0f9d74705062c873ff Mon Sep 17 00:00:00 2001 From: Loakesh Indiran <66478092+Loaki07@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:03:41 +0000 Subject: [PATCH] fix(alerts): ship the rich prebuilt templates in release images (#16974) --- config/prebuilt-destinations.json | 6 +- src/config/src/prebuilt_loader.rs | 733 +++++++------------ src/config/src/prebuilt_previous_bodies.json | 23 + src/core/src/alerts/notifications/custom.rs | 56 +- src/core/src/alerts/notifications/mod.rs | 2 +- src/core/src/alerts/notifications/send.rs | 5 +- src/core/src/alerts/slack_publish.rs | 30 +- src/core/src/alerts/templates.rs | 10 +- src/infra/src/table/templates.rs | 32 +- 9 files changed, 425 insertions(+), 472 deletions(-) create mode 100644 src/config/src/prebuilt_previous_bodies.json diff --git a/config/prebuilt-destinations.json b/config/prebuilt-destinations.json index 5d706f2eb6..7c68ba6b47 100644 --- a/config/prebuilt-destinations.json +++ b/config/prebuilt-destinations.json @@ -1,5 +1,5 @@ { - "revision": 3, + "revision": 4, "destinations": [ { "id": "slack", @@ -21,7 +21,7 @@ }, "template": { "name": "prebuilt_slack", - "body": "{\n \"text\": \"[{alert_status}] {alert_name}\",\n \"blocks\": [\n {\n \"type\": \"header\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"[{alert_status}] {alert_name}\"\n }\n },\n {\n \"type\": \"section\",\n \"fields\": [\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Stream:*\\n{stream_name}\"\n },\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Type:*\\n{stream_type}\"\n },\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Count:*\\n{alert_count}\"\n },\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Threshold:*\\n{alert_operator} {alert_threshold}\"\n }\n ]\n },\n {\n \"type\": \"section\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"*Status:* {alert_status}\\n*Time:* {alert_trigger_time_str}\"\n }\n },\n {\n \"type\": \"actions\",\n \"elements\": [\n {\n \"type\": \"button\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"View in OpenObserve\"\n },\n \"url\": \"{alert_url}\"\n }\n ]\n }\n ]\n}" + "body": "{\n \"text\": \"[{alert_status}] {alert_name}\",\n \"blocks\": [\n {\n \"type\": \"section\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"*[{alert_status}] {alert_name}*\"\n }\n },\n {\n \"type\": \"section\",\n \"fields\": [\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Stream:*\\n{stream_name}\"\n },\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Type:*\\n{stream_type}\"\n },\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Count:*\\n{alert_count}\"\n },\n {\n \"type\": \"mrkdwn\",\n \"text\": \"*Threshold:*\\n{alert_operator} {alert_threshold}\"\n }\n ]\n },\n {\n \"type\": \"section\",\n \"text\": {\n \"type\": \"mrkdwn\",\n \"text\": \"*Status:* {alert_status}\\n*Time:* {alert_trigger_time_str}\"\n }\n },\n {\n \"type\": \"actions\",\n \"elements\": [\n {\n \"type\": \"button\",\n \"text\": {\n \"type\": \"plain_text\",\n \"text\": \"View in OpenObserve\"\n },\n \"url\": \"{alert_url}\"\n }\n ]\n }\n ]\n}" }, "credential_fields": [ { @@ -203,7 +203,7 @@ }, "template": { "name": "prebuilt_opsgenie", - "body": "{\n \"message\": \"OpenObserve [{alert_status}]: {alert_name}\",\n \"alias\": \"{alert_name}_{stream_name}\",\n \"description\": \"Alert triggered from OpenObserve\",\n \"priority\": \"{credential_priority}\",\n \"details\": {\n \"alert_name\": \"{alert_name}\",\n \"stream_name\": \"{stream_name}\",\n \"stream_type\": \"{stream_type}\",\n \"alert_count\": \"{alert_count}\",\n \"alert_threshold\": \"{alert_operator} {alert_threshold}\",\n \"alert_time\": \"{alert_trigger_time_str}\",\n \"alert_url\": \"{alert_url}\"\n },\n \"source\": \"OpenObserve\",\n \"tags\": [\"openobserve\", \"{stream_type}\"]\n}" + "body": "{\n \"message\": \"OpenObserve [{alert_status}]: {alert_name}\",\n \"description\": \"Alert triggered from OpenObserve\",\n \"priority\": \"{credential_priority}\",\n \"details\": {\n \"alert_name\": \"{alert_name}\",\n \"stream_name\": \"{stream_name}\",\n \"stream_type\": \"{stream_type}\",\n \"alert_count\": \"{alert_count}\",\n \"alert_threshold\": \"{alert_operator} {alert_threshold}\",\n \"alert_time\": \"{alert_trigger_time_str}\",\n \"alert_url\": \"{alert_url}\"\n },\n \"source\": \"OpenObserve\",\n \"tags\": [\"openobserve\", \"{stream_type}\"]\n}" }, "credential_fields": [ { diff --git a/src/config/src/prebuilt_loader.rs b/src/config/src/prebuilt_loader.rs index b3cc93c2ba..9ae25866ee 100644 --- a/src/config/src/prebuilt_loader.rs +++ b/src/config/src/prebuilt_loader.rs @@ -135,9 +135,11 @@ pub fn is_prebuilt_template_name(name: &str) -> bool { /// Get a specific prebuilt template by type (e.g., "slack", "teams", "email") pub fn get_prebuilt_template(prebuilt_type: &str) -> Option