-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix/validate compactor config #2824
Fix/validate compactor config #2824
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if we should return a wrapped error at https://github.com/grafana/loki/pull/2824/files#diff-578848847155a57366a0b3f50e1457ff1d2aea470a8a662663aea51cb4b30ec1L49
Or add a validate function for config which checks for expected values for specific fields instead of using reflect. It would be cleaner I feel.
What do you think?
I chose reflect because it's extensible (if we add a field with new defaults, etc, this code will still work). We already have a validate function for configs (I actually spent some time trying to make that work), but we unfortunately diverge from it in a few places at runtime both for validations and for module hierarchy, see https://github.com/grafana/loki/blob/master/pkg/loki/modules.go#L419-L436 I'd definitely prefer the config validation scenario, but I wasn't able to find a clean way to refactor that. Suggestions very welcome. As for the wrapped error, can you reformat the link? All I see is an entire commit. |
We could do the validation in either the factory method i.e
I am open to suggestions too and please feel free to correct me if I am wrong here. |
Good idea moving it into the |
Codecov Report
@@ Coverage Diff @@
## master #2824 +/- ##
==========================================
- Coverage 61.35% 61.26% -0.09%
==========================================
Files 181 181
Lines 14565 14570 +5
==========================================
- Hits 8937 8927 -10
- Misses 4809 4824 +15
Partials 819 819
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for taking care of the requested changes.
762ab40
to
3a54f73
Compare
Closes #2815
Tested with defined & non-defined compactor configs when: