-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support strict unmarshalling of the yaml files #68
Comments
Hi! This is not even a feature request, more of a bug I'd say :) If should have worked this way and even probably worked back then, until disabling of validations using comments was introduced. It required quite a bit of a mangling using the yaml/v3 library and unfortunatelly caused to drop this feature. It is enabled basicly if you see here the promruval/pkg/validate/validate.go Line 60 in 0fa04ff
promruval/pkg/unmarshaler/helpers.go Line 53 in 0fa04ff
yaml.Node Decode function is used, which does not provide the KnownFields feature as decoder.
It is reported here go-yaml/yaml#460 2y ago with no response 😖 So I'd not even introduce any new flag, nor for specifying if it is for thanos/cortex/prometheus/mimir I'd say it's acceptable that it allows union of all the fields. I just need to figure out how to fix it :/ |
I do wonder if it would make sense down the line introduce a flag which specifies which backend you are targeting (prometheus. thanos, mimir). |
Anyway thank you for fixing this :) . |
Well, as I mentioned, it is more knobs to tweak for the user... But off course it would be more correct TBH, the unmarshalling is a bit clunky as it is already, and this would make it even more complicated. I will take a look |
So… Not perfect but it works :D PTAL @jmichalek132 #77 |
When mimir ruler faces unknown field in the rules yaml files if fails to unmarshall the file and the alerts / rules are not loaded.
Right now promruval doesn't catch this case.
Sample log line from mimir ruler with the error.
Testing yaml file
It would be great if there was a validation option / flag to validate the rules file will pass strict unmarshalling, since there are small differences of what the rules fille looks like between prometheus / mimir / thanos it should be possible specifying which one to validate for.
The text was updated successfully, but these errors were encountered: