prometheus / prometheus/client_java
Issue when using @Timed annotation with prometheus-metrics-instrumentation-dropwizard
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 833
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 86
Description
@Timed annotation, which can be annotated on the methods generates dropwizard metrics with .total as a suffix.
This is not compatible with prometheus-metrics-instrumentation-dropwizard to export dropwizard metrics.
Since the io.prometheus.metrics.instrumentation.dropwizard.DropwizardExports class has a method fromSnapshotAndCount which sanitizes the metric name withPrometheusNaming.sanitizeMetricName(dropwizardName).
As a result it causes duplicate metric name exception when prometheus endpoint is invoked.
Original reference here:
https://github.com/dropwizard/dropwizard/issues/10030 #
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with io.prometheus.metrics.instrumentation.dropwizard.DropwizardExports, especially fromSnapshotAndCount and its call to sanitizeMetricName. Reproduce the duplicate metric name exception by exporting metrics from a method annotated with @Timed and invoking the Prometheus endpoint. Done means Dropwizard metrics with the .total suffix export without duplicate-name errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, prometheus
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100