Search in sources :

Example 1 with EzyFeature

use of com.tvd12.ezyfox.annotation.EzyFeature in project ezyhttp by youngmonkeys.

the class MetricsController method threadsGet.

@EzyFeature(DEFAULT_FEATURE_NAME)
@DoGet("/management/thread-count")
public ThreadCountPoint threadsGet() {
    EzyThreadsMonitor threadsMonitor = SystemMonitor.getInstance().getThreadsMonitor();
    int threadCount = threadsMonitor.getThreadCount();
    int daemonThreadCount = threadsMonitor.getDaemonThreadCount();
    return ThreadCountPoint.builder().threadCount(threadCount).daemonThreadCount(daemonThreadCount).build();
}
Also used : EzyThreadsMonitor(com.tvd12.ezyfox.monitor.EzyThreadsMonitor) ThreadCountPoint(com.tvd12.ezyhttp.server.management.data.ThreadCountPoint) MemoryPoint(com.tvd12.ezyhttp.server.management.data.MemoryPoint) CpuPoint(com.tvd12.ezyhttp.server.management.data.CpuPoint) EzyFeature(com.tvd12.ezyfox.annotation.EzyFeature) DoGet(com.tvd12.ezyhttp.server.core.annotation.DoGet)

Example 2 with EzyFeature

use of com.tvd12.ezyfox.annotation.EzyFeature in project ezyhttp by youngmonkeys.

the class MetricsController method cpuUsageGet.

@EzyFeature(DEFAULT_FEATURE_NAME)
@DoGet("/management/cpu-usage")
public CpuPoint cpuUsageGet() {
    SystemMonitor monitor = SystemMonitor.getInstance();
    EzyGcMonitor gcMonitor = monitor.getGcMonitor();
    EzyCpuMonitor cpuMonitor = monitor.getCpuMonitor();
    return CpuPoint.builder().systemCpuLoad(cpuMonitor.getSystemCpuLoad()).processCpuLoad(cpuMonitor.getProcessCpuLoad()).processGcActivity(gcMonitor.getProcessGcActivity()).build();
}
Also used : SystemMonitor(com.tvd12.ezyhttp.server.management.monitor.SystemMonitor) EzyGcMonitor(com.tvd12.ezyfox.monitor.EzyGcMonitor) EzyCpuMonitor(com.tvd12.ezyfox.monitor.EzyCpuMonitor) EzyFeature(com.tvd12.ezyfox.annotation.EzyFeature) DoGet(com.tvd12.ezyhttp.server.core.annotation.DoGet)

Aggregations

EzyFeature (com.tvd12.ezyfox.annotation.EzyFeature)2 DoGet (com.tvd12.ezyhttp.server.core.annotation.DoGet)2 EzyCpuMonitor (com.tvd12.ezyfox.monitor.EzyCpuMonitor)1 EzyGcMonitor (com.tvd12.ezyfox.monitor.EzyGcMonitor)1 EzyThreadsMonitor (com.tvd12.ezyfox.monitor.EzyThreadsMonitor)1 CpuPoint (com.tvd12.ezyhttp.server.management.data.CpuPoint)1 MemoryPoint (com.tvd12.ezyhttp.server.management.data.MemoryPoint)1 ThreadCountPoint (com.tvd12.ezyhttp.server.management.data.ThreadCountPoint)1 SystemMonitor (com.tvd12.ezyhttp.server.management.monitor.SystemMonitor)1