prometheus: alert dashboard links with fixed timestamps
Created by: bobheadxi
While working on https://github.com/sourcegraph/sourcegraph/pull/17014 I added a relative timestamp to the dashboard link in alerts, did a bit of fenangling to make the link completely fixed to timestamps associated with the delivered alert.
We can depend on (index .Alerts 0)
because our grouping strategy ensures each group delivered only has one alert.
I'm still a bit unsure about this now that I've got it working, the experience is a bit less than ideal for alerts that e.g. are spikes lasting a second, since then we get a link to a panel that has a tiny window. An alternative is time
and time.window
, but that might not be great for alerts lasting longer. It is not possible to do arithmetic on these timestamps in alertmanager templates: https://github.com/prometheus/alertmanager/issues/1188
=> update: see https://github.com/sourcegraph/sourcegraph/pull/17034#issuecomment-756598154