-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
CaffeineCache metrics are doubled #40042
Comments
/cc @ebullient (metrics), @gwenneg (cache), @jmartisk (metrics) |
Thanks for reporting! This indeed seems weird... @gwenneg do you remember why our code is also manually recording stastistics? |
those are not doubles.
One is hit, and one is miss. Two separate time series because the result value is different. |
This is the problem AFAIU - that the miss is double counted not that there are 2 entries |
I totally missed that you meant the value, not the series. 🤦♀️ |
I made the same mistake initially! |
I don't, but I'll take a look at this tomorrow. There's an integration that checks metrics IIRC. This should have been caught, or maybe that test coverage isn't good enough. |
There is indeed a bug and the integration test didn't cover it. I'll submit a PR to fix both of them shortly. |
Metrics are manually updated here and it's fine because the Caffeine cache is used as a Lines 165 to 183 in 25dac45
On the other hand, this method (which was added more recently) relies on the Caffeine cache impl including the logic about metrics, so we should have never modified the metrics manually from the extension in that case: Lines 126 to 153 in 25dac45
|
Describe the bug
Hey Quarkus team,
we are using Quarkus' cache and Micrometer extensions.
We realized that our cache metrics are doubled.
In the example above, we expected 1 cache miss instead.
We inject the cache, access it as
CaffeineCache
and use itsgetIfPresent
method.We investigated the issue a bit and think that
CaffeineCacheImpl
is counting hits/misses while the underlayingAsyncCache
is counting as well and both use the sameStatsCounter
.https://github.com/quarkusio/quarkus/blob/main/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/caffeine/CaffeineCacheImpl.java
Expected behavior
1 cache hit/miss is only reported once in metrics.
Actual behavior
1 cache hit/miss is reported twice in metrics.
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
21
Quarkus version or git rev
3.9.2
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.6
Additional information
No response
The text was updated successfully, but these errors were encountered: