prometheus / prometheus/alertmanager
Accessing current date / other functions in the Alertmanager Go templates
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.6k
- Forks
- 2.5k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 61
Description
We're using AlertManager to send out emails.
Question 1 :
Emails apps like Inbox group emails to create conversations based on the email title. Our current email title is something like "X services failing" so that makes for horrible grouping / conversations.
The requirement would now be to group them per day by including the date in the subject.
However, I'm not able to access the current date in the Go Templates.
Is there another way of doing this ?
- Can it be passed on as a label by prometheus (using the alert.rules) ?
- Can something be done in the alertmanager configuration ?
Question 2 :
As a general remark , we often get requirements to change the email templates. For example :
- Change the sorting of the alerts
- Add how long an alert was active (current date - startsAt)
- ...
These seem to be very difficult to implement using the Go templates as a lot of these functions aren't available (no sorting, no access to date functons / current date, ....)
How should we go about this ?
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 by reviewing Alertmanager’s Go-template configuration and the template functions currently available, then compare them with the requested date, duration, and sorting behavior. Determine whether each requirement belongs in Prometheus alert rules, Alertmanager configuration, or Alertmanager itself, and document a concrete supported path for the email subject and alert ordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100