summaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/metrics/dashboard.html26
1 files changed, 22 insertions, 4 deletions
diff --git a/internal/metrics/dashboard.html b/internal/metrics/dashboard.html
index b7be1d7..5324c1e 100644
--- a/internal/metrics/dashboard.html
+++ b/internal/metrics/dashboard.html
@@ -172,8 +172,12 @@
172 <span class="metric-value" id="auth_success">0</span> 172 <span class="metric-value" id="auth_success">0</span>
173 </div> 173 </div>
174 <div class="metric"> 174 <div class="metric">
175 <span class="metric-label">Authorized</span> 175 <span class="metric-label">Auth Writes</span>
176 <span class="metric-value" id="auth_authorized">0</span> 176 <span class="metric-value" id="auth_writes">0</span>
177 </div>
178 <div class="metric">
179 <span class="metric-label">Auth Reads</span>
180 <span class="metric-value" id="auth_reads">0</span>
177 </div> 181 </div>
178 <div class="metric"> 182 <div class="metric">
179 <span class="metric-label">Unauthorized</span> 183 <span class="metric-label">Unauthorized</span>
@@ -263,6 +267,17 @@
263 return metric ? metric.value : 0; 267 return metric ? metric.value : 0;
264 } 268 }
265 269
270 function getMetricByLabels(metrics, name, labels) {
271 if (!metrics[name]) return 0;
272 const metric = metrics[name].find(m => {
273 for (const [key, value] of Object.entries(labels)) {
274 if (m.labels[key] !== value) return false;
275 }
276 return true;
277 });
278 return metric ? metric.value : 0;
279 }
280
266 function formatUptime(ms) { 281 function formatUptime(ms) {
267 const seconds = Math.floor(ms / 1000); 282 const seconds = Math.floor(ms / 1000);
268 const minutes = Math.floor(seconds / 60); 283 const minutes = Math.floor(seconds / 60);
@@ -313,8 +328,11 @@
313 document.getElementById('auth_success').textContent = 328 document.getElementById('auth_success').textContent =
314 getMetricByLabel(metrics, `${prefix}_relay_auth_attempts_total`, 'result', 'success'); 329 getMetricByLabel(metrics, `${prefix}_relay_auth_attempts_total`, 'result', 'success');
315 330
316 document.getElementById('auth_authorized').textContent = 331 document.getElementById('auth_writes').textContent =
317 getMetricByLabel(metrics, `${prefix}_relay_requests_total`, 'status', 'authorized'); 332 getMetricByLabels(metrics, `${prefix}_relay_requests_total`, {method: 'EVENT', status: 'authorized'});
333
334 document.getElementById('auth_reads').textContent =
335 getMetricByLabels(metrics, `${prefix}_relay_requests_total`, {method: 'REQ', status: 'authorized'});
318 336
319 document.getElementById('auth_unauthorized').textContent = 337 document.getElementById('auth_unauthorized').textContent =
320 getMetricByLabel(metrics, `${prefix}_relay_requests_total`, 'status', 'unauthorized'); 338 getMetricByLabel(metrics, `${prefix}_relay_requests_total`, 'status', 'unauthorized');