Spring Boot 在 Start POMs中提供了一个特殊的依赖模块 spring-boot-start-actuator ,引入改模块能自动为Spring Boot构建应用提供一系列用于监控的端点。

 

<dependency>
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-start-actuator</artifactId>
</dependency>

 通过这些端点我们可以实时获取应用的各项监控指标:

      比如访问 /health 端点,我们可以获取如下信息;

{
    "status":"UP",
    "diskSpace":{
          "status":"UP",
          "total":"491270",
          "free":"383870",
          "threshold":"10485670"
    }     
}

 

使用Spring Cloud的各个组件后,他的返回会变得非常丰富,有助于我们定制个性化的监控策略。

根据原生端点的作用,可以将原生端点分为以下三大类:

    应用配置类:例如:/autoconfig 获取应用自动化配置报告。

    度量指标类:/metrics: 各类重要度量指标,比如内存信息,线程信息、垃圾回收信息。

    操作控制类:/shutdown ,在配置文件中开启后,访问应用的/shutdown端点就能实现远程关闭该应用的操作。     

相关文章:

  • 2021-10-10
  • 2021-11-22
  • 2019-08-22
  • 2019-07-31
  • 2021-09-26
  • 2022-01-12
  • 2021-04-20
  • 2021-10-21
猜你喜欢
  • 2022-01-05
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2021-06-09
相关资源
相似解决方案