Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTimezone-aware time functions #4160
Comments
This comment has been minimized.
This comment has been minimized.
|
I see how this might be useful for you. When adding these functions in #1545 we decided to avoid any timezone support in order to keep things simple and offer only UTC, which is now what we do throughout Prometheus as unfortunately timezones are rather complex and ever changing. One thing you could do is take into account the month/day in your alerts, as within most countries the DST switchover dates are fixed. |
This comment has been minimized.
This comment has been minimized.
|
Timezones are ever changing, but fortunately go can use the system timezone database. This way the tricky parts are offloaded to the OS (distribution of timezone information), the runtime (actually using that information), or the user (choosing the timezone for specific rules/queries). For now I'll try modelling the one timezone I need as a recording rule. |
brian-brazil
added
priority/Pmaybe
component/promql
labels
Jun 13, 2018
This comment has been minimized.
This comment has been minimized.
|
Related to this an alternative to offset like: tzoffset 7d could be great. It would go back 7d or 7d+-1h depending on dst |
ktosiek commentedMay 13, 2018
•
edited
Proposal
I'd like to be able to silence/disable alerts based on local time. Some of the services I monitor have daily maintenance periods expressed in
Europe/Warsawtime. Without timezone-aware functions I have to either use a wider silenced period, or change the rules twice a year.The proposal is to add an optional timezone argument to date/time functions (
days_in_month,day_of_week,day_of_month,year,month,hour,minute). Prometheus would still run on UTC, and only places explicitly using the timezone would change.