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

Why doesn't time.ParseDuration() support days? #17767

Closed
EdSchouten opened this issue Nov 3, 2016 · 1 comment
Closed

Why doesn't time.ParseDuration() support days? #17767

EdSchouten opened this issue Nov 3, 2016 · 1 comment

Comments

@EdSchouten
Copy link

Prometheus has a command line flag storage.local.retention that can be used to configure the retention period of metrics. It looks like this string is parsed using time.ParseDuration().

Right now it has a default value of 15 days (360h0m0s), but in my specific case I want to set it to some higher value, say one year. This means that I need to specify 8784h, which looks quite unreadable.

I can understand why Duration can't support concepts like months and years, due to their irregular length. That said, would it make sense to extend it to support days? That way you could simply specify 366d instead.

@ianlancetaylor
Copy link
Contributor

In most locations days also have an irregular length. There is one 23 hour day and one 25 hour day per year. Since there is no clear way to resolve the ambiguity, we force the program to decide how it wants to handle it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants