на основе
Eclipse MicroProfile
Стандартизированный мониторинг.
представлять
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-metrics</artifactId>
</dependency>
использовать
@GET
@Timed
public String sayHello() {
// 增加监控,访问 curl -H "Accept: application/json" localhost:8084/metrics/application
return "Hello";
}
пример возврата [приложение]
{
"com.mar.quarkus.LoginResource.sayHello": {
"p99": 44958.0,
"min": 2018.0,
"max": 44958.0,
"mean": 8898.37443067893,
"p50": 2215.0,
"p999": 44958.0,
"stddev": 15575.012891267983,
"p95": 44958.0,
"p98": 44958.0,
"p75": 2420.0,
"fiveMinRate": 0.012836281631061274,
"fifteenMinRate": 0.0050918205447603795,
"meanRate": 0.04830148908156422,
"count": 5,
"oneMinRate": 0.02281809447133983
}
}
остальные варианты
{
"base": {
"gc.total;name=PS MarkSweep": 1,
"cpu.systemLoadAverage": 1.69482421875,
"thread.count": 49,
"classloader.loadedClasses.count": 6151,
"classloader.unloadedClasses.total": 10,
"gc.total;name=PS Scavenge": 4,
"gc.time;name=PS MarkSweep": 48,
"jvm.uptime": 359698,
"thread.max.count": 49,
"memory.committedHeap": 406847488,
"classloader.loadedClasses.total": 6161,
"cpu.availableProcessors": 8,
"gc.time;name=PS Scavenge": 49,
"thread.daemon.count": 6,
"memory.maxHeap": 3817865216,
"cpu.processCpuLoad": 0.0001631160657190026,
"memory.usedHeap": 173959904
},
"vendor": {
"memory.freePhysicalSize": 1574957056,
"memoryPool.usage;name=Metaspace": 31365112,
"memoryPool.usage.max;name=PS Eden Space": 154675280,
"memoryPool.usage;name=PS Eden Space": 0,
"memoryPool.usage.max;name=PS Old Gen": 23120544,
"memoryPool.usage;name=PS Old Gen": 20748816,
"cpu.processCpuTime": 4529599000,
"memory.committedNonHeap": 45219840,
"memoryPool.usage.max;name=PS Survivor Space": 10992112,
"memoryPool.usage.max;name=Compressed Class Space": 4067880,
"memoryPool.usage;name=Code Cache": 7150080,
"memory.freeSwapSize": 1574957056,
"memoryPool.usage.max;name=Metaspace": 31365112,
"cpu.systemCpuLoad": 0.06666179761106426,
"memoryPool.usage.max;name=Code Cache": 7147264,
"memory.usedNonHeap": 42583072,
"memoryPool.usage;name=PS Survivor Space": 0,
"memoryPool.usage;name=Compressed Class Space": 4067880,
"memory.maxNonHeap": -1
}
}