automc ui: per-route active connection counts + total in header
Pulls mc_router_active_connections + mc_router_server_active_connections from the Prometheus default registry on every /api/routes call. UI gains an Active column on the routes table and the header subtitle shows "N routes · M active conn". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,7 @@
|
||||
<tr>
|
||||
<th>Server address (host)</th>
|
||||
<th>Backend</th>
|
||||
<th style="text-align:right;">Active</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="route-rows"></tbody>
|
||||
@@ -106,11 +107,14 @@ async function refreshRoutes() {
|
||||
count.textContent = '(' + j.routes.length + ')';
|
||||
for (const r of j.routes) {
|
||||
const tr = document.createElement('tr');
|
||||
tr.innerHTML = '<td>' + r.server_address + '</td><td>' + r.backend + '</td>';
|
||||
tr.innerHTML = '<td>' + r.server_address + '</td>' +
|
||||
'<td>' + r.backend + '</td>' +
|
||||
'<td style="text-align:right;font-variant-numeric:tabular-nums;">' + r.active_connections + '</td>';
|
||||
rows.appendChild(tr);
|
||||
}
|
||||
}
|
||||
document.getElementById('meta').textContent = '— ' + j.routes.length + ' routes';
|
||||
document.getElementById('meta').textContent =
|
||||
'— ' + j.routes.length + ' routes · ' + (j.total_connections || 0) + ' active conn';
|
||||
} catch (e) {
|
||||
document.getElementById('meta').textContent = '— api error';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user