Cache hit logging in detail


From what I have understood, druid only provides cache metrics at server level, like hits, misses etc.
I wanted to have the metrics at query level, things like which query has hit cache, which has not etc.

One way I thought was to correlate the timestamp of query with the cache hit/miss metric but this will only give possible data, it obviously wont be reliable.
Is there any way to get this data or is it not supported at the moment ?

Thanks for your help and take care !

Welcome @Harshit! Can’t you emit query metrics?

Hi, thanks for the reply.

We do emit query metrics. They obviously are an important part of our monitoring system.

From what I understand, you can tell a query to use a cache or not using the useCache field in context. However, with useCache true, you cant be certain that your query used the cache and benefitted from it since that will depend on the actual data you have in cache.

The issue is that I couldn’t find any metric in official docs that tells whether the query result was served from cache or from local storage. I was wondering if it’s possible to know this or not.


Hi Harshit,
Unfortunately, queryID is not emitted as part of cache metrics. You can get the overall picture of cache hit and miss for that moment from the metrics.