Skip to content

Metric pattern validation in simpleclient_dropwizard is overly strict #518

Open
@LiamClarkeNZ

Description

@LiamClarkeNZ

I am exposing metrics to Prometheus in an existing app that uses Dropwizard, and they have a wide variety of names. From app_metric_some_count to appMetric.someCount. For legacy monitoring reasons I am unable to rename these metrics.

When attempting to use a CustomMappingSampleBuilder to map these existing names to metric names that align with Prometheus best practices, I am unable to do so because both MappingConfig and GraphiteNamePattern (used within the CustomMappingSampleBuilder) expect via regex a very particular form of metric naming - app_example will not survive validation, but app.example will.

Given that Dropwizard itself does not enforce these metric naming conventions, I'm unsure as to why simpleclient_dropwizard does.

Activity

brian-brazil

brian-brazil commented on Dec 18, 2019

@brian-brazil
Contributor

Would you like to send a PR?

LiamClarkeNZ

LiamClarkeNZ commented on Dec 19, 2019

@LiamClarkeNZ
Author

Hi @brian-brazil,

Yep, I'm intending to, I have a few days free coming up so will put something together then.

Can I ask your opinion before I do, though? I was intending, in order to preserve backwards compatibility for anyone using the existing CustomMappingSampleBuilder, to create class(es) providing similar functionality alongside it, instead of modifying the classes mentioned above directly. How does that sit with you?

Cheers,

Liam Clarke

brian-brazil

brian-brazil commented on Dec 19, 2019

@brian-brazil
Contributor

I'd modify directly, and I'm not even sure how this could break anyone. I'd suggest seeing what the statsd/graphite exporter do here to, as we should be in line with them.

LiamClarkeNZ

LiamClarkeNZ commented on Dec 20, 2019

@LiamClarkeNZ
Author
LiamClarkeNZ

LiamClarkeNZ commented on Dec 24, 2019

@LiamClarkeNZ
Author

PR: #519

peetzen

peetzen commented on Feb 1, 2020

@peetzen

I was running into the exact same problem when writing a dropwizard wrapper bundle.
When trying to map io.dropwizard.jetty.MutableServletContextHandler.*-requests to servlet.requests with a label defined as method: ${0} the validation does not let it pass through due to * not followed by a period.

The whole match pattern validation seem unnecessary, as what matters at the end is the actual metric name.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @brian-brazil@LiamClarkeNZ@peetzen

        Issue actions

          Metric pattern validation in simpleclient_dropwizard is overly strict · Issue #518 · prometheus/client_java