Skip to content

Commit b1ff649

Browse files
committed
docs: note monitedge version requirement
1 parent 850df98 commit b1ff649

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

en/monitors/alert-rules/description-template.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ keywords: ["Description templates", "alert rules", "Go Template", "Sprig", "rela
66

77
Use an alert rule **Description** to define the text shown on firing and recovery events. You can reference alert labels, query values, related query results, and safe Sprig functions with Go `text/template`, then render the result as Text or Markdown.
88

9+
<Warning>
10+
The template variables, Sprig function names, and behavior where label enrichment runs before `Description` rendering require monit-edge `v0.42.0` or later. On older versions, some variables or functions may be unavailable, and enrichment results may not be available inside Description templates.
11+
</Warning>
12+
913
## How It Works
1014

11-
When a rule fires or recovers, monit-edge passes the full alert event as the template root object and injects short variables for common fields. After rendering, monit-edge writes the result to the event `Description`, then runs label enrichment and sends the event.
15+
When a rule fires or recovers, monit-edge passes the full alert event as the template root object and injects short variables for common fields. After label enrichment completes, monit-edge renders the template with the enriched event, writes the result to the event `Description`, and then sends the event.
1216

1317
<Note>
1418
For day-to-day templates, prefer `$labels`, `$values`, `$value`, `$relates`, `$status`, and `$checkMode`. Use the other short variables only for advanced templates or compatibility cases.

zh/monitors/alert-rules/description-template.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ keywords: ["Description 模板", "告警规则", "备注描述", "Go Template",
66

77
Monitors 告警规则的 **备注描述(Description)** 用于定义告警和恢复事件中的说明文本。你可以使用 Go `text/template` 引用告警标签、查询值、关联查询结果和安全的 Sprig 函数,生成 Text 或 Markdown 格式的描述内容。
88

9+
<Warning>
10+
本文描述的模板变量、Sprig 函数名和标签增强后再渲染 `Description` 的行为需要 monit-edge `v0.42.0` 或以上版本。低于该版本时,部分变量或函数可能不可用,标签增强结果也可能无法在备注模板中引用。
11+
</Warning>
12+
913
## 工作方式
1014

11-
规则触发或恢复时,monit-edge 会把完整告警事件作为模板根对象,并额外注入一组常用短变量。模板渲染完成后,结果会写入事件的 `Description` 字段,再继续执行标签增强和事件发送
15+
规则触发或恢复时,monit-edge 会把完整告警事件作为模板根对象,并额外注入一组常用短变量。标签增强执行完成后,模板会基于增强后的事件渲染,结果会写入事件的 `Description` 字段,再继续发送事件
1216

1317
<Note>
1418
日常模板建议优先使用 `$labels``$values``$value``$relates``$status``$checkMode`。其他短变量用于高级模板或兼容场景,只有确实需要时再使用。

0 commit comments

Comments
 (0)