-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Span the annotation.message in alerts as YAML multiline strings. #412
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, but why does this even fix your issue? Could you clarify, please?
Thank you @pracucci for taking a look. Spanning the template across multiple lines affects us since we utilize a separate Go templating layer on top of the Go templating layer expected by the alertmanager. Our templates in code without this change look something like this: groups:
- name: cortex_alerts
rules:
- alert: CortexIngesterUnhealthy
annotations:
message: Cortex cluster {{ `{{ "{{ $labels.cluster }}" }}` }}/{{ `{{ "{{ $labels.namespace }}" }}` }} has {{ `{{ "{{
printf \"%.*f\" $value }}" }}` }} unhealthy ingester(s).
expr: |
min by (cluster, namespace) (cortex_ring_members{state="Unhealthy", name="ingester"}) > 0
for: 15m
labels:
severity: critical The line delimit prior to the |
I'm still not sure why this change outputs the message on a single line instead only cutting it. That was my question. Could you elaborate on it, please? |
From what I understand from the jsonnet spec, wrapping the message with a |
I didn't know it, but now it makes perfect sense. |
What this PR does:
This PR attempts to fix the issue where the annotation message is split across two lines instead of one. This causes an issue for our alertmanager config template to not render correctly since it splits up the
printf
template across the two lines.Before:
After
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]