码迷,mamicode.com
首页 > 其他好文 > 详细

hystrix仪表盘

时间:2017-06-19 17:43:00      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:bean   load   blank   adb   main   pom.xml   .class   depend   ann   

Circuit Breaker: Hystrix Dashboard (断路器:hystrix 仪表盘)

基于service-ribbon 改造下:

pom.xml加入:

    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
        </dependency>

在主程序入口中加入@EnableHystrixDashboard注解,开启hystrixDashboard:

@SpringBootApplication
@EnableDiscoveryClient
@EnableHystrix
@EnableHystrixDashboard
public class ServiceRibbonApplication {

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

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }

}

打开浏览器:访问http://localhost:8764/hystrix,界面如下:

技术分享

点击monitor stream,进入下一个界面,访问:http://localhost:8764/hi?name=forezp访问ribbon负载一个请求

此时会出现监控界面:

技术分享

hystrix仪表盘

标签:bean   load   blank   adb   main   pom.xml   .class   depend   ann   

原文地址:http://www.cnblogs.com/wangjing666/p/7049679.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!