熔断监控面板(Hystrix Dashboard)
Hystrix Dashboard
Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数据。
添加依赖
我们新建一个工程 spring-cloud-consul-monitor,修改 pom 文件,添加相关依赖。
pom.xml

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
</dependencies>

启动类
在启动类中添加注解 @EnableHystrixDashboard 开启熔断监控支持。
ConsuleMonitorApplication.java

package com.louis.spring.cloud.consul.monitor; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; @EnableHystrixDashboard
@SpringBootApplication
public class ConsuleMonitorApplication { public static void main(String[] args) {
SpringApplication.run(ConsuleMonitorApplication.class, args);
}
}

修改配置
修改配置文件,配置启动端口和应用名称。
application.yml
server:
port: 8531
spring:
application:
name: spring-cloud-consul-monitor
配置监控路径
注意,如果你使用的是2.x等比较新的版本,需要在 Hystrix 的消费端配置监控路径,我们这里消费端是 spring-cloud-consul-consumer, 所以修改它的启动类。
ConsuleConsumerApplication.java

// 此配置是为了服务监控而配置,与服务容错本身无关,
// ServletRegistrationBean因为springboot的默认路径不是"/hystrix.stream",
// 只要在自己的项目里配置上下面的servlet就可以了
@Bean
public ServletRegistrationBean getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}

测试效果
先后启动 spring-cloud-consul-producer、 spring-cloud-consul-consumer、spring-cloud-consul-monitor 服务。
访问 http://localhost:8531/hystrix,会看到如下图所示界面。

此时没有任何具体的监控信息,需要输入要监控的消费者地址及监控信息的轮询时间和标题。
Hystrix Dashboard 共支持三种不同的监控方式:
单体Hystrix 消费者:通过URL http://hystrix-app:port/hystrix.stream 开启,实现对具体某个服务实例的监控。
默认集群监控:通过URL http://turbine-hostname:port/turbine.stream 开启,实现对默认集群的监控。
自定集群监控:通过URL http://turbine-hostname:port/turbine.stream?cluster=[clusterName] 开启,实现对clusterName集群的监控。
我们这里现在是对单体 Hystrix 消费者的监控,后面整合 Turbine 集群的时候再说明后两种的监控方式。
我们先访问 http://localhost:8521/feign/call, 查看要监控的服务是否可以正常访问。

确认服务可以正常访问之后,在监控地址内输入 http://localhost:8521/hystrix.stream,然后点击 Monitor Stream 开始监控。

刚进去,页面先显示 loading... 信息, 多次访问 http://localhost:8521/feign/call 之后,统计图表信息如下图所示。

各个指标的含义参见下图。

熔断监控面板(Hystrix Dashboard)的更多相关文章
- spring cloud Hystrix监控面板Hystrix Dashboard和Turbine
我们提到断路器是根据一段时间窗内的请求情况来判断并操作断路器的打开和关闭状态的.而这些请求情况的指标信息都是HystrixCommand和HystrixObservableCommand实例在执行过程 ...
- SpringCloud断路器监控面板——Hystrix Dashboard
一.简介 Hystrix Dashboard是Hystrix的一个组件,Hystrix Dashboard提供一个断路器的监控面板,可以使我们更好的监控服务和集群的状态,仅仅使用Hystrix Das ...
- Spring Boot + Spring Cloud 构建微服务系统(五):熔断监控面板(Hystrix Dashboard)
Hystrix Dashboard Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Comma ...
- 006服务监控看板Hystrix Dashboard
1.POM配置 和普通Spring Boot工程相比,仅仅添加了Hystrix Dashboard和Spring Boot Starter Actuator依赖 <dependencies> ...
- 断路器监控(Hystrix Dashboard)
继上一篇http://www.cnblogs.com/EasonJim/p/7613595.html介绍了断路器之后,其实它还提供了一个管理页面来监控这些应用的调用数据. 首先,我是基于上一个例子Zo ...
- [Spring cloud 一步步实现广告系统] 19. 监控Hystrix Dashboard
在之前的18次文章中,我们实现了广告系统的广告投放,广告检索业务功能,中间使用到了 服务发现Eureka,服务调用Feign,网关路由Zuul以及错误熔断Hystrix等Spring Cloud组件. ...
- Spring Cloud学习笔记【五】Hystrix Dashboard监控面板
ystrix除了隔离依赖服务的调用以外,Hystrix 还提供了准实时的调用监控(Hystrix Dashboard),Hystrix 会持续地记录所有通过 Hystrix 发起的请求的执行信息,并以 ...
- spring cloud深入学习(六)-----熔断监控Hystrix Dashboard和Turbine
Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数 ...
- 玩转Spring Cloud之熔断降级(Hystrix)与监控
本文内容导航目录: 前言:解释熔断降级一.搭建服务消费者项目,并集成 Hystrix环境 1.1.在POM XML中添加Hystrix依赖(spring-cloud-starter-netflix-h ...
随机推荐
- Android的数据的存储方式
数据的存储方式,总的来说分为三种: ① 文件存储: * SharedPreferences存储 * SD卡存储 ---- Environment * 数据库存储 ---- SQLite .MySQL. ...
- MySQL学习(十)
要做:商城的留言板 一般情况,做留言板的显示很容易,直接select查询,再显示出来,但eschop中的留言板难点在于留言数据来自2张表,feedback表和comment表,我们需要把两张表中的内容 ...
- JS self=this
1.每个函数都会有自己的this和arguments:this对象绑定运行环境,arguments绑定调用参数. 2.全局函数:this和全局环境绑定,浏览器指向全局window对象(node.js中 ...
- winfrom datagridview ,picturebox,显示图片,以及删除问题
private void write_listview(DataSet ds) { DataTable dt = ds.Tables[0]; ...
- Python2 - MySQL适配器 MySQLdb
本文实例讲述了python中MySQLdb模块用法.分享给大家供大家参考.具体用法分析如下: MySQLdb其实有点像php或asp中连接数据库的一个模式了,只是MySQLdb是针对mysql连接了接 ...
- 获取解码字符串指定位置的数值 Decoded String at Index
2018-10-04 12:53:06 问题描述: 问题求解: 首先本题给出了问题的规模,从Note中我们可以看到解码后的字符串长度甚至可以达到2^63的长度,这个长度已经远远超过整型数的范围,因此如 ...
- RNA Spike-in Control(转)
Spike-in Control:添加/加入(某种物质)的对照(组)在某些情况下,待检验样本中不含待测物质或者含有但是浓度很低,为了证明自己建立的方法能对样本中待测物质进行有效的检测,可在待检样本中加 ...
- Fiddler抓包配置具体步骤
如何查看手机连接的无线wifi的IP? 打开手机,选择设置->进入设置页面选择WLAN->进入WLAN管理,点击手机已经连接的路由器->点击进入查看,即可看见IP地址 如何查看自己电 ...
- Linux中安装Mysql授权远程访问
一.直接授权 mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OP ...
- 关于*[pylint]E1101:Module 'xxx' has no 'xxx' member* 简单而有效的解决办法
关于 pylint 的 *E1101* 错误: 概念: %s %r has no %r member Function %r has no %r member Variable %r has no % ...