-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MeterRegistry IllegalArgumentException - Prometheus requires that all meters with the same name have the same set of tag keys #2291
Comments
Hi @jkschneider I read other threads on the same issue, seems like there is no workaround for it yet? Specifically: #877 |
@harshitdx29 The recommended workaround is to provide an empty value for the tag you don't have a value for. In your case make sure to provide a |
@checketts this was just one use case, we may have use cases where we need to send more tags, so what you recommend is to use the subset of tags which we have? |
Also, @checketts any particular reason why we have this limitation? |
@harshitdx29 I seem to recall it was a limitation from the Prometheus client and Micrometer wrapped it so it would provide a more useful error message (displaying the tags for example) It is possible that there were historical reasons. Prometheus 1.x had a different storage mechanism that was less efficient. If you discover that Prometheus itself no longer struggles with this then that would be good to know. Aside from technical limitations, dynamic tags may be indicating 2 potential usage problems: 1) unlimited cardinality (which could cause a metric count/memory explosion) or 2) incorrect counts/promql query issues. Could you take a step back and describe your code/usecase that makes it hard to account for the tags that are being applied? (I'm not trying to push back on your usecase, just trying to understand what is making things so dynamic) |
For now, the use case is only errorCode and status but dynamic tags by nature provide us the flexibility to push any number of metrics. One use case I can think of is when we monitor external clients in our system, in that case, we may need to add another tag
|
I'm sorry I don't have any experience in that regard. Perhaps the Prometheus mailing list would be able to answer that specific question. I'm not able to find any doc supporting this either, aside from https://www.robustperception.io/target-labels-are-for-life-not-just-for-christmas But even that is speaking of the goal to limit target labels, not labels in general. |
Yes I can limit the target labels but somehow not make them fixed set. But seems like we will have to do that. Anyways will do a POC on statsd flow and see if we get same error. |
You also could try pulling out the underlying Prometheus registry that Micrometer is writing to and using it directly. If that works then that would uncover Prometheus client limitations. |
Do you have a demo code for that? |
I can see someone suggesting a change here which seems to work: #877 (comment) |
Call |
ok let me try. |
Currently my code looks like
|
Try something like:
Summary example is here: https://github.com/prometheus/client_java#summary I apologize for not being able to help with the code more. I'll check back on this thread this evening after work. |
I am not sure how this is working. I will probably try out statsd flow and if we face the same flow, will probably stick to fixed set of tags. |
@harshitdx29 Did you successfully implement that work around using Prometheus Registry directly ? Some working code example would be appreciated. |
Hi @cforce I have not tried this. For now restricted the tags to a fixed set. |
Duplicate of #877 |
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 [application, errorCode, execution_identifier, execution_source, goods_code_enum]. The meter you are attempting to register has keys [application, execution_identifier, execution_source, goods_code_enum, status].
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>
The text was updated successfully, but these errors were encountered: