fix: include recursive and coalesced queries in cache hit rate denominator

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 is contained in:
Razvan Dimescu
2026-03-30 00:02:29 +03:00
parent 2b99b39bcc
commit bb74466b6d

View File

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