Skip to content

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

@EdSchouten

Description

@EdSchouten

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions