Skip to content
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

Improves telemetry bean exception handling #488

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

scottopell
Copy link
Contributor

Each Instance creates and manages a Telemetry bean. This PR improves the error messages when the telemetry bean cannot be registered for whatever reason.

@scottopell scottopell requested a review from a team as a code owner October 19, 2023 18:15
@rayz
Copy link
Contributor

rayz commented Oct 19, 2023

instanceTelemetryBean.setBeansFetched(beans.size());
instanceTelemetryBean.setTopLevelAttributeCount(matchingAttributes.size());
instanceTelemetryBean.setMetricCount(metrics.size());
log.debug("Updated jmx bean for instance: " + this.getCheckName()
+ " With beans fetched = " + instanceTelemetryBean.getBeansFetched()
+ " top attributes = " + instanceTelemetryBean.getTopLevelAttributeCount()
+ " metrics = " + instanceTelemetryBean.getMetricCount());
return metrics;

would it make sense to have a null check here?

@scottopell
Copy link
Contributor Author

re #488 (comment)

In the current code structure it is impossible for the telemetry bean to be null. Even if there is an error while registering, the bean itself is still returned and set on the instance.
If you'd like to submit a PR with a null check I'd approve it, but its not necessary IMO

@scottopell scottopell merged commit 43c6494 into master Oct 19, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants