-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Pass Go's time
function into the alertmanager templates to be able to do time calculations
#3762
Comments
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
We added date and timezone functions here. |
This is awesome. Although, since so little from |
Perhaps I misunderstood, what calculations would you like to do? |
As I wrote initially:
In an alert I would like to create text, such as "started 3 hours, 22 minutes ago". This is especially helpful for a repeated message, to see that this is ongoing instead of new, or for the resolved message, to have a clear documentation of how long an issue was present. |
Oh OK. You want a |
Keep in mind the started at text will be relative to the time the notification was sent. So if the alert started at 09:00 UTC, and the notification was sent at 10:00 UTC, then the text would be "started one hour ago". However, suppose you don't see the notification until 11:00 UTC, the text will still say "started one hour ago" even though it actually started two hours ago. |
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
Related: |
Yes, this is expected and is consistent with how chatops usually displays things. |
Is there a specific design decision why you don't want to pass though the entire |
Hi! 👋 Most of the functions in |
I want to add time.Since and pretty formatting a duration and filed an issue on that here: #3717 Can someone from Alertmanager team review it? (@grobinson-grafana maybe?) |
I can do a review! 🙂 I can't merge it as I'm not an Alertmanager maintainer, but I'll let @gotjosh know when I've reviewed it for him to look at too. |
fixes prometheus#3726 fixes prometheus#3762 fixes prometheus#603 Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
I believe this issue is fixed by #3863. I would love to test it - is there a schedule for the next release? If it works as advertised, I'll happily close this ticket myself. |
It's... challenging to build external projects in our environment to say the least. Otherwise I would have been more actively involved in this issue from the start. So unfortunately I can only test it once it's released. |
Proposal
Currently, it's not possible to do time calculations when sending alerts to Slack for example. Explicitly converting to another time zone or calculating a duration between
startsAt
and now would be a tremendous help. There is nothing on Slack/Mattermost's side to do any conversions or calculations there.This would be easily solved by passing the default
time
functions into the template at this location.alertmanager/template/template.go
Line 170 in 680568b
The text was updated successfully, but these errors were encountered: