-
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
extraTags is array but key->value #5820
Comments
Thanks for the issue! Could you please tell us:
I think we could improve the javadocs and add this fact to even more places but right now you can see this if you look into the docs: micrometer/micrometer-core/src/main/java/io/micrometer/core/annotation/Counted.java Lines 55 to 61 in c39bda3
micrometer/micrometer-core/src/main/java/io/micrometer/core/instrument/Counter.java Lines 77 to 84 in c39bda3
micrometer/micrometer-core/src/main/java/io/micrometer/core/annotation/Timed.java Lines 46 to 51 in c39bda3
micrometer/micrometer-core/src/main/java/io/micrometer/core/instrument/AbstractTimerBuilder.java Lines 54 to 61 in c39bda3
I think we could add a sentence that the array must have an even number of elements in micrometer/micrometer-core/src/main/java/io/micrometer/core/instrument/Tags.java Lines 362 to 364 in c39bda3
Do you want to open a PR to improve the docs of |
Hi!
First I tried to use single value for tags. It not lead to error or any log, but metric was not presented in actuator. @Timed("batcher", extraTags = ["write"])
I have some work experience with prometheus and I know what the end result looks like, but I just got stuck :)
Half a day is not literally. I tried searching cause in another mechanisms. First I thougt about incorrect using Bean (our code call proxied bean from non-proxied and I spend time to remade it, but it had no effect. Then I thought about incorrect I think it would be a good idea to add a log or fail startup when incorrect items count provided for |
Hmm, no. It's not work, no any exceptions.
|
What was your expectation what should have happened in this case?
Do you have a minimal sample project to reproduce this issue? Or could you please check with a debugger where the exception is swallowed so that we can fix this? In usual setups |
I didn't think about it :)
Yes, I using Timed/Counted aspects. And its has different behavior:
I debugged it and found ignoring: private void record(ProceedingJoinPoint pjp, Timed timed, String metricName, Timer.Sample sample,
String exceptionClass) {
try {
sample.stop(recordBuilder(pjp, timed, metricName, exceptionClass).register(registry));
}
catch (Exception e) {
// ignoring on purpose
}
} Sorry, I can't provide PR becuase I don't know why is it implemented so differently. Maybe it should be globally refactored. |
For Counter/Timer annotation argument
extraTags
defined as array of string, but requires even items becuase it is key->value pair.It's not obvious.
I spet half day before until I saw the documentation.
Then I remembered that I had already encountered this a couple of years ago.
Maybe it's worth adding a warning to log?
The text was updated successfully, but these errors were encountered: