MeterRegistry IllegalArgumentException

2.3k views Asked by At

I am using MeterReigstry to push metrics to be polled by Prometheus. However when I add dynamic tags, I get the following exception:

java.lang.IllegalArgumentException: Prometheus requires that all meters with the same name have the same set of tag keys. There is already an existing meter named 'execution_time_seconds' containing tag keys [a, e, b, c, d]. The meter you are attempting to register has keys [a, b, c, d, f].

What is causing this? How can it be resolved? I am using

<dependency> 
<groupId>io.micrometer</groupId> 
<artifactId>micrometer-spring-legacy</artifactId> 
<version>1.3.2</version> 
</dependency>
1

There are 1 answers

1
Michael McFadyen On

I believe this is a limitation from the underlying prometheus client. All measurements of a single metrics must have the same set of tags present.

https://github.com/micrometer-metrics/micrometer/issues/877#issuecomment-425102772

The solution would be to ensure that all measurements of that metric contain the same set of tags. If this is not an option then you may to look at using a different metrics backend.