-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Configuration Validations must validate all fields before returning an error #4613
Comments
Should this be made a tracker, listing all the places where this should be done? There aren't that many components in this repo, but contrib might be affected as well. |
@MovieStoreGuy too many errors may also be a problem and confusion, I am not sold on the "print" all errors is the right approach. I remember the old I would say probably one of the first thing we should add a "--dry run" (flag) or "validate" (command) that can return immediately and be used to validate the config instead of having to run the entire binary. |
My original thought is that to use Something of the vein of:
I mainly noticed this as I was cleaning up the contrib lifecycle tests trying to figure out what is the minimal required config to make it work.
I am happy for this to be the first step to getting there, though I would want to make sure it check each entry within the configuration otherwise, it isn't much better than what we have now. |
I wanted to iron out what would this would look like within the collector and once we agree on the approach, I can create a follow up issue to update config validate methods to do what is required. |
@MovieStoreGuy since I have lots of knowledge in the internals probably for me is easier with just one (and also because of my previous bad experiences with parsers when getting one thing wrong can cause lots of chained errors. That being said I think this decision should be driven by the users, so we should get few +1 from users I am fine to do this way. When it comes to "validate", I have a better idea (I think), we should have a |
Hello, please what is the verdict on this issue? @bogdandrutu . Would we be creating a --dry-run flag? |
Hello @jpkrohling could you help answer my concerns about this issue? |
I would say:
|
@bogdandrutu's comment makes sense to me. |
Okay, thank you. I will work on this issue |
That is good, but we need to add the "--dry-run" flag, that will return if the config is valid instead of running the collector. |
Okay thank you |
Thanks a lot for your help. Hello @bogdandrutu . I looked further into this and the above screenshot it looks like it returns all the errors because all the errors were related to the top level confguration. I followed the journey from setupConfigurationComponents to configProvider.Get This also applies to individual config validations and individual unmarshaling I am thinking of creating an error variable that would be imported across these files. In the dry run function, I would print out all the errors if available, what do you think? |
To add to the above. It would be great if we could print errors about configuration in a way that makes it easier to understand what needs fixing by using some simple ascii graphics, e.g.:
The detailed info to print this ascii graphics can be returned in a custom error (we would need to indicate whether the error is in the key or in the value, optionally which part of the key or value is from, including character offsets, etc). Unfortunately we can't reference original line and column numbers since they are unknown after merging and unmarshaling, but we can reference the hierarchical keys which can still be very helpful. |
Oh wow I was actually working on this issue as indicated above, spent a substantial amount of time on it, and even implemented @tigrannajaryan suggestion, currently writing test and about to push a PR |
Signed-off-by: Maureen <[email protected]>
Hello, all please I am in the process of writing a test for my PR but am getting this error from the existing test, any suggestions please? I have reverted to the previous state the collector test was before my commits. Yet I still see this: Message otel-collector ` |
Signed-off-by: Maureen <[email protected]>
Signed-off-by: Maureen <[email protected]>
This is bringing back the functionality initially submitted in @Chinwendu20's PR: #6445 Adds a validate method which validates the configuration Link to tracking Issue: #4613 --------- Signed-off-by: Alex Boten <[email protected]> Co-authored-by: Maureen <[email protected]>
Was this issue resolved in #7835? |
Yes, closing. |
Is your feature request related to a problem? Please describe.
A lot of the configuration validate methods will return early stating a singular problem of the configuration, this can lead to a rather long feedback loop addressing issues within the configuration within complicated configurations.
Describe the solution you'd like
Each validate functions must validate all errors and only return an error after it has checked / validated all required fields.
Describe alternatives you've considered
I believe the alternative is leave it as it is or RFTM ??
Additional context
As someone that struggles with dyslexia, it takes me a few times to make sure what I typed is what I wanted, and having to reread the configuration on each failed attempted is rather pain staking process.
The text was updated successfully, but these errors were encountered: