SpringCloud斷路器監控面板——Hystrix Dashboard


一、簡介
Hystrix Dashboard是Hystrix的一個組件,Hystrix Dashboard提供一個斷路器的監控面板,可以使我們更好的監控服務和集群的狀態,僅僅使用Hystrix Dashboard只能監控到單個斷路器的狀態,實際開發中還需要結合Turbine使用。

二、Hystrix Dashboard的使用
1、添加依賴

<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>

2、Springboot Application中添加注解,並啟動程序

@EnableHystrixDashboard //開啟Dashboard

3、查看面板

/health端點查看服務狀態
/hystrix.stream端點查看指標流


瀏覽器中打開http://localhost:9999/hystrix

圖中提示數據源有三種:
http://turbine-hostname:port/turbine.stream (所有集群)
http://turbine-hostname:port/turbine.stream?cluster=[clusterName](指定名稱的集群)
http://hystrix-app:port/hystrix.stream(單個應用)
我們選擇第三個,點擊Moitor Stream會自動生成監控面板,我們就可以實時監控數據

如果處於loading data狀態,是因為沒有數據,調用服務就可以加載數據了。


注意:在Feign負載均衡中使用Hystrix Dashboard,一定需要配置打開斷路器,如下:

feign.hystrix.enabled=true

 


免責聲明!

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



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