diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-21 07:15:35 -0400 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-21 07:15:35 -0400 |
commit | d25f418fac72d72de36fe0f1451e39e373ba8baf (patch) | |
tree | 1043973632809e7f917128c90514ef0bf4a7299f /pkg/api | |
parent | d2d0ee5e2755881de96963f29f21784d2f02fdb1 (diff) | |
download | Atlas-d25f418fac72d72de36fe0f1451e39e373ba8baf.tar.gz Atlas-d25f418fac72d72de36fe0f1451e39e373ba8baf.zip |
pkg/api/api0: Add serverlist metric for full servers
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/api0/serverlist.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/api/api0/serverlist.go b/pkg/api/api0/serverlist.go index fc9b019..e486792 100644 --- a/pkg/api/api0/serverlist.go +++ b/pkg/api/api0/serverlist.go @@ -395,7 +395,7 @@ func (s *ServerList) GetMetrics() []byte { mpls = append(mpls, mpl{m, nstypes.Playlist("")}) } - var players, maxPlayers, servers, serversWithPlayers int + var players, maxPlayers, servers, serversWithPlayers, fullServers int mplPlayers := make(map[mpl]int, len(mpls)) mplMaxPlayers := make(map[mpl]int, len(mpls)) mplServers := make(map[mpl]int, len(mpls)) @@ -419,6 +419,9 @@ func (s *ServerList) GetMetrics() []byte { if srv.PlayerCount > 0 { serversWithPlayers++ } + if srv.PlayerCount == srv.MaxPlayers { + fullServers++ + } mplPlayers[mplv] += srv.PlayerCount mplMaxPlayers[mplv] += srv.MaxPlayers mplServers[mplv]++ @@ -575,6 +578,9 @@ func (s *ServerList) GetMetrics() []byte { b.WriteString(`atlas_api0sl_serverswithplayers `) b.WriteString(strconv.Itoa(serversWithPlayers)) b.WriteByte('\n') + b.WriteString(`atlas_api0sl_fullservers `) + b.WriteString(strconv.Itoa(fullServers)) + b.WriteByte('\n') return b.Bytes() } |