天天看點

SpringCloud-Hystrix斷路器 Dashboard監控儀表盤

前提:搭建好注冊中心,斷路器,消費者調用生産者,都已經可以跑通

可參考:https://blog.csdn.net/qq_41712271/article/details/104784809

https://blog.csdn.net/qq_41712271/article/details/104785211

假如需求:訂單服務 調用 産品服務

1 訂單服務 的項目中添加依賴

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

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

2 訂單服務 的項目,啟動類添加注解 @EnableHystrixDashboard

@EnableHystrixDashboard
           

3 訂單服務的項目,配置檔案application.yml定義

#暴露全部的監控資訊
management:
  endpoints:
    web:
      exposure:
        include: "*"
           

4 通路監控儀表盤

http://localhost:8781/hystrix

Hystrix Dashboard輸入: http://localhost:8781/actuator/hystrix.stream

5 可使用postman或JMeter等軟體測試,請求某接口200次

繼續閱讀