I’d like to measure the cache hit rate of our services. We’re using SpringBoot with NewRelic. In the code we have to following:
For a cache hit
For a cache miss
The Java metric API does not allow any additional attributes. Now I’d like to calculate the cache hit rate in NewRelic but I don’t know how I can combine the two values.
The following query allows me to query one of the values. Since it’s a metric I have to use this “strange” format newrelic.timeslice.value.
SELECT count(newrelic.timeslice.value) as Miss FROM Metric WHERE metricTimesliceName = 'cacheHit' SINCE 24 HOURS AGO TIMESERIES SELECT count(newrelic.timeslice.value) as Hit FROM Metric WHERE metricTimesliceName = 'cacheMiss' SINCE 24 HOURS AGO TIMESERIES
We can’t use the NewRelic default integration for this cache. I could easily solve this by using events but that would create a lot of unnecessary events.