Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upImprove configuration reloading #1149
Comments
This comment has been minimized.
This comment has been minimized.
|
I made a prototype, I'll make a PR later. |
This comment has been minimized.
This comment has been minimized.
|
Sounds good to me for now, thanks! For the first error vs. list of errors, I would just go for the first error for now, but I don't feel strongly. |
roymiloh
added a commit
to roymiloh/prometheus
that referenced
this issue
Oct 8, 2015
This comment has been minimized.
This comment has been minimized.
|
A multi-error error would be helpful in various places. A type alias for We have to be aware that this is no commit/rollback behavior but simply validation. This means we are pushing configuration validation from a central point to the edges of the application. This stands in direct contrast to the central approach We are still assuming that a valid configuration always succeeds, i.e. there are no runtime errors on "commit". The part missing in our current configuration validation is exactly the (inherently static) rule file parsing. The other methods in the proposal PR are always returning Extending the central approach in Thanks a lot @roymiloh for all the effort and thought you put into this! I feel a bit different for the stated reasons though. My proposal is to remove the bool return value and move the rule file validation to the configuration validation preceding the current call to |
This comment has been minimized.
This comment has been minimized.
|
Thank you for reviewing. The validation phase should contain logic only, it's not about I/O at all, so IMO assuming valid configuration always succeeds is reasonable. Having that's said, current PR does include I/O operations because current architecture does not allow to pass any content (= the loaded rule files) / arbitrary things between methods. Actually, because of the separation of concerns, code reuse is achieved easily. You can even take the PR and use it in And still, I'm not sure how it solves the semi-problem of theoretical "commit" and how we reuse the already read rule files in validation phase (because we still use |
This comment has been minimized.
This comment has been minimized.
|
I agree with @fabxc that there's a tension between centralizing the logic and thus having that easily reusable for Given that for the 100% atomic solution (don't allow for rule file changes between validation and application) we would need to read the rule files once outside of the target manager and attach them to the config object, that's already one more thing that we can't do decentralized anymore anyways. But otherwise, I'm quite ambivalent about this and will let @fabxc make the decision here if he feels strong one way or the other. |
brian-brazil
added
the
enhancement
label
Dec 16, 2015
This comment has been minimized.
This comment has been minimized.
|
I would also argue that this is not just about verbosity, but about trying to tell the user what the actual root cause is. Point in case: Spurious 'target' stanza:Having an extra "target' in front of the target as such:
results in
Wrong indentationThe above indentation is incorrect, the lower is correct
which is harder to spot in a longer YAML including comments. This results in
|
This comment has been minimized.
This comment has been minimized.
|
Agreed. But these are YAML errors. We make an effort to give meaningful error messages for anything after that but the YAML parsing itself is something we cannot influence, unfortunately. This would require to write a better YAML parser, which is obviously not realistic for us to do. |
This comment has been minimized.
This comment has been minimized.
|
Looking at https://github.com/go-yaml/yaml/issues I am not sure if filing those two will be of much use. Pity. |
This was referenced Feb 24, 2016
fabxc
added
kind/enhancement
and removed
enhancement
labels
Apr 28, 2016
This comment has been minimized.
This comment has been minimized.
|
This is covered by other PRs/issues. |
brian-brazil
closed this
Jul 13, 2016
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 24, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
roymiloh commentedOct 7, 2015
Improve configuration reloading
Current state of
reloadConflacks two things:false. It could be helpful for clients.The proposal
Implementation Details
errorof the first error occurred or returning a list oferrorif deciding to show all errors.ValidateConfig(conf config.*Config) errormethod to the interfaceReloadableand as mentioned, iterate over allreloadablesfor validatation purposes, if all passed, iterate again and assign.Duplicated code between
ValidateConfigandApplyConfigis reasonable for now, a method to pass data betweenValidateConfigandApplyConfigcould be "dirty" (@juliusv suggested to use the config instance for that) but more reliable.Thanks to @juliusv for helping!