Skip to content
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

Timezone-aware time functions #4160

Open
ktosiek opened this Issue May 13, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@ktosiek
Copy link

ktosiek commented May 13, 2018

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/Warsaw time. 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.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented May 13, 2018

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.

@ktosiek

This comment has been minimized.

Copy link
Author

ktosiek commented May 14, 2018

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.

@roidelapluie

This comment has been minimized.

Copy link
Contributor

roidelapluie commented Jul 9, 2018

Related to this an alternative to offset like: tzoffset 7d could be great. It would go back 7d or 7d+-1h depending on dst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.