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

Metric kafka_brokers does not decrease #134

Open
hcbraun opened this issue Dec 9, 2019 · 3 comments
Open

Metric kafka_brokers does not decrease #134

hcbraun opened this issue Dec 9, 2019 · 3 comments

Comments

@hcbraun
Copy link

hcbraun commented Dec 9, 2019

When a broker is shutdown the reported number does not go down:

# HELP kafka_brokers Number of Brokers in the Kafka Cluster.
# TYPE kafka_brokers gauge
kafka_brokers 3
@congwensheng
Copy link

hi,Brother, has this problem been solved?I encountered this problem too, please help me

@readygodom
Copy link

readygodom commented Apr 16, 2020

Have resolved this problem by modifying its reference code.
Just need modify reference file 'github.com/Shopify/sarama/client.go'.
Add this function to refresh broker list.
func (client *client) refreshBrokers() {
for _, broker := range client.brokers {
err := broker.Open(client.conf)
if err != nil {
Logger.Println(err)
}
rs, _ := broker.Connected()
if !rs {
fmt.Println(broker.Addr(),":",broker.ID()," detached.")
client.deregisterBroker(broker)
}
}
}

@mcinquin
Copy link

mcinquin commented May 6, 2020

Hi,

Can you provide a PR for this useful fix?

Regards.

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 a pull request may close this issue.

4 participants