mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-07 21:58:06 -05:00
Add instance uptime to API info response
This update includes the instance uptime in the API info response.
This commit is contained in:
parent
a1a69242f7
commit
0a8bbf2997
@ -10,6 +10,7 @@ public class InfoResponse
|
||||
public MetricSnapshot<int> TotalRecentClients { get; set; }
|
||||
|
||||
public MetricSnapshot<int?> MaxConcurrentClients { get; set; }
|
||||
public TimeSpan Uptime { get; set; }
|
||||
}
|
||||
|
||||
public class MetricSnapshot<T>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -30,6 +31,7 @@ public class Info : BaseController
|
||||
var (totalClients, totalRecentClients) =
|
||||
await _serverDataViewer.ClientCountsAsync(duration, game, token);
|
||||
var (maxConcurrent, maxConcurrentTime) = await _serverDataViewer.MaxConcurrentClientsAsync(overPeriod: duration, token: token);
|
||||
var uptime = DateTime.Now - Process.GetCurrentProcess().StartTime;
|
||||
var response = new InfoResponse
|
||||
{
|
||||
TotalTrackedClients = totalClients,
|
||||
@ -46,7 +48,8 @@ public class Info : BaseController
|
||||
Value = totalRecentClients,
|
||||
EndAt = DateTime.UtcNow,
|
||||
StartAt = DateTime.UtcNow - duration
|
||||
}
|
||||
},
|
||||
Uptime = uptime,
|
||||
};
|
||||
|
||||
return Json(response);
|
||||
|
Loading…
x
Reference in New Issue
Block a user