Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uppromtool convert alert rules don't respect the go template #5121
Comments
This comment has been minimized.
This comment has been minimized.
|
Does this change the resulting output label? |
This comment has been minimized.
This comment has been minimized.
|
yes, the alert template will not work when span newlines, see: go template. |
This comment has been minimized.
This comment has been minimized.
|
It's better that promtool can respect the go template when converting alert rules into yaml format, i see promtool uses https://github.com/go-yaml/yaml to do the marshal, but i didn't find any place which will split the string into multi-lines. |
This comment has been minimized.
This comment has been minimized.
|
Can you share the original alert rule file? |
This comment has been minimized.
This comment has been minimized.
Above is a simple old format alert rule, you can use the promtool to convert it, then you will get the following output:
|
This comment has been minimized.
This comment has been minimized.
|
Related go-yaml/yaml#166 |
This comment has been minimized.
This comment has been minimized.
|
It looks like the fix will merged into go-yaml v3 version, will promtool upgrade the go-yaml to v3 when it's available ? |
This comment has been minimized.
This comment has been minimized.
|
This code no longer exists in current master. If the yaml library is producing output that it itself can't parse, we should probably add that information to that bug. |
DreamRivulet commentedJan 21, 2019
What did you do?
I use the promtool to convert old 1.8 version alert rules to new yaml format.
What did you expect to see?
template like
{{ var }}should not be split into multi-line.What did you see instead? Under which circumstances?
template
{{ var }}are split like:when string is long.
Environment
System information:
Linux 4.4.0-130-generic x86_64
Prometheus version: