quarkus: Timed annotation not working properly for reactive methods / futures
Describe the bug If you use the Timed annotation on a reactive method, it measures literally the time spent on the method, not the actual execution of the reactive action returned. Same happens with futures.
Expected behavior Either it works or it should be validated so people doesn’t get confusing results.
Actual behavior It calculates the time creating the Uni/Multi/Future, but not the actual execution of the task itself.
To Reproduce
Create a method returning a Uni and annotate it with Timed, when you check the metrics, it does not match the reality.
Configuration N/A
Screenshots N/A
Environment (please complete the following information):
- Output of
uname -aorver: - Output of
java -version: - GraalVM version (if different from Java):
- Quarkus version or git rev: 1.10.x, 1.11.x, 1.12.x (probably all older ones)
- Build tool (ie. output of
mvnw --versionorgradlew --version): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Additional context N/A
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (17 by maintainers)
Commits related to this issue
- Introduce support for Uni return types in Micrometer annotations Fixes: #15601 — committed to geoand/quarkus by geoand 2 years ago
- Introduce support for Uni return types in Micrometer annotations Fixes: #15601 — committed to geoand/quarkus by geoand 2 years ago
- Introduce support for Uni return types in Micrometer annotations Fixes: #15601 — committed to geoand/quarkus by geoand 2 years ago
- Introduce support for Uni return types in Micrometer annotations Fixes: #15601 — committed to geoand/quarkus by geoand 2 years ago
- Merge pull request #22639 from geoand/#15601 Introduce support for Uni return types in Micrometer annotations — committed to quarkusio/quarkus by geoand 2 years ago
https://github.com/quarkusio/quarkus/pull/22639 should take care of it
Yup, just like
@Cachedworks as well.If I have time, I’ll check it out.
Hay, last week we shifted one of our production services from spring webflux to quarkus and we encountered this exact issue which took us by surprise since the FaultTolerance annotations do handle reactive operations nicely. We assumed the Metrics annotation will behave the same. Here is where the FaultTolerance interceptor identifies an “async” flow: https://github.com/smallrye/smallrye-fault-tolerance/blob/9afda4de4360584abc04564a723d68660393ab30/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/FaultToleranceInterceptor.java#L151 I believe the solution should be the same here.