mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-25 06:02:49 +00:00
feat(dashboard): track the UGC server like auth and chat
Online state with the time it came up, down/up alerts, a UGC column in the health history, /api/servers (every server with its process memory and CPU) and /api/servers/ugc, and UGC gauges for Prometheus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -47,7 +47,13 @@ namespace {
|
||||
bool g_Started = false;
|
||||
|
||||
uint32_t g_LastBugReportId = 0;
|
||||
std::optional<std::pair<bool, bool>> g_LastServerStatus;
|
||||
struct LastServerStatus {
|
||||
bool auth{};
|
||||
bool chat{};
|
||||
bool ugcEnabled{};
|
||||
bool ugc{};
|
||||
};
|
||||
std::optional<LastServerStatus> g_LastServerStatus;
|
||||
|
||||
size_t Discard(char*, size_t size, size_t count, void*) { return size * count; }
|
||||
|
||||
@@ -287,21 +293,26 @@ namespace Alerts {
|
||||
"/accounts/" + std::to_string(accountId));
|
||||
}
|
||||
|
||||
void ServerStatus(bool authOnline, bool chatOnline) {
|
||||
const std::pair<bool, bool> current{ authOnline, chatOnline };
|
||||
void ServerStatus(bool authOnline, bool chatOnline, bool ugcEnabled, bool ugcOnline) {
|
||||
const LastServerStatus current{ authOnline, chatOnline, ugcEnabled, ugcOnline };
|
||||
if (!g_LastServerStatus) {
|
||||
g_LastServerStatus = current;
|
||||
return;
|
||||
}
|
||||
const auto previous = *g_LastServerStatus;
|
||||
g_LastServerStatus = current;
|
||||
if (previous.first != authOnline) {
|
||||
if (previous.auth != authOnline) {
|
||||
Emit("server", authOnline ? "Auth server is back" : "Auth server went offline",
|
||||
authOnline ? "Players can log in again." : "Players cannot log in until it is back.", {}, "/");
|
||||
}
|
||||
if (previous.second != chatOnline) {
|
||||
if (previous.chat != chatOnline) {
|
||||
Emit("server", chatOnline ? "Chat server is back" : "Chat server went offline",
|
||||
chatOnline ? "Chat, friends and teams work again." : "Chat, friends and teams are unavailable.", {}, "/");
|
||||
}
|
||||
// Turning enable_ugc_server on or off is not an outage
|
||||
if (previous.ugcEnabled && ugcEnabled && previous.ugc != ugcOnline) {
|
||||
Emit("server", ugcOnline ? "UGC server is back" : "UGC server went offline",
|
||||
ugcOnline ? "Player models' meshes and icons are made and downloaded again." : "Game clients cannot download player models' meshes and icons until it is back.", {}, "/ugc");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,6 @@ namespace Alerts {
|
||||
// Bans and mutes done in game with slash commands
|
||||
void InGameAccountAction(const std::string& action, uint32_t accountId);
|
||||
|
||||
// Auth/chat availability changes (first call only records the state)
|
||||
void ServerStatus(bool authOnline, bool chatOnline);
|
||||
// Auth/chat/UGC availability changes (first call only records the state); the UGC server only while it is enabled
|
||||
void ServerStatus(bool authOnline, bool chatOnline, bool ugcEnabled = false, bool ugcOnline = false);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace WebhookFormat {
|
||||
{ "moderation", "Bans, locks, mutes, kicks and restrictions, from the dashboard or in game" },
|
||||
{ "security", "GM level changes, two-factor login changes, API tokens, recovery code use" },
|
||||
{ "economy_flag", "The nightly checks flagged unusual income, an item spike or a duplicated item" },
|
||||
{ "server", "Auth or chat went offline or came back, restarts scheduled or cancelled" },
|
||||
{ "server", "Auth, chat or the UGC server went offline or came back, restarts scheduled or cancelled" },
|
||||
{ "test", "Test messages sent from the webhooks page" },
|
||||
};
|
||||
return events;
|
||||
|
||||
Reference in New Issue
Block a user