You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add onMeterRegistrationFailed listener configuration to MeterRegistry #2068
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.
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.
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.
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.
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.
Activity
checketts commentedon 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 commentedon May 8, 2020
MeterFilteris 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 commentedon May 8, 2020
Also included here is a new method on
PrometheusMeterRegistrycalledthrowExceptionOnRegistrationFailure()which sets up such a listener that throws the same unchecked exception it did before. But now this behavior is opt-in.jkschneider commentedon May 8, 2020
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.
Make PrometheusMeterRegistry continue silently on meters with same naâĶ
Make PrometheusMeterRegistry continue silently on meters with same naâĶ