Actuator

actuator 帮助你在应用程序生产环境时监视和管理应用程序。可以使用HTTP的各种请求来监管,审计,收集应用的运行情况.
项目中增加以下依赖


    org.springframework.boot
    spring-boot-starter-actuator

通过在appliction.properties中暴露actuator的监控接口
management.endpoints.web.exposure.include=*,hystrix.stream

启动项目后,看到类似的打印,actuator/** 代表暴露的接口


终端打印

其中actuator自带的监控接口包括:

函数 描述
dump 活动线程
env 环境属性
health 健康检查
info 定制信息
mappings URI路径,在这里可以看到有哪些端点
metrics 查看内存、CPU核心等系统参数
trace 用户请求信息
loggers 日志
/env/{name:.*} 像这种端点,后面带有一个name,这是指获取env中名字为name的那一个参数的值,比如http://localhost:8080/env/local.server.port

自定义Endpoint

你可能感兴趣的:(Actuator)