Skip to content

Server Health & Uptime

The ServerTracker collects infrastructure telemetry to help developers diagnose crashes, memory leaks, and performance hitching.

Event Name Category Description
ServerInit server Dispatched when the server starts up, recording JobId, PlaceId, and PlaceVersion.
ServerHeartbeat server Periodic health snapshot dispatched every serverHeartbeatIntervalSeconds (default: 60s).
ServerShutdown server Dispatched during game:BindToClose with final uptime and player stats.
  • Uptime: Calculated accurately with os.clock() from server startup.
  • Memory Consumption: Tracked in megabytes via Stats:GetTotalMemoryUsageMb().
  • Heartbeat FPS: Frame execution rate calculated over 1-second rolling windows to detect server hitching.
  • Concurrent Players: Real-time player count and peak concurrent players (peakPlayerCount).
local uptime = Analytics:GetServerUptimeSeconds()
local health = Analytics:GetServerHealth()
if health then
print(string.format("Server Uptime: %d seconds", uptime))
print(string.format("Memory Usage: %d MB", health.memoryUsageMb))
print(string.format("Server FPS: %d", health.averageHeartbeatFps))
print(string.format("Peak Players: %d", health.peakPlayerCount))
end

You can register middleware to flag memory leaks:

Analytics:Use(function(event)
if event.name == "ServerHeartbeat" and event.data.memoryUsageMb > 1500 then
warn(string.format("[CRITICAL ALERT] Server %s memory exceeds 1500MB!", game.JobId))
end
return event
end)