diff --git a/Content.Server/EntryPoint.cs b/Content.Server/EntryPoint.cs index 885405dc93..cdfabcd4ee 100644 --- a/Content.Server/EntryPoint.cs +++ b/Content.Server/EntryPoint.cs @@ -92,11 +92,11 @@ namespace Content.Server { base.Update(level, frameEventArgs); - _gameTicker.Update(frameEventArgs); switch (level) { case ModUpdateLevel.PreEngine: { + _gameTicker.Update(frameEventArgs); IoCManager.Resolve().Update(frameEventArgs); break; } diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 78f5b7ab3e..1bee0eab26 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -21,6 +21,7 @@ using Content.Shared.Chat; using Content.Shared.GameObjects.Components.PDA; using Content.Shared.Jobs; using Content.Shared.Preferences; +using Prometheus; using Robust.Server.Interfaces; using Robust.Server.Interfaces.Maps; using Robust.Server.Interfaces.Player; @@ -53,6 +54,14 @@ namespace Content.Server.GameTicking { public partial class GameTicker : SharedGameTicker, IGameTicker { + private static readonly Counter RoundNumberMetric = Metrics.CreateCounter( + "ss14_round_number", + "Round number."); + + private static readonly Gauge RoundLengthMetric = Metrics.CreateGauge( + "ss14_round_length", + "Round length in seconds."); + private static readonly TimeSpan UpdateRestartDelay = TimeSpan.FromSeconds(20); private const string PlayerPrototypeName = "HumanMob_Content"; @@ -141,6 +150,11 @@ namespace Content.Server.GameTicking public void Update(FrameEventArgs frameEventArgs) { + if (RunLevel == GameRunLevel.InRound) + { + RoundLengthMetric.Inc(frameEventArgs.DeltaSeconds); + } + if (RunLevel != GameRunLevel.PreRoundLobby || _roundStartTimeUtc > DateTime.UtcNow || _roundStartCountdownHasNotStartedYetDueToNoPlayers) return; @@ -161,6 +175,8 @@ namespace Content.Server.GameTicking SendServerMessage("Restarting round..."); + RoundNumberMetric.Inc(); + RunLevel = GameRunLevel.PreRoundLobby; _resettingCleanup(); _preRoundSetup(); @@ -199,6 +215,8 @@ namespace Content.Server.GameTicking RunLevel = GameRunLevel.InRound; + RoundLengthMetric.Set(0); + // Get the profiles for each player for easier lookup. var profiles = readyPlayers.ToDictionary(p => p, GetPlayerProfile);