Re-organised statistic endpoints and services/helpers
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MoonlightServers.Daemon.Helpers;
|
||||
using MoonlightServers.DaemonShared.Http.Responses.Statistics;
|
||||
|
||||
namespace MoonlightServers.Daemon.Http.Controllers.Statistics;
|
||||
|
||||
// This controller hosts endpoints for the statistics for the daemon application itself
|
||||
|
||||
[ApiController]
|
||||
[Route("api/statistics/application")]
|
||||
public class StatisticsApplicationController : Controller
|
||||
{
|
||||
private readonly OwnProcessHelper ProcessHelper;
|
||||
|
||||
public StatisticsApplicationController(OwnProcessHelper processHelper)
|
||||
{
|
||||
ProcessHelper = processHelper;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<StatisticsApplicationResponse> Get()
|
||||
{
|
||||
return new StatisticsApplicationResponse()
|
||||
{
|
||||
Uptime = ProcessHelper.GetUptime(),
|
||||
MemoryUsage = ProcessHelper.GetMemoryUsage(),
|
||||
CpuUsage = ProcessHelper.CpuUsage()
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user