官术网_书友最值得收藏!

Exposing metrics endpoints

Spring Boot Actuator allows you to inspect some interesting parameters of your running application, such as application memory circumstances (available versus free). The following listing shows a sample of what the /metrics endpoint might give you:

{
mem: 308564,
mem.free: 219799,
processors: 4,
instance.uptime: 3912392,
uptime: 3918108,
systemload.average: -1,
heap.committed: 254976,
heap.init: 131072,
heap.used: 35176,
heap: 1847808,
nonheap.committed: 54952,
nonheap.init: 2496,
nonheap.used: 53578,
nonheap: 0,
threads.peak: 25,
threads.daemon: 23,
threads.totalStarted: 29,
threads: 25,
classes: 6793,
classes.loaded: 6793,
classes.unloaded: 0,
gc.ps_scavenge.count: 8,
gc.ps_scavenge.time: 136,
gc.ps_marksweep.count: 2,
gc.ps_marksweep.time: 208,
httpsessions.max: -1,
httpsessions.active: 0,
gauge.response.beans: 20,
gauge.response.env: 16,
gauge.response.autoconfig: 14,
gauge.response.unmapped: 1,
counter.status.200.beans: 2,
counter.login.failure: 2,
counter.login.success: 10,
counter.status.200.autoconfig: 2,
counter.status.401.unmapped: 3,
counter.status.200.env: 2
} 

As you can see, a lot of information is provided by the /metrics endpoint.

Now let's check the health of the application by using the /health endpoint:

{
  status: "UP",
  diskSpace:
  {
    status: "UP",
    total: 290391584768,
    free: 209372835840,
    threshold: 10485760
  }
} 

As you can see, the preceding information is about the health of your Spring application. Along with the basic health status, you're also given information regarding the amount of available disk space and the status of the database that the application is using.

Let's see how to expose application information by using /info endpoints.

主站蜘蛛池模板: 甘孜| 志丹县| 高台县| 卫辉市| 德江县| 仁化县| 蒙自县| 蕉岭县| 吉安市| 鲁山县| 临漳县| 黔东| 英山县| 伊金霍洛旗| 和林格尔县| 中西区| 兴业县| 通州市| 兴仁县| 樟树市| 禄劝| 铁力市| 丹巴县| 河东区| 益阳市| 宁德市| 石阡县| 彰化市| 永兴县| 体育| 微山县| 罗甸县| 肃宁县| 洪泽县| 兴国县| 南丰县| 灵宝市| 凤凰县| 沈丘县| 甘洛县| 广德县|