Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MapperConfig Names need to be unique after updating from simpleclient to metrics #1712

Open
@YellowFlora

Description

Hello,

we are currently finally updating our library away from io.prometheus:simpleclient to io.prometheus:prometheus-metrics-core.
We are using prometheus in a dropwizard library.

For this reason we configured MapperConfigs to harmonize some names.

MapperConfig mapperConfig = new MapperConfig();
mapperConfig.setMatch("org.eclipse.jetty.util.thread.*.*.jobs");
mapperConfig.setName("jetty_util_thread_jobs_count");
mapperConfig.setLabels(Map.of("type", "${0}", "pool", "${1}"));
mappers.add(mapperConfig);

Our problem now is, that our old MapperConfigs not work any longer. We always get the error, that the name needs to be unique.

org.eclipse.jetty.ee10.servlet.ServletChannel: /metrics/prometheus
! java.lang.IllegalArgumentException: jetty_util_thread_jobs_count: duplicate metric name
! at io.prometheus.metrics.model.snapshots.MetricSnapshots.<init>(MetricSnapshots.java:45)
! at io.prometheus.metrics.model.snapshots.MetricSnapshots$Builder.build(MetricSnapshots.java:99)
! at io.prometheus.metrics.instrumentation.dropwizard.DropwizardExports.collect(DropwizardExports.java:223)
! at io.prometheus.metrics.model.registry.MultiCollector.collect(MultiCollector.java:22)
! at io.prometheus.metrics.model.registry.PrometheusRegistry.scrape(PrometheusRegistry.java:85)

Changing the config to

MapperConfig mapperConfig = new MapperConfig();
mapperConfig.setMatch("org.eclipse.jetty.util.thread.*.*.jobs");
mapperConfig.setName("jetty_util_thread_${1}_jobs_count");
mapperConfig.setLabels(Map.of("type", "${0}", "pool", "${1}"));
mappers.add(mapperConfig);

would work, but we would like to avoid that we and our customers have to change all their dashboards.

Is that the desired behavior? That every name has to be unique and not the combination of name and labels?
Are there possibilities to still have the old metrics names as output, so that we don't have change the dashboards?

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

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /