美文网首页Spring
Spring Cloud监控管理:Actuator

Spring Cloud监控管理:Actuator

作者: 王勇1024 | 来源:发表于2019-08-05 11:26 被阅读0次

概述

Spring-boot-starter-actuator 是用于监控与管理的,只需引入依赖库就能为应用添加监控端点
其中 /health 端点能够全面你检查应用监控状态

pom依赖

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

接口说明

HTTP方法 路径 描述 鉴权
GET /autoconfig 查看自动配置的使用情况 true
GET /configprops 查看配置属性,包括默认配置 true
GET /beans 查看bean及其关系列表 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

配置

# 用于选择公开所有接口
management.endpoints.web.exposure.include=*
# 显示所有健康状态
management.endpoint.health.show-details=always
# 配置接口的启用,false关闭  true开启
management.endpoint.<id>.enabled=true 
management.endpoint.configprops.enabled=false
# Actuator 默认所有的监控点路径都在/actuator/*,如果有需要这个路径也支持定制
management.endpoints.web.base-path=/actuator

只公开部分接口

management:
  endpoints:
    web:
      exposure:
        include: refresh,health,info

相关文章

网友评论

    本文标题:Spring Cloud监控管理:Actuator

    本文链接:https://www.haomeiwen.com/subject/revpdctx.html