From 03f43d6c5bf45e0c6089fbc1b5e7bbae6fbca168 Mon Sep 17 00:00:00 2001 From: David Mora Date: Sun, 29 May 2022 12:35:06 -0400 Subject: [PATCH] Fix for Unbound Stats: zero_ttl is no longer a valid statistic (#5793) * Update Unbound Stats to fix zero_ttl name and add additional stats * Unbound stats - change to custom sort order --- .../mvc/app/views/OPNsense/Unbound/stats.volt | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/opnsense/mvc/app/views/OPNsense/Unbound/stats.volt b/src/opnsense/mvc/app/views/OPNsense/Unbound/stats.volt index 4b8067e17..2f45b1f41 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Unbound/stats.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Unbound/stats.volt @@ -40,9 +40,19 @@ 'recursivereplies': "{{ lang._('Recursive replies') }}", 'cachemiss': "{{ lang._('Cache misses') }}", 'cachehits': "{{ lang._('Cache hits') }}", - 'zero_ttl': "{{ lang._('Zero TTL') }}", + 'expired': "{{ lang._('Serve expired') }}", 'prefetch': "{{ lang._('Prefetch') }}", 'queries': "{{ lang._('Queries') }}", + }, + 'requestlist': { + 'avg': "{{ lang._('Request queue avg') }}", + 'max': "{{ lang._('Request queue max') }}", + 'overwritten': "{{ lang._('Request queue overwritten') }}", + 'exceeded': "{{ lang._('Request queue exceeded') }}", + 'current': { + 'all': "{{ lang._('Request queue size (all)') }}", + 'user': "{{ lang._('Request queue size (client)') }}" + } } }; @@ -81,9 +91,16 @@ let statsView = $("#statsView"); statsView.html(''); - // Sort the keys in order to ensure that Thread 0 will come before Thread 1. + // Sort the keys - ensure total and time is listed first. let dataKeys = Object.keys(data['data']); - dataKeys.sort(); + let sortOrder = ['total', 'time']; + + dataKeys.sort(function(a, b) { + var indA = sortOrder.indexOf(a); + var indB = sortOrder.indexOf(b); + return (indA > -1 ? indA : 999) - (indB > -1 ? indB : 999); + }); + dataKeys.forEach(function(key) { let value = data['data'][key]; if (key === 'total' || key.substr(0, 6) === 'thread') {