第11篇:熔断监控Hystrix Dashboard

本文详细介绍HystrixDashboard的整合与使用,包括pom依赖配置、启动类注解及参数配置,演示如何监控Hystrix指标信息,快速定位系统问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hystrix Dashboard是Hystrix的仪表盘组件,主要用来实时监控Hystrix的各项指标信息,通过界面反馈的信息可以快速发现系统中存在的问题。

 

Hystrix Dashboard快速体验

 

一:在服务消费者方整合Hystrix Dashboard

 

二:pom依赖

springcloud以前的版本需要依赖3个

1

2

3

4

5

6

7

8

9

10

11

12

<dependency>

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

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

</dependency>

<dependency>

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

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

</dependency>

<dependency>

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

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

</dependency>

springcloud新版本,比如(Finchley.SR1)只需要依赖一个jar

1

2

3

4

<dependency>

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

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

</dependency>

 

三:启动类配置@EnableHystrixDashboard注解,以及配置actuator/hystrix.stream请求路径

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

@SpringBootApplication

@EnableHystrixDashboard

public class SpringCloudHystrixDashboardApplication {

 

    public static void main(String[] args) {

        SpringApplication.run(SpringCloudHystrixDashboardApplication.class, args);

    }

    //配置actuator/hystrix.stream端口

    @Bean

        public ServletRegistrationBean getServlet(){

            HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();

            ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);

            registrationBean.setLoadOnStartup(1);

            registrationBean.addUrlMappings("/actuator/hystrix.stream");

            registrationBean.setName("HystrixMetricsStreamServlet");

            return registrationBean;

        }

}

 

四:启动工程后访问 http://localhost:8181/hystrix,将会看到如下界面:

image.png

 

图中会有一些提示:

Cluster via Turbine (default cluster): http://turbine-hostname:port/turbine.stream 
Cluster via Turbine (custom cluster): http://turbine-hostname:port/turbine.stream?cluster=[clusterName]
Single Hystrix App: http://hystrix-app:port/hystrix.stream

大概意思就是如果查看默认集群使用第一个url,查看指定集群使用第二个url,单个应用的监控使用最后一个,我们暂时只演示单个应用的所以在输入框中输入: http://localhost:8181/ actuator/hystrix.stream,输入之后点击 monitor,进入页面。

 

 

五:面板参数说明

 

  1.   实心圆:共有两种含义。它通过颜色的变化代表了实例的健康程度,如下图所示,它的健康度从绿色、黄色、橙色、红色递减。该实心圆除了颜色的变化之外,它的大小也会根据实例的请求流量发生变化,流量越大该实心圆就越大。所以通过该实心圆的展示,我们就可以在大量的实例中快速的发现故障实例和高压力实例。

 

spring-cloud-starter-dalston-5-1-3.png

 

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

 

   c.其他一些数量指标如下图所示:

 

spring-cloud-starter-dalston-5-1-4.png

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值