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

Fixes panic when using multiple clients #3207

Merged
merged 1 commit into from
Jan 21, 2021

Conversation

cyriltovena
Copy link
Contributor

Panic is happening because we use multiple client with the same registry. This should be supported.

Introduced by #3175.

Signed-off-by: Cyril Tovena cyril.tovena@gmail.com

…try.

Introduce by grafana#3175.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@cyriltovena cyriltovena changed the title Fixes panic when using multiple client Fixes panic when using multiple clients Jan 21, 2021
Copy link
Contributor

@sandeepsukhani sandeepsukhani left a comment

Choose a reason for hiding this comment

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

Just a minor nit suggested. Approving it anyways since it is not a blocker.

}

return &m
}

func mustRegisterOrGet(reg prometheus.Registerer, c prometheus.Collector) prometheus.Collector {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be good to not return the prometheus.Collector? It would simplify things and make it clear that the method is just for registering the collector without modifying it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need it actually so all client can increment the metrics.

@cyriltovena cyriltovena merged commit ba0df61 into grafana:master Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants