mimir icon indicating copy to clipboard operation
mimir copied to clipboard

Create a configuration validation command (probably in `mimirtool`)

Open colega opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe.

There's no way of knowing beforehand whether a configuration file is valid or not, which may cause issues when it's rendered in CI and applied automatically.

Describe the solution you'd like

François GOUTEROUX suggested to implement a check command in mimirtool just like grafana agent did, something like:

mimirtool config check /etc/mimir/config.yaml

Describe alternatives you've considered

Maybe make a Mimir target that doesn't do anything except validating the configuration? This would probably be easier to implement and maintain code-wise (since we'd reuse the same configuration parsaing)

Additional context

Add any other context or screenshots about the feature request here.

colega avatar Jul 29 '22 09:07 colega

It's a bit obscure, but I think you get it in practice running mimir --modules=true, because it validates the config and print modules, then exit.

pracucci avatar Jul 29 '22 10:07 pracucci

It's a bit obscure, but I think you get it in practice running mimir --modules=true, because it validates the config and print modules, then exit.

Ok it do the job

mimir --modules=true -config.file /etc/mimir/bad-config.yaml
error loading config from /etc/mimir/config2.yaml: Error parsing config file: yaml: unmarshal errors:
  line 55: field instance_availability_zone not found in type querier.Config

fgouteroux avatar Jul 29 '22 10:07 fgouteroux

@pracucci maybe we could make that prettier or at least document that?

That's what I had in mind when I considered making it a Mimir target.

colega avatar Jul 29 '22 11:07 colega