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

Fix duplicate metric registration for filters #397

Merged
merged 2 commits into from
Sep 21, 2021

Conversation

iffyio
Copy link
Collaborator

@iffyio iffyio commented Sep 19, 2021

Some filter currently call register (rather than
register_if_not_exists) which throws an error if the metric
has already been registered - this meant that we couldn't use
multiple instances of those filter in the filter chain

Some filter currently call `register` (rather than
`register_if_not_exists`) which throws an error if the metric
has already been registered - this meant that we couldn't use
multiple instances of those filter in the filter chain
@google-cla google-cla bot added the cla: yes label Sep 19, 2021
@iffyio iffyio added the kind/bug Something isn't working label Sep 19, 2021
Comment on lines +49 to +56
fn register_metric<T: Collector + Sized + 'static>(
registry: &Registry,
collector: T,
) -> Result<()> {
registry.register(Box::new(collector))
}

pub trait CollectorExt: Collector + Clone + Sized + 'static {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice change.

@iffyio
Copy link
Collaborator Author

iffyio commented Sep 21, 2021

@markmandel we can also include this fix in the upcoming release?

@markmandel
Copy link
Contributor

@markmandel we can also include this fix in the upcoming release?

Let's do it! Going to start the release today, so this sneaks in nicely!

@markmandel markmandel merged commit d4ced10 into main Sep 21, 2021
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label Sep 21, 2021
@iffyio iffyio deleted the iu/filter-multiple-metric branch November 12, 2021 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes kind/bug Something isn't working kind/cleanup Refactoring code, fixing up documentation, etc size/s
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants