prometheus / prometheus/alertmanager
Feature request: slack_configs.send_resolved a templatable field
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.6k
- Forks
- 2.5k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 61
Description
What did you do?
I'm trying to set up a receiver that can take a dynamic value for send_resolved, such as:
## Route alerts based on slack_channel label
- name: global_slack_channel_label
slack_configs:
- api_url: <some-url>
channel: '{{ printf \"#%s\" (index ((index .Alerts 0).Labels) \"slack_channel\") }}'
send_resolved: {{ (index ((index .Alerts 0).Labels)) "send_resolved") | quote | default true | replace "\"" "" }}
With this, we get a line 894: cannot unmarshal !!map into bool as Alertmanager requires this field to be boolean instead of a tmpl_string. There are various approaches to how this could be done so I'm not worried about this particular template working or not, but the send_resolved field does not allow templating as-is.
What did you expect to see?
I would like to be able to render true/false boolean based on a label in an alert. This would reduce the number of receivers required.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Alertmanager's configuration handling for slack_configs.send_resolved and trace how this field is parsed and validated as a boolean. Review the templating behavior described in the issue and any related configuration tests, then establish behavior that accepts dynamically rendered true or false values while preserving static booleans.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100