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

Add onMeterRegistrationFailed listener configuration to MeterRegistry #2068

Closed
jkschneider opened this issue May 8, 2020 · 4 comments
Closed
Labels
enhancement A general enhancement
Milestone

Comments

@jkschneider
Copy link
Contributor

jkschneider commented May 8, 2020

This is mainly driven by the significant burden Prometheus' requirement places on everyone for the same metric name to have the same set of tags.

Previously, PrometheusMeterRegistry threw an IllegalArgumentException. Now, we'll not throw an exception but instead silently continue, but inform any callbacks registered that this Meter.Id could not be registered.

In this way, the user can do whatever they'd like with these problems, including logging or propagating a hard failure if they choose.

In theory the same mechanism could be used by any other registry implementation that has hard validation requirements like this.

See issues like #1253 for motivation.

@checketts
Copy link
Contributor

checketts commented May 8, 2020

The tag mismatch sometimes happens due to two different libraries creating the same meter name and not matching on tags; netty and httpclient I believe hit this at one time.

Would a user be able to use a MeterFilter to clean up those tags if they got into that situation?

Sure, the best solution is to have the libraries not step on each other, but I just wanted to think through what options would be available to users when hitting this exception.

@jkschneider
Copy link
Contributor Author

Would a user be able to use a MeterFilter to clean up those tags if they got into that situation?

MeterFilter is already an option. Once you see the implementation, I think you'll see this listener is called as a last resort after filters have been applied and there's still a problem.

@jkschneider
Copy link
Contributor Author

Also included here is a new method on PrometheusMeterRegistry called throwExceptionOnRegistrationFailure() which sets up such a listener that throws the same unchecked exception it did before. But now this behavior is opt-in.

@jkschneider
Copy link
Contributor Author

cc / @izeye because I know you've been squashing all the tag problems lately (and many thanks for this)! Just want you to be aware of the different behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants