Skip to content

MapperConfig does not allow : in regex #645

@muuki88

Description

@muuki88

Hi,

Thanks for the custom mapper config on the dropwizard export. It makes creating tags really easy ❤️

I found a restriction in the regex that makes it impossible for me to create a certain configuration. : are not allowed and we have metrics that contain ip:port in the metric name.

static final String METRIC_GLOB_REGEX = "^(\\*\\.|" + METRIC_PART_REGEX + "\\.)+(\\*|" + METRIC_PART_REGEX + ")$";

This is what the mapper config would look like

// this port is dynamically set from the outside
final int httpPort = 8080
final MapperConfig vertxServerHttp = new MapperConfig(
     // the IP address is always 0.0.0.0
    "vertx.http.servers.0.0.0.0:" + httpPort + ".*", "vertx.http.servers.${4}",
     ImmutableMap.of("endpoint", "http")
);

So the metric currentely ends up like this in prometheus

vertx_http_servers_0_0_0_0:8080_metric

which gets messy as ports change.

Suggestion

Add : to the global regex.

I don't know what implications this would have

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions