kamon-io / Kamon

Distributed Tracing, Metrics and Context Propagation for applications running on the JVM
https://kamon.io
Other
1.4k stars 327 forks source link

Issue with Caffeine integration #1272

Open Yomanz opened 1 year ago

Yomanz commented 1 year ago
WARNING: Exception thrown by stats counter
java.lang.IllegalAccessError: class kamon.instrumentation.caffeine.KamonStatsCounter tried to access private method 'void com.github.benmanes.caffeine.cache.stats.CacheStats.<init>(long, long, long, long, long, long, long)' (kamon.instrumentation.caffeine.KamonStatsCounter and com.github.benmanes.caffeine.cache.stats.CacheStats are in unnamed module of loader 'app')
    at kamon.instrumentation.caffeine.KamonStatsCounter.snapshot(KamonStatsCounter.scala:46)
    at com.github.benmanes.caffeine.cache.stats.GuardedStatsCounter.snapshot(GuardedStatsCounter.java:90)
    at com.github.benmanes.caffeine.cache.LocalAsyncCache$AbstractCacheView.stats(LocalAsyncCache.java:569)

image (Image of the private method)

I am getting this exception thrown when using kamon and caffeine together, specifically I am using Akka HTTP Prometheus metrics package which seems to be automatically hooked into by kamon.

I can provide any extra additional information as required

ivantopo commented 1 year ago

Hey @Yomanz, can you please share what exact Kamon/Caffeine/Java versions are you using here? Thanks!

Yomanz commented 1 year ago

Hey @Yomanz, can you please share what exact Kamon/Caffeine/Java versions are you using here? Thanks!

Absolutely!

Java: Corretto 17 (Scala 2.13.7) Kamon: 2.6.0 Caffeine: 3.1.1 (Scaffeine 5.2.1)

Yomanz commented 1 year ago

@ivantopo I've just noticed that Kamon doesn't monitor async caffeine caches, is there a specific reason for this?

Yomanz commented 1 year ago

Hi @ivantopo, are there any updates here? I can always take a peek at fixing it.