Use MustRegisterOrGet to avoid possible panics in remotecfg#4101
Use MustRegisterOrGet to avoid possible panics in remotecfg#4101
Conversation
matthewnolf
left a comment
There was a problem hiding this comment.
LGTM for database_observability component
|
Can you somehow enforce Can you explain why do panics occur in the description of the PR? |
I don't know if it can be enforced via a linter rule or similar, will investigate. The majority of the issues related come down to validation of components after failure to launch and remotecfg issues. It may be worth a deeper investigation instead of this knee-jerk reaction, I think the majority of it comes down to getting the timing right - only registering metrics after we're sure a component or module is good, versus registering when we initialize a component but we're not sure it's going to run. |
|
This PR has not had any activity in the past 90 days, so the |
PR Description
Use MustRegisterOrGet to avoid unnecessary panics.
This won't resolve issues for components like pyroscope where the registration code is in a different go module. For those, we would have to consider wrapping the registry we pass to the component in the getManagedOptions/getImportManagedOptions functions in the controller modules with the same code from util, which is probably worth considering as another safety check.
Which issue(s) this PR fixes
Fixes #2801