fix(alerts): an alert on a count says how many of what, and names them (#6400)
"swarm services short on swarm is 6." becomes "6 swarm services are short of their replicas.", with a Which line naming each service and how many of its tasks run. The swarm figures get labels, and the counting figures (swarm, mounts, drives, updates) read as sentences in the email, its subject and the Alerts page. A plugin names what its count counts through core.alerts.names_behind; the Docker plugin does for the three swarm figures, from the stored swarm. Webhooks get alert.which too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
{{ fact("Rule", a.rule) }}
|
||||
{{ fact("Resource", a.resource) }}
|
||||
{{ fact("Reading", a.reading) }}
|
||||
{% if a.which %}{{ fact("Which", a.which) }}{% endif %}
|
||||
{{ fact("Fires when", a.condition) }}
|
||||
{% call fact("When") %}{{ a.when }}{% if a.when_utc %}<br><span style="color:{{ c.muted }};">{{ a.when_utc }}</span>{% endif %}{% endcall %}
|
||||
{% if a.note %}{{ fact("Note", a.note) }}{% endif %}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
Rule: {{ a.rule }}
|
||||
Resource: {{ a.resource }}
|
||||
Reading: {{ a.reading }}
|
||||
{% if a.which %}Which: {{ a.which }}
|
||||
{% endif %}
|
||||
Fires when: {{ a.condition }}
|
||||
When: {{ a.when }}{% if a.when_utc %} ({{ a.when_utc }}){% endif %}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<tr><td style="padding:10px 0;border-bottom:1px solid {{ c.border }};">
|
||||
<div>{{ badge(a.tone, a.state) }}</div>
|
||||
<div style="padding-top:6px;font:600 15px/1.4 {{ c.font }};color:{{ c.text }};">{{ a.headline }}</div>
|
||||
{% if a.which %}<div style="padding-top:2px;font:14px/1.5 {{ c.font }};color:{{ c.text }};">Which: {{ a.which }}</div>{% endif %}
|
||||
<div style="padding-top:2px;font:13px/1.5 {{ c.font }};color:{{ c.muted }};">{{ a.rule }} · fires when {{ a.condition }} · {{ a.when }}</div>
|
||||
{% if a.note %}<div style="padding-top:2px;font:13px/1.5 {{ c.font }};color:{{ c.muted }};">{{ a.note }}</div>{% endif %}
|
||||
</td></tr>
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
{% for a in alerts %}
|
||||
|
||||
{{ a.state }}: {{ a.headline }}
|
||||
{%- if a.which %}
|
||||
Which: {{ a.which }}
|
||||
{%- endif %}
|
||||
{{ a.rule }} · fires when {{ a.condition }} · {{ a.when }}
|
||||
{%- if a.note %}
|
||||
{{ a.note }}
|
||||
|
||||
Reference in New Issue
Block a user