Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Correctly handle errors during initialization + code refactor #9626
Correctly handle errors during initialization + code refactor #9626
Changes from 3 commits
d0761d5
ec40e5f
5431bc7
e8dd3cc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
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'm not convinced this is a better approach for this case; can you explain your rationale for composition over inheritance?
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.
KafkaConsumerCheck
. This can't be done as the agent refuses to loadKafkaConsumerCheck
if it's subclassed anywhere.KafkaCheck
and override the__new__
method to return aLegacyKafkaCheck
instance in case a certain condition is found after connecting to Kafka. This is the current situation and it needs to be removed with the refactor. Indeed we can't retry checking that version condition by setting the check as acheck_initialization
, once the class is initialized we can't change it.KafkaConsumer
main class that inherit from AgentCheck and this is the only class that can inherit from it. We then need aNewKafkaConsumer
implementation and aLegacyKafkaCheck
implementation. The common code can now live inKafkaConsumer
.With option 3 there are a few design possibilities, I decided to override the
__getattr__
method because of the large number of calls toself.gauge
,self.submit_metadata
etc. that are happening in many places.