feat(dashboard): Diagnostics page with live traffic of every server

Keeps every server's traffic reports (last hour at one second, per-minute
rows to server_traffic once a minute, pruned after traffic_days) and shows
packets, bytes, HTTP requests and latency per second, per server, with the
busiest message types and HTTP routes. Live over the traffic WebSocket topic;
1 hour, 24 hours and 7 days ranges. The same counters are in /metrics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-27 08:50:54 -05:00
parent 01d10f4401
commit e6148a4021
18 changed files with 1292 additions and 4 deletions

View File

@@ -84,6 +84,8 @@
#include "InstanceLoad.h"
#include "WorldView.h"
#include "PrometheusMetrics.h"
#include "Traffic.h"
#include "master/ServerTraffic.h"
#include "Background.h"
#include "master/DashboardMessages.h"
#include "master/DataChanged.h"
@@ -322,6 +324,7 @@ namespace {
handlers.On<DataChanged>(Master::DATA_CHANGED, [](const DataChanged& changed, const SystemAddress&) { BroadcastDataChanged(changed); });
handlers.On<PlayerActionResult>(Master::PLAYER_ACTION_RESULT, [](const PlayerActionResult& result, const SystemAddress&) { PlayerActions::HandleResult(result); });
handlers.On<MasterPackets::WorldShutDown>(Master::SHUTDOWN_RESPONSE, OnWorldShutDown);
handlers.On<ServerTraffic>(Master::SERVER_TRAFFIC, [](const ServerTraffic& report, const SystemAddress&) { Traffic::Ingest(report); });
return handlers;
}();
return handlers;
@@ -524,6 +527,7 @@ int main(int argc, char** argv) {
WorldView::RegisterRoutes();
Scenery::RegisterRoutes();
PrometheusMetrics::RegisterRoutes();
Traffic::RegisterRoutes();
RegisterPublicRoutes();
RegisterShowcaseRoutes();
FeaturedProperties::RegisterRoutes();
@@ -582,6 +586,7 @@ int main(int argc, char** argv) {
LiveEventRoutes::Update();
ChallengeRoutes::Update();
InstanceLoad::Update();
Traffic::Update();
// Broadcast dashboard updates periodically
if (elapsedSinceBroadcast >= broadcastInterval) {