SpringCloud Hystrix Dashboard

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

监控服务pom配置文件

       <!--系统注册与监控服务-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!--hystrix仪表盘-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>

  application.properties

server.port=
spring.application.name=claimdashboard eureka.client.service-url.defaultZone=http://localhost:8091/eureka/
eureka.client.registerWithEureka=true
eureka.client.fetchRegistry=true
@SpringBootApplication
@EnableHystrixDashboard
public class ClaimdashboardApplication {
/*
启动输入http://localhost:8070/hystrix
再输入某个需要监控的服务 http://localhost:8030/hystrix.stream
*/ public static void main(String[] args) {
SpringApplication.run(ClaimdashboardApplication.class, args);
}
}

被监控服务的配置

        <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
#服务名称
spring.application.name=claimaudit
#配置服务中心注册地址
eureka.client.service-url.defaultZone=http://localhost:8091/eureka/
eureka.client.instance.lease-renewal-interval-in-seconds=
feign.hystrix.enabled=true
@SpringBootApplication
@EnableDiscoveryClient //注册服务
@EnableFeignClients //开启feign
@EnableHystrix //开启断路器
@EnableCircuitBreaker
public class ClaimauditApplication {
public static void main(String[] args) {
SpringApplication.run(ClaimauditApplication.class, args); }
}

主要是下面这段代码,如果不添加监控服务会报连接不上的错误

@Configuration
public class HystrixConfig { @Bean
public HystrixMetricsStreamServlet hystrixMetricsStreamServlet(){
return new HystrixMetricsStreamServlet();
} @Bean
public ServletRegistrationBean registration(HystrixMetricsStreamServlet servlet){
ServletRegistrationBean registrationBean = new ServletRegistrationBean();
registrationBean.setServlet(servlet);
//是否启用该registrationBean
registrationBean.setEnabled(true);
registrationBean.addUrlMappings("/hystrix.stream");
return registrationBean;
}
}

最新文章

  1. 关于ReSharper
  2. js常用的封装函数
  3. PHP不到100行代码实现SSO单点登录
  4. 微信小程序购物商城系统开发系列
  5. [转载代码]VB.NET 中查询 Linq to SQL 执行时的SQL语句
  6. PostgreSQL中,database,schema,table之间关系
  7. 【转】#ifdef __cplusplus深度剖析
  8. void类型及void指针
  9. Java图片上传压缩处理
  10. server-send event object
  11. 忘记了SqlServer的SA密码怎么办
  12. HTML框架集之Frameset与Iframe简单应用
  13. node基础篇二:模块、路由、全局变量课堂(持续)
  14. Java中的String类型
  15. HTML与CSS的一些知识(四)
  16. 使用nginx搭建rtmp服务器
  17. pip安装第三方库镜像源选择
  18. 火币网API文档——REST 行情、交易API简介
  19. P3605 [USACO17JAN]Promotion Counting晋升者计数
  20. C++中cin的用法汇总

热门文章

  1. java_单词长度
  2. 深入理解JVM——虚拟机GC
  3. AOP,过滤器,监听器,拦截器【转载】
  4. 10种JavaScript开发者必备的VS Code插件
  5. CentOS7系列--安装Chrome浏览器
  6. mysql5.7 安装和多源复制实践
  7. android 保存图片,及将图片更新到图库
  8. (网页)JS去掉字符串前后空格或去掉所有空格的用法(转)
  9. (网页)jQuery UI 实例 - 日期选择器(Datepicker)
  10. C# 异步编程4 async与await 异步程序开发