Bootstrap

spring-boot指标监控

                                            指标监控

1Springboot actuator

1微服务在云上部署后,需要对其进行监控,追踪,审计,控制等。Springboot抽取了actuator场景,使得我们每个微服务快速引用即可获取生产级别的应用监控审计等功能。

使用http://localhost:8080/actuator/

2Actuator endpoint

1常用的端点

health显示应用程序运行状态信息

metrics 显示当前应用程序“指标”信息  

loggers 显示和修改应用程序中日志的配置

2 health endpoint

健康检查端点,在云平台,平台会定时的检查应用的健康状况,需要health endpoint为平台返回当前应用的一系列组件健康状况的集合

Important health endpoint返回结果,应该是一系列健康检查后的一个汇报

很多健康检查默认已配好(数据库,redis)

可以很容易的添加自定义的健康机制

3Metrics endpoint

提供详细的、层级的、空间指标信息、这些信息可以被pull和push方式得到

      通过metrics对接多种监控系统

      简化核心metrics开发

      添加自定义metrics或者扩展已有的metrics

4管理endpoints

        1开启或禁用endpoints

             默认所有的endpoint除shutwindow都是开启的需要开启或禁用某个endpoint,配置模式为management.endpoint.<endpointName>.enabled=true

        禁用所有的endpoint然后手动开启指定的endpoint

        2  暴露endpoints

             http:默认只暴露health和info endpoint

             jmx:默认暴露所有endpoint

             除health info 剩下的endpoint都应该进行保护访问,如果引入springsecurity,则会默认配置安全访问规则

3定制endpoint

  定制health信息

定制info信息 :编写配置文件 编写infocontributorhttp://localhost:8080/actuator/info 定制metrics信息 Springboot支持自动适配的metrics 增加定制metrics

定制Endpoint场景开发Readinessendpoint来管理程序是否就绪,或livenessendpoint来管理程序是否存活

;