kin*_*sch 5 regex line-breaks prometheus prometheus-alertmanager
我有几个相当长的普罗米修斯警报规则。在我的编辑器中,我设法在规则表达式中添加换行符(请参阅行 expr),并|在开头添加 a :
- 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
))
Run Code Online (Sandbox Code Playgroud)
然而,当查看 Prometheus 的规则和警报的 HTML 概述时,这些换行符消失了,取而代之的是表达式只是一行非常长的行。见下图:
因此,提出以下问题:
是否可以在 HTML 概述中应用可见的换行符?
此外,当普罗米修斯规则的正则表达式(例如)route=~"ABC1|DEF1|GHI1|...ABC9|DEF9|GHI9|"也非常长时。是否可以打破这个正则表达式?
对于 2 ,在使用 Enter 添加换行符之前,我已经尝试过\(一个反斜杠)或(两个反斜杠),但 promtool 总是说“未知转义序列”或“未终止的引号字符串”\\
感谢你的帮助。希望到目前为止一切都清楚了。
提前致谢!