Closed jensbaitingerbosch closed 2 weeks ago
This might be caused by the differences between https://github.com/micrometer-metrics/micrometer/blob/23b6c43d9ce7a758dd5aa4620c776358f3a86039/implementations/micrometer-registry-prometheus/src/main/java/io/micrometer/prometheusmetrics/PrometheusMeterRegistry.java#L252 and https://github.com/micrometer-metrics/micrometer/blob/23b6c43d9ce7a758dd5aa4620c776358f3a86039/implementations/micrometer-registry-prometheus/src/main/java/io/micrometer/prometheusmetrics/PrometheusMeterRegistry.java#L279, where a HistogramSnapshot
is returned or a SummaryDataPointSnapshot
depending if the histogram is enabled. Therefor this bug might also occur for other DistributionSummaries not only Timers
Thank you for the issue and extra thanks for the minimal Java reproducer! I think this is a duplicate of https://github.com/micrometer-metrics/micrometer/issues/5150 so let me close it and continue the discussion there, please let us know if you disagree and we can reopen.
Describe the bug
When there are 2 Timers with the same name but different tag set, one with enabled histogram, the other without and you scape the metrics using the
PrometheusTextFormatWriter
(as the Spring Actuator Endpoint does), the following classcastexception is thrown:Environment
To Reproduce How to reproduce the bug:
Expected behavior it produces a valid output to that can be parsed by prometheus like:
Additional context Add any other context about the problem here, e.g. related issues.