Skip to content

Add onMeterRegistrationFailed listener configuration to MeterRegistry #2068

Closed

Description

@jkschneider

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.

Activity

  1. added this to the 1.6.0 milestone on May 8, 2020
  2. checketts commented on May 8, 2020

    @checketts
    Contributor

    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.

  3. jkschneider commented on May 8, 2020

    @jkschneider
    ContributorAuthor

    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.

  4. jkschneider commented on May 8, 2020

    @jkschneider
    ContributorAuthor

    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.

  5. jkschneider commented on May 8, 2020

    @jkschneider
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions