grafana / mimir

Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.
https://grafana.com/oss/mimir/
GNU Affero General Public License v3.0
4.1k stars 526 forks source link

Duration parse error for `retention_period` configuration #4320

Open SeboCode opened 1 year ago

SeboCode commented 1 year ago

Describe the bug

Configuration parse error when using d, w or y as the duration specifier in blocks_storage.tsdb.retention_period. All other duration specifiers work.

To Reproduce

Steps to reproduce the behavior:

  1. Copy the following mimir config file to a preferred location with the name mimir.yaml.
    blocks_storage:
    tsdb:
    retention_period: 1d
  2. Run the following docker command (from the location where the config file is) to create & start a mimir container.
    docker run -v ./mimir.yaml:/etc/mimir.yaml grafana/mimir:2.6.0 --config.file=/etc/mimir.yaml
  3. You will get the following error: cannot unmarshal !!str 1d into time.Duration

Expected behavior

The duration should parsed correctly and the retention_period should be set to 1 day.

Environment

pracucci commented 1 year ago

The TSDB retention_period currently doesn't support the extended duration units (d, w and y). I suggest you to use 24h instead of 1d.

SeboCode commented 1 year ago

Thanks for the answer. I suggest you mention this in the configuration documentation, as this current restriction could very likely confuse others as well.

pracucci commented 1 year ago

@SeboCode Willing to open a PR to contribute to the doc? We would ❤️ your contribution!