Change in format of "startsAt" time.

1,558 views
Skip to first unread message

yagyans...@gmail.com

unread,
Feb 10, 2021, 11:24:28 AM2/10/21
to Prometheus Users

Hi. I upgraded the Prometheus version from 2.12.0 to 2.22.2 some days back. One thing I noticed is that in my alerts, the startsAt was in IST(UTC+5:30) when I was using 2.12.0 but it has changed to UTC time now. I did not see anything in the changelogs regarding this in all the subsequent versions after 2.12.0. Am I missing something here?

Sample time stamps:
2.12.0 - "severity":"CRITICAL","source":"prometheus","startsAt":"2020-05-27T16:34:53.612166298+05:30","status":"firing"

2.22.2
"severity":"CRITICAL","source":"prometheus","startsAt":"2021-02-10T15:40:53.612166298Z","status":"firing"


Thanks in advance!

Julius Volz

unread,
Feb 10, 2021, 3:53:58 PM2/10/21
to yagyans...@gmail.com, Prometheus Users
This got changed in https://github.com/prometheus/prometheus/pull/7066

Indeed this never seems to have been included in a changelog entry by whoever cut 2.18.0, probably since it was deemed a minor cosmetic change that shouldn't affect users if the date field was handled correctly.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/77aa0945-d463-4e16-970e-b67462d9f21fn%40googlegroups.com.


--
Julius Volz
PromLabs - promlabs.com

Julien Pivotto

unread,
Feb 10, 2021, 4:41:27 PM2/10/21
to Julius Volz, yagyans...@gmail.com, Prometheus Users
To be honest, multiple users were impacted by this, included me. I ended
up changing my alertmanager templates from

.EndsAt.Format "Mon Jan 2 15:04:05"

to

.EndsAt.Local.Format "Mon Jan 2 15:04:05"

which fixed my issue, but that was annoying.

All my custom webhook receivers required an update like this too.
> > <https://groups.google.com/d/msgid/prometheus-users/77aa0945-d463-4e16-970e-b67462d9f21fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> > .
> >
>
>
> --
> Julius Volz
> PromLabs - promlabs.com
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAObpH5yUtAUV8uQVf05vZJ8NYcy0HLjTnOCjG3-yyOoh%3DwJmuA%40mail.gmail.com.

--
Julien Pivotto
@roidelapluie

Stuart Clark

unread,
Feb 11, 2021, 7:23:56 AM2/11/21
to Julius Volz, yagyans...@gmail.com, Prometheus Users
On 2021-02-10 21:41, Julien Pivotto wrote:
> To be honest, multiple users were impacted by this, included me. I
> ended
> up changing my alertmanager templates from
>
> .EndsAt.Format "Mon Jan 2 15:04:05"
>
> to
>
> .EndsAt.Local.Format "Mon Jan 2 15:04:05"
>
> which fixed my issue, but that was annoying.
>
> All my custom webhook receivers required an update like this too.

Unfortunately just formatting the date/time without specifying that you
wanted it in the local timezone only worked by luck rather than design.

Technically the date/time could have internally been in any timezone as
it would be expected users always specify how they want it displayed
(using Local, UTC, In, etc.)

I'd always recommend specifying the timezone to use whenever displaying
dates & times (that recommendation is not specific to Alertmanager).

It is very easy to be tripped up if making assumptions about the
timezone of the raw value (even assuming UTC which is often the case is
dangerous as systems can change or have bugs that adjust the timezone
but keep the actual value equivalent).
--
Stuart Clark
Reply all
Reply to author
Forward
0 new messages