天天看點

hystrix dashboard 斷路器儀表盤

Hystrix Dashboard用于監控Hystrix對請求的熔斷和斷路進行實時監控

一、在實作Hystrix降級和熔斷的微服務項目中暴露Hystrix監控端點:

1.添加actuator依賴:
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
           
2.在application.yml檔案中配置暴露Hystrix監控端點:
management:
  endpoints:
    web:
      exposure:
        include: hystrix.stream
           
hystrix dashboard 斷路器儀表盤
3. 測試Hystrix監控端點是否暴露成功:
  • http://localhost:3001/actuator
    hystrix dashboard 斷路器儀表盤

二、建立hystrix-dashboard 項目:

1. 建立項目,添加依賴:
hystrix dashboard 斷路器儀表盤
2. 配置application.yml檔案:
hystrix dashboard 斷路器儀表盤
3. 主啟動類添加

@EnableHystrixDashboard

@EnableDiscoveryClient

注解:
hystrix dashboard 斷路器儀表盤
測試:
  • 打開監控台: http://localhost:4001/hystrix
    hystrix dashboard 斷路器儀表盤
  • 填入 hystrix 的監控端點,開啟監控: http://localhost:3001/actuator/hystrix.stream
    hystrix dashboard 斷路器儀表盤
  • 通路Hystrix服務多次檢視監控結果:
    hystrix dashboard 斷路器儀表盤

繼續閱讀