You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was trying to use go-cache as a backend cache for a cache with prometheus metrics. I expose the prometheus metrics via http localhost:8080/metrics but this endpoint returns empty response, i.e. no metrics.
After inspecting the code I found that gocacheStore doesn't implement the SetterCacheInterface interface, which causes switch...case... miss defined in the function below
It seems that goCacheStore object implements the StoreInterface interface while NewMetric takes a CacheInterface, but StoreInferface happens to implement CacheInterface, therefore the compiler is happy with it but in fact it is wrong in terms of program logic. I wonder if we can separate these two interfaces in case people run into issues like this again?
Apologies that I don't have Chinese input on this computer. I appreciate your help!
Hi, I was trying to use
go-cache
as a backend cache for a cache with prometheus metrics. I expose the prometheus metrics via httplocalhost:8080/metrics
but this endpoint returns empty response, i.e. no metrics.Steps for Reproduction
After inspecting the code I found that
gocacheStore
doesn't implement theSetterCacheInterface
interface, which causesswitch...case...
miss defined in the function belowgocache/lib/cache/metric.go
Lines 63 to 73 in 96fc2f7
Expected behavior: metrics should be updated and collected by the prometheus registry
Actual behavior: no metrics collected
Platforms:
Go: 1.20
Linux: 3.10.0-1160.105.1.el7.x86_64
Versions:
github.com/eko/gocache/lib/v4 v4.1.5
github.com/eko/gocache/store/go_cache/v4 v4.2.1
If fixing this issue will be on the roadmap, I can help contribute. Thanks!
The text was updated successfully, but these errors were encountered: