Add Prometheus stats for admin count (#26284)
* Add Prometheus stats for admin count Fixes #20828 Reports time series for admin count. Counts are separated by state (active, AFK, or deadminned) and admin rank. * Use static constructor instead of static readonly for the metric Docs recommend this due to inconsistent execution of C# static constructors. * Remove static usage, use IoC IMeterFactory. --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
cb97abb2de
commit
a1817a12db
@@ -23,7 +23,7 @@ using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Administration.Managers
|
||||
{
|
||||
public sealed class AdminManager : IAdminManager, IPostInjectInit, IConGroupControllerImplementation
|
||||
public sealed partial class AdminManager : IAdminManager, IPostInjectInit, IConGroupControllerImplementation
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IServerDbManager _dbManager = default!;
|
||||
@@ -34,6 +34,7 @@ namespace Content.Server.Administration.Managers
|
||||
[Dependency] private readonly IServerConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IChatManager _chat = default!;
|
||||
[Dependency] private readonly ToolshedManager _toolshed = default!;
|
||||
[Dependency] private readonly ILogManager _logManager = default!;
|
||||
|
||||
private readonly Dictionary<ICommonSession, AdminReg> _admins = new();
|
||||
private readonly HashSet<NetUserId> _promotedPlayers = new();
|
||||
@@ -49,6 +50,8 @@ namespace Content.Server.Administration.Managers
|
||||
private readonly AdminCommandPermissions _commandPermissions = new();
|
||||
private readonly AdminCommandPermissions _toolshedCommandPermissions = new();
|
||||
|
||||
private ISawmill _sawmill = default!;
|
||||
|
||||
public bool IsAdmin(ICommonSession session, bool includeDeAdmin = false)
|
||||
{
|
||||
return GetAdminData(session, includeDeAdmin) != null;
|
||||
@@ -181,6 +184,8 @@ namespace Content.Server.Administration.Managers
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_sawmill = _logManager.GetSawmill("admin");
|
||||
|
||||
_netMgr.RegisterNetMessage<MsgUpdateAdminStatus>();
|
||||
|
||||
// Cache permissions for loaded console commands with the requisite attributes.
|
||||
@@ -234,6 +239,8 @@ namespace Content.Server.Administration.Managers
|
||||
}
|
||||
|
||||
_toolshed.ActivePermissionController = this;
|
||||
|
||||
InitializeMetrics();
|
||||
}
|
||||
|
||||
public void PromoteHost(ICommonSession player)
|
||||
|
||||
Reference in New Issue
Block a user