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

Unregister all broker metrics on broker stop #1232

Merged
merged 1 commit into from
Mar 29, 2019

Conversation

jsoriano
Copy link
Contributor

@jsoriano jsoriano commented Dec 7, 2018

Add methods for registering broker-specific metrics so it is possible to
keep track of them and they can be unregistered on broker stop.

Fixes #1219

Add methods for registering broker-specific metrics so it is possible to
keep track of them and they can be unregistered on broker stop.

Fixes IBM#1219
@jsoriano
Copy link
Contributor Author

jsoriano commented Dec 7, 2018

I think there can still be another leak with topic metrics, as they are never unregistered, I'll take a look to this as a follow up.

@mflpopescu
Copy link

@bai Checks appear to be passing, is it possible to approve this PR ?

@varun06
Copy link
Contributor

varun06 commented Feb 7, 2019

Can you please look into writing a test around it?

b.conf.MetricRegistry.Unregister(getMetricNameForBroker("outgoing-byte-rate", b))
b.conf.MetricRegistry.Unregister(getMetricNameForBroker("response-rate", b))
}
b.unregisterMetrics()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure you need to maintain the list of registered metrics here, could you replace this method with:

Suggested change
b.unregisterMetrics()
b.conf.MetricRegistry.UnregisterAll()

The MetricRegistry instance of scoped to a single broker instance, so once broker.Close() is called, we can Unregister all metrics attached to that broker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't UnregisterAll() also unregister the global metrics shared between brokers?

@bai
Copy link
Contributor

bai commented Mar 29, 2019

Thank you!

@bai bai merged commit 8f15a58 into IBM:master Mar 29, 2019
@jsoriano jsoriano deleted the broker-unregister-metrics branch March 29, 2019 22:56
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.

5 participants