斷路器監控(Hystrix Dashboard)


繼上一篇http://www.cnblogs.com/EasonJim/p/7613595.html介紹了斷路器之后,其實它還提供了一個管理頁面來監控這些應用的調用數據。

首先,我是基於上一個例子ZooKeeper實現的服務注冊與發現:http://www.cnblogs.com/EasonJim/p/7613734.html

然后不知道是不是ZK的問題,而不是使用Eureka的問題,導致訪問/hystrix.stream時一致報錯:Unable to connect to Command Metric Stream,此方法在網上沒能找到解決方案。

如果是以Eureka來搭建的,集成很簡單,只要在服務消費者上引入依賴即可

POM:

        <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>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix</artifactId>
        </dependency>

然后在main方法入口的Class上加入以下注解:

@EnableCircuitBreaker
@EnableHystrix
@EnableHystrixDashboard

最后訪問/hystrix

輸入地址和Title

即可看見監控的數據:

 

 

參考:

http://blog.csdn.net/forezp/article/details/70217283

http://blog.csdn.net/zhuchuangang/article/details/51289593


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM