<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                2021-12-19 周天 ## Hystrix監控 ### actuator的監控節點 在`actuator`下有用來監控`hystrix`的端點`/actuator/hystrix.stream`。 訪問: ``` http://localhost:9202/actuator/hystrix.stream ``` 輸出:(注意監控時需要請求`@HystrixCommand`配置的微服務) ``` ping: data: {"type":"HystrixCommand","name":"feignCardRand","group":"TestController","currentTime":1641272819332,"isCircuitBreakerOpen":false,"errorPercentage":0,"errorCount":0,"requestCount":1000,"rollingCountBadRequests":0,"rollingCountCollapsedRequests":0,"rollingCountEmit":0,"rollingCountExceptionsThrown":0,"rollingCountFailure":0,"rollingCountFallbackEmit":0,"rollingCountFallbackFailure":0,"rollingCountFallbackMissing":0,"rollingCountFallbackRejection":0,"rollingCountFallbackSuccess":0,"rollingCountResponsesFromCache":0,"rollingCountSemaphoreRejected":0,"rollingCountShortCircuited":0,"rollingCountSuccess":1000,"rollingCountThreadPoolRejected":0,"rollingCountTimeout":0,"currentConcurrentExecutionCount":0,"rollingMaxConcurrentExecutionCount":10,"latencyExecute_mean":0,"latencyExecute":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"latencyTotal_mean":0,"latencyTotal":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"propertyValue_circuitBreakerRequestVolumeThreshold":20,"propertyValue_circuitBreakerSleepWindowInMilliseconds":5000,"propertyValue_circuitBreakerErrorThresholdPercentage":50,"propertyValue_circuitBreakerForceOpen":false,"propertyValue_circuitBreakerForceClosed":false,"propertyValue_circuitBreakerEnabled":true,"propertyValue_executionIsolationStrategy":"THREAD","propertyValue_executionIsolationThreadTimeoutInMilliseconds":1000,"propertyValue_executionTimeoutInMilliseconds":1000,"propertyValue_executionIsolationThreadInterruptOnTimeout":true,"propertyValue_executionIsolationThreadPoolKeyOverride":null,"propertyValue_executionIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_metricsRollingStatisticalWindowInMilliseconds":10000,"propertyValue_requestCacheEnabled":true,"propertyValue_requestLogEnabled":true,"reportingHosts":1,"threadPool":"TestController"} ``` ### 集成hystrix dashboard 接口數據查看起來不直觀,可以運行`hystrix dashboard`通過界面來查看。 1. 先引入依賴 ~~~ xml <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> ~~~ 2. 創建啟動類 ~~~ java @EnableHystrixDashboard @SpringBootApplication(scanBasePackages = "com.github.mg0324") public class StartupApplication { public static void main(String[] args) { SpringApplication.run(StartupApplication.class,args); } } ~~~ 3. 添加首頁跳轉,支持端口直接到`hystrix`資源路徑 ~~~ java @Controller public class HystrixIndexController { @GetMapping("") public String index() { return "forward:/hystrix"; } } ~~~ 4. 添加配置端口 ~~~ server: port: 8030 hystrix: dashboard: # 設置允許連接的IP proxy-stream-allow-list: "192.168.3.29" ~~~ 5. 啟動服務,并訪問 `http://127.0.0.0:8030` ![](https://img.kancloud.cn/7b/e7/7be7603d20c69bad480ba632cb44dad2_1956x1264.png) ### 監控詳情解讀 在 Hystrix Dashboard 界面里的url處填寫要監控的hystrix數據流地址。 如:http://192.168.3.29:9202/actuator/hystrix.stream ![](https://img.kancloud.cn/e1/77/e17747de63e5e98bc736eb40ad7cc0d0_1346x808.png) 如果連接后的界面里什么都沒有顯示,則需要手動請求后,才能展現數據。可以用 ab 命令做請求壓測,加大壓力,讓熔斷器開啟,圖中會出現紅色。 ![](https://img.kancloud.cn/da/b5/dab5b6548b45d9c0834e95e03938c291_1296x790.png) ab命令如下: `ab -n 10000 -c 160 http://127.0.0.1:9201/test/test/feign/cardRand` ![](https://img.kancloud.cn/db/c8/dbc88eb92feb1ca3d957c4911c02b5f9_3360x1968.png) ## 集成Turbine監控 Turbine是一個聚合Hystrix監控數據的工具,它可將所有相關/hystrix.stream端點的數據聚合到一個組合的/turbine.stream中,從而讓集群的監控更加方便。 1. 添加依賴。 ~~~ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-turbine</artifactId> </dependency> ~~~ 2. 編寫啟動類。 ~~~ @EnableTurbine @SpringBootApplication(scanBasePackages = "com.github.mg0324") public class StartupApplication { public static void main(String[] args) { SpringApplication.run(StartupApplication.class,args); } } ~~~ 3. 添加配置。 ~~~ server: port: 8031 spring: application: name: card-hystrix-turbine eureka: client: service-url: defaultZone: http://192.168.3.29:8761/eureka/ instance: prefer-ip-address: true turbine: # 要監控的微服務列表,多個用,分隔 appConfig: mic-card,mic-test clusterNameExpression: "'default'" ~~~ 4. 啟動服務后,得到 http://192.168.3.29:8031/turbine.stream 的聚合節點。 5. 填寫到hystrix dashboard的url中做監控。 ![](https://img.kancloud.cn/2a/6b/2a6bd0e17baa5418074002b5c94db15d_1212x784.png) ## 參考 https://www.itmuch.com/spring-cloud/finchley-15/
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看