服务监控hystrixDashboard

服务监控hystrixDashboard

Hystrix还提供了实时的调用监控(Hystrix Dashboard),Hystrix会持续地记录所有通过Hystrix发起的请求的执行信息,并以统计报表和图形的形式展示给用户,包括每秒执行多少请求,多少成功,多少失败等。

Netflix通过hystrix-metrics-event-stream项目实现了对以上指标的监控。Spring Cloud也提供了Hystrix Dashboard的整合,对监控内容转化成可视化界面。

新建工程microservicecloud-consumer-hystrix-dashboard:

引入依赖:

    <dependencies>
        <!-- hystrix和hystrix-dashboard相关 -->
        <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>
    </dependencies>

application.yml:

server:
  port: 9001

主启动类改名+新注解@EnableHystrixDashboard

@SpringBootApplication
@EnableHystrixDashboard //开启监控
public class DeptConsumer_DashBoard_App {

    public static void main(String[] args) {
        SpringApplication.run(DeptConsumer_DashBoard_App.class, args);
    }
}

所有Provider微服务提供类(8001/8002/8003)都需要监控依赖配置:

		<!-- actuator监控信息完善 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator</artifactId>
        </dependency>

启动microservicecloud-consumer-hystrix-dashboard该微服务监控消费端:

访问http://localhost:9001/hystrix:
在这里插入图片描述

访问http://localhost:8001/hystrix.stream

启动3个eureka集群:
启动microservicecloud-provider-dept-hystrix-8001

访问:http://localhost:8001/hystrix.stream
在这里插入图片描述

多次刷新http://localhost:8001/dept/get/1

填写监控地址:
在这里插入图片描述
监控结果:
在这里插入图片描述

观察监控窗口

实心圆:共有两种含义。它通过颜色的变化代表了实例的健康程度,它的健康度从绿色开始变化

该实心圆除了颜色的变化之外,它的大小也会根据实例的请求流量发生变化,流量越大该实心圆就越大。所以通过该实心圆的展示,就可以在大量的实例中快速的发现故障实例和高压力实例。

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

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值