I have several Prometheus alerting rules which are quite long. In my editor I manage to add line breaks to the rules' expressions (see line expr) with a |
at the beginning:
- alert: IF_Critical
annotations:
description: The service on {{ $labels.route }} at {{ $labels.application }}is critical and has not received any timestamp in the last 60 minutes.
summary: Service State is critical.
expr: |
(
(camel_route_last_exchange_failure_timestamp > camel_route_last_exchange_completed_timestamp
or
camel_route_up == 0)
or
(time() - round(camel_route_last_exchange_completed_timestamp/1000) > 3600
and
(
time() - round(camel_route_last_exchange_failure_timestamp/1000) > 3600
and
round(camel_route_last_exchange_failure_timestamp/1000) != 0
))
However, when looking at Prometheus' HTML overview of the Rules and Alerts, those line breaks disappear and instead the expression is just one really long line. See the following picture:
Therefore, the following questions:
Is it possible to apply visible line breaks also in the HTML overview?
Moreover, when having a regex for a Prometheus rule e.g.
route=~"ABC1|DEF1|GHI1|...ABC9|DEF9|GHI9|"
which is also really long. Is it possible to break within this regular expression?
For 2 I have already tried either \
(one backslash) or \\
(two backslashs) before adding a line break with enter but then promtool always says "unknown escape sequence" or "unterminated quoted string"
Appreciate your help. Hope it is clear so far.
Thanks in advance!