fix: include recursive and coalesced queries in cache hit rate denominator (#24)

The cache hit rate was computed as cached/(cached+forwarded+local+overridden),
excluding recursive and coalesced queries from the denominator. This inflated
the displayed rate (e.g. 57.9%) far above the actual cache proportion (20.9%).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit was merged in pull request #24.
This commit is contained in:
Razvan Dimescu
2026-03-30 00:17:40 +03:00
committed by GitHub
parent 2b99b39bcc
commit f9b503ab96

View File

@@ -945,7 +945,7 @@ async function refresh() {
prevTime = now;
// Cache hit rate
const answered = q.cached + q.forwarded + q.local + q.overridden;
const answered = q.cached + q.forwarded + q.recursive + q.coalesced + q.local + q.overridden;
const hitRate = answered > 0 ? ((q.cached / answered) * 100).toFixed(1) : '0.0';
document.getElementById('cacheRate').textContent = hitRate + '%';