3.4:HystrixDashboard仪表盘

一. 引入

  1. pom.xml中加入依赖

<dependency>

    <groupId>org.springframework.cloud</groupId>

    <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>

</dependency>

<dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-actuator</artifactId>

</dependency>

  1. 启动类添加注解“@EnableHystrixDashboard”

  1. 配置文件添加endpoint

management:

  endpoints:

    web:

      exposure:

        include: "*"

  1. 访问入口

    1. http://localhost:8781/hystrix

    2. Hystrix Dashboard输入: http://localhost:8781/actuator/hystrix.stream

  1. 参考资料

    1. 默认开启监控配置:https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-security-actuator

    2. 配置文件类:spring-configuration-metadata.json


二. 仪表盘参数解析

  • 首页

  1. 监控方式

    1. 默认的集群监控:通过URLhttp://turbine-hostname:port/turbine.stream开启,实现对默认集群的监控。

    2. 指定的集群监控:通过URLhttp://turbine-hostname:port/turbine.stream?cluster=[clusterName]开启,实现对clusterName集群的监控。

    3. 单体应用的监控:通过URLhttp://hystrix-app:port/hystrix.stream开启,实现对具体某个服务实例的监控。

  2. delay:该参数用来控制服务器上轮询监控信息的延迟时间,默认为2000毫秒,我们可以通过配置该属性来降低客户端的网络和CPU消耗。

  3. Title:该参数对应了上图头部标题Hystrix Stream之后的内容,默认会使用具体监控实例的URL,我们可以通过配置该信息来展示更合适的标题。

  • 监控页面

  1. 实心圆:共有两种含义。

    1. 颜色的变化——实例的健康程度:它的健康度从绿色、黄色、橙色、红色递减。

    2. 大小的变化——实例的请求流量:流量越大该实心圆就越大。

  2. 曲线:用来记录2分钟内流量的相对变化,我们可以通过它来观察到流量的上升和下降趋势。

发布了96 篇原创文章 · 获赞 26 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq919694688/article/details/103155664