0
点赞
收藏
分享

微信扫一扫

spring boot 运行时监控actuator


spring boot 运行时监控actuator

  • ​​1. 如何引入actuator​​
  • ​​2. 加载详细信息​​
  • ​​3. actuator api介绍​​


git地址


​​ https://github.com/a18792721831/studySpringCloud.git ​​

1. 如何引入actuator

新建一个spring web项目,然后,在gradle依赖中增加

implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-configuration-processor'
providedCompile 'org.projectlombok:lombok'

等gradle加载完依赖构建后,启动:

spring boot 运行时监控actuator_spring boot 监控


然后访问http://localhost:8080/acruator/

将会得到

spring boot 运行时监控actuator_actuator_02


接着访问http://localhost:8080/actuator/health

得到

spring boot 运行时监控actuator_spring boot监控配置_03

2. 加载详细信息

在application.yml中增加

spring boot 运行时监控actuator_spring boot 监控_04


启动

重新访问http://localhost:8080/actuator/health

spring boot 运行时监控actuator_spring boot 监控_05

3. actuator api介绍

Actuator提供了13个api接口,用于监控运行状态的spring boot的状况。

首先在application.yml配置文件中将所有的api全部暴露

spring boot 运行时监控actuator_actuator_06


spring boot 运行时监控actuator_actuator_07

类型

API接口

描述

示例

GET

/configprops

描述配置属性如何注入Bean

spring boot 运行时监控actuator_spring boot监控配置_08

GET

/beans

描述ing用程序上下文里全部的Beanm以及他们的关系

spring boot 运行时监控actuator_actuator_09

GET

/heapdump

获取快照

spring boot 运行时监控actuator_actuator_10

GET

/threaddump

获取线程活动的快照

spring boot 运行时监控actuator_spring boot监控配置_11

GET

/env

获取全部环境属性

spring boot 运行时监控actuator_spring boot监控配置_12

GET

/env/{name}

根据名称获取特定的环境属性

spring boot 运行时监控actuator_actuator_13

GET

/health

应用程序的健康指标

spring boot 运行时监控actuator_actuator_14

GET

/info

获取应用程序的信息

spring boot 运行时监控actuator_spring boot 监控_15

GET

/mappings

描述全部的url以及控制器

spring boot 运行时监控actuator_spring boot 监控_16

GET

/metrics

获取应用程序的全部度量信息

spring boot 运行时监控actuator_spring boot监控配置_17

GET

/metrics/{name}

获取程序的指定名称的度量信息

spring boot 运行时监控actuator_spring boot监控配置_18

GET

/shutdown

关闭应用程序

需要将endpoints.shutown.enabled设置为true


举报

相关推荐

0 条评论