springcloud hystrix dashboard使用

什麼是hystrix dashboard

hystrix dashboard是一款由netfilx提供的,基於hystrix Commond,並將hystrix commond收集到的服務健康信息以圖形化展示的界面工具

hystrix dashboard的主要作用

1、監控各個hystrixcommand的各種值。 2、通過dashboards的實時監控來動態修改配置,直到滿意爲止

hystrix儀表盤圖形界面參數簡介

1、圓形顏色和大小:代表健康情況和流量 2、折線:2分鐘內的吞吐率變化情況 3、hosts:集羣中節點個數 4、median: 每個請求時間的中位數 5、mean: 平均每個請求消耗的時間 6、subscriberGetAccount: 綠200545:代表成功請求數量 藍0:代表斷路數量 黃19:代表表超時的線程數量 紫94:代表線程池拒絕次數,即線程不夠用 紅0: 失敗或異常數量 灰0%: 最後10秒錯誤率 7、host: 各節點每秒的平均請求吞吐量 8、cluster: 集羣每秒的請求吞吐量 9、circuit:代表斷路器狀態即:是否打開斷路器 90th,99th,99.5th: 最後1分鐘各種延遲的百分比。如圖:90%的請求小於10ms;而99%的請求小於44ms,99.5%的請求在61ms完成。

hystrix dashboard項目搭建

1、引入maven依賴

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

最新版的則爲

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

2、創建啓動類

@SpringBootApplication
@EnableHystrixDashboard
public class HystrixDashBoard {

    private static Logger logger = LoggerFactory.getLogger(HystrixDashBoard.class);

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

3、配置

server:
  port: 7300

4、啓動

瀏覽器輸入

http://localhost:7300/hystrix

5、監控單節點服務信息例子

儀表盤輸入

形如:http://hystrix-app:port/hystrix.stream ,然後點擊monitor stream

小結

以上就是hystrix dashboard的簡單入門,hystrix dashboard 監控單節點的意義的不是很大,下一節介紹何如用turbine彙總系統內多個服務的數據並顯示到Hystrix Dashboard上

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章