SpringBoot:指标监控

依赖

        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>2.6.1</version>
        </dependency>

使用http://localhost:8080/actuator来访问监控功能
在这里插入图片描述
http://localhost:8080/actuator/**后面可以接需要监控的监控端点Endpoint。springboot监控默认有两种模式

● HTTP:默认只暴露health和info
● JMX:默认暴露所有端点
我们可以通过jconsole命令来连接本地应用来监控各个端点的详细信息。但一般是通过http的形式来监控。我们需要通过修改application.yaml文件来实现。

management:
  endpoints:
    enabled-by-default: true
#默认暴露所有端点
    web:
      exposure:
        include: '*'
#http模式下暴露所有端点

最常用的Endpoint

● Health:健康状况
● Metrics:运行时指标
● Loggers:日志记录

禁用redis的自动配置
在这里插入图片描述

 endpoint:
    health:
      show-details: always
      #显示health端点的详细信息 默认值为never

在这里插入图片描述

开启与禁用:可以通过enable属性来开启指定端点的监控功能

management:
  endpoints:
    enabled-by-default: false

    web:
      exposure:
        include: '*'
  endpoint:</
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值