add support for custom annotations
This commit is contained in:
parent
e1893769da
commit
b5e9e1afb6
1 changed files with 11 additions and 0 deletions
11
bot.py
11
bot.py
|
@ -30,6 +30,10 @@ TEMPLATE_TEXT = (
|
||||||
"{{ labels.alertname }} {{ labels.instance }}"
|
"{{ labels.alertname }} {{ labels.instance }}"
|
||||||
"{% if annotations.summary %}"
|
"{% if annotations.summary %}"
|
||||||
"\n{{ annotations.summary }}"
|
"\n{{ annotations.summary }}"
|
||||||
|
"{% else %}"
|
||||||
|
"{% for key, value in annotations.items() %}"
|
||||||
|
"\n{{ key }} : {{ value }}"
|
||||||
|
"{% endfor %}"
|
||||||
"{% endif %}"
|
"{% endif %}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,6 +50,13 @@ TEMPLATE_HTML = (
|
||||||
"{% if annotations.summary %}"
|
"{% if annotations.summary %}"
|
||||||
"<br/>"
|
"<br/>"
|
||||||
"<blockquote>{{ annotations.summary }}</blockquote>"
|
"<blockquote>{{ annotations.summary }}</blockquote>"
|
||||||
|
"{% else %}"
|
||||||
|
"<br/>"
|
||||||
|
"<ul>"
|
||||||
|
"{% for key, value in annotations.items() %}"
|
||||||
|
"<li><b>{{ key | capitalize }} :</b> {{ value }}</li>"
|
||||||
|
"{% endfor %}"
|
||||||
|
"</ul>"
|
||||||
"{% endif %}"
|
"{% endif %}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue