springboot

springboot——Actuator

2020-01-09  本文已影响0人  Geroge1226

Actuator 介绍

1.问题背景

2.Actuator作用

Actuator是Springboot提供的用来对应用系统进行自省和监控的功能模块,借助于Actuator开发者可以很方便地对应用系统某些监控指标进行查看、统计等。
更多内容请移步官方文档

工作机制

通过restful api方式访问站点信息

常见默认站点接口

请求方式 请求路径 描述 鉴权
GET /autoconfig 查看自动配置的使用情况 true
GET /configprops 显示一个所有@ConfigurationProperties的整理列表 true
GET /beans 显示一个应用中所有SpringBeans的完整列表 true
GET /dump 打印线程栈 true
GET /env 查看所有环境变量 true
GET /env/{name} 查看具体变量值 true
GET /health 查看应用健康指标 false
GET /info 查看应用信息 false
GET /mappings 查看所有url映射 true
GET /metrics 查看应用基本指标 true
GET /metrics/{name} 查看具体指标 true
POST /shutdown 允许应用以优雅的方式关闭(默认情况不启用) true
GET /trace 查看基本追踪信息 true
......

使用说明

1.pom引用

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

注:不需要制定版本号,根据当前springboot 版本

2.程序yml 文件配置说明

注:以下基于springboot 2.1.5版本的开发

management:
  endpoint:
    health:
      show-details: always
  endpoints:
    web:
      base-path: /
      exposure:
        include: info,health
  metrics:
    tags:
      application: ${spring.application.name}

配置详解

上一篇 下一篇

猜你喜欢

热点阅读