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)的更多相关文章

  1. spring cloud Hystrix监控面板Hystrix Dashboard和Turbine

    我们提到断路器是根据一段时间窗内的请求情况来判断并操作断路器的打开和关闭状态的.而这些请求情况的指标信息都是HystrixCommand和HystrixObservableCommand实例在执行过程 ...

  2. SpringCloud断路器监控面板——Hystrix Dashboard

    一.简介 Hystrix Dashboard是Hystrix的一个组件,Hystrix Dashboard提供一个断路器的监控面板,可以使我们更好的监控服务和集群的状态,仅仅使用Hystrix Das ...

  3. Spring Boot + Spring Cloud 构建微服务系统(五):熔断监控面板(Hystrix Dashboard)

    Hystrix Dashboard Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Comma ...

  4. 006服务监控看板Hystrix Dashboard

    1.POM配置 和普通Spring Boot工程相比,仅仅添加了Hystrix Dashboard和Spring Boot Starter Actuator依赖 <dependencies> ...

  5. 断路器监控(Hystrix Dashboard)

    继上一篇http://www.cnblogs.com/EasonJim/p/7613595.html介绍了断路器之后,其实它还提供了一个管理页面来监控这些应用的调用数据. 首先,我是基于上一个例子Zo ...

  6. [Spring cloud 一步步实现广告系统] 19. 监控Hystrix Dashboard

    在之前的18次文章中,我们实现了广告系统的广告投放,广告检索业务功能,中间使用到了 服务发现Eureka,服务调用Feign,网关路由Zuul以及错误熔断Hystrix等Spring Cloud组件. ...

  7. Spring Cloud学习笔记【五】Hystrix Dashboard监控面板

    ystrix除了隔离依赖服务的调用以外,Hystrix 还提供了准实时的调用监控(Hystrix Dashboard),Hystrix 会持续地记录所有通过 Hystrix 发起的请求的执行信息,并以 ...

  8. spring cloud深入学习(六)-----熔断监控Hystrix Dashboard和Turbine

    Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数 ...

  9. 玩转Spring Cloud之熔断降级(Hystrix)与监控

    本文内容导航目录: 前言:解释熔断降级一.搭建服务消费者项目,并集成 Hystrix环境 1.1.在POM XML中添加Hystrix依赖(spring-cloud-starter-netflix-h ...

随机推荐

  1. numpy广播

    (m,n)   +,-,*,/  (m,1) 先将(m,1)复制n次,构成(m,n)矩阵,然后再进行+,-,*,/运算 (m,n)   +,-,*,/  (1,n) 先将 (1,n)复制m次,构成(m ...

  2. python + lisp hy的新手注记1

    想在python里用lisp方言hy的目的: 1 用lisp去parse 包含 “数据+简单if控制流(代码.AST)”的配置文件,或者说用包含s-exp的.hy文件作为这类配置文件的实现(而不是用y ...

  3. cocos2dx spine之一 :spine缓存 (c++ & lua)

    cocos2dx版本为3.10 1.在使用spine的过程中,发现了一个比较严重的问题:每次创建SkeletonAnimation的时候都会很卡,即使是使用同一个骨骼数据skeletonData. 跟 ...

  4. css设置字体单行,多行超出省略号显示

    单行: overflow: hidden; text-overflow:ellipsis; white-space: nowrap; 多行 display: -webkit-box; -webkit- ...

  5. Java通过ftp上传文件

    首先,pom.xml添加引用 <dependency> <groupId>commons-net</groupId> <artifactId>commo ...

  6. 数据库:Mysql中“select ... for update”排他锁分析

    Mysql InnoDB 排他锁 用法: select … for update; 例如:select * from goods where id = 1 for update; 排他锁的申请前提:没 ...

  7. 安装edusoho

    1.更新第三方源并升级系统 (CentOS默认的标准源里没有nginx软件包) 1.1.安装CentOS第三方yum源 #安装下载工具wget yum install wget #下载atomic y ...

  8. Go语言学习之7 接口实例、终端文件读写、异常处理

    本节主要内容: 1. 终端读写2. 文件读写3. 命令行参数4. Json5. 自定义错误 1. 终端读写 操作终端相关文件句柄常量    os.Stdin:标准输入    os.Stdout:标准输 ...

  9. idea maven环境下 java实现发送邮件验证

    1.开通smtp授权 QQ邮箱-设置-账户-开启 得到一个授权码 2.下载javax.email包 maven项目中 pom文件加入: <dependency> <groupId&g ...

  10. 【转】 g++编译时对'xxxx'未定义的引用问题(undefined reference to)

    转自:https://blog.csdn.net/killwho/article/details/53785910 引用:http://www.linuxdiyf.com/linux/16754.ht ...