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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                Hystrix提供了<mark>準實時的調用監控(Hystrix Dashboard)</mark>,Hystrix會持續地記錄所有<mark>通過Hystrix發起的請求</mark>的執行信息,<mark>并以統計報表和圖形的形式展示給用戶</mark>,包括每秒執行多少次請求,有多少次成功,多少次失敗等。 <br/> Netflix通過 hystrix-metrics-event-stream 項目實現了對以上指標的監控。Spring Cloud也提供了Hystrix Dashboard的整合,對監控內容轉化成可視化界面。 <br/> 實現 Hystrix Dashboard 服務監控的步驟如下: **1. 構建Hystrix監控模塊:cloud-comsumer-hystrix-dashboard9001** **2. 在當前模塊的`pom.xml`中添加 Hystrix 相關依賴** ```xml <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> ... </dependencies> ``` **3. 當前模塊的`resources/application.yml`** ```yml server: port: 9001 spring: application: name: cloud-consumer-hystrix-dashboard ``` **4. 在當前模塊的啟動類上添加注解`@EnableHystrixDashboard`** ```java @SpringBootApplication @EnableHystrixDashboard public class DashboardMain9001 { public static void main(String[] args) { SpringApplication.run(DashboardMain9001.class, args); } } ``` **5. 驗證當前模塊是否構建成功** 啟動當前模塊,然后訪問 http://localhost:9001/hystrix ,顯示如下頁面則構建成功! ![](https://img.kancloud.cn/dd/be/ddbe0c0cd6ee3ffd7f0e785fcc3e6c01_780x405.jpg) **6. 在需要被監控的模塊的`pom.xml`中添加 actuator 和 hystrix 相關依賴** <mark>只有添加了 Hystrix 依賴的模塊才能被監控</mark>。如何構建 Hystrix 模塊參考【服務熔斷->Hystrix服務端構建】小節。 ``` 下面將監控模塊:cloud-provider-hystrix-payment8001 ``` **7. 驗證 cloud-provider-hystrix-payment8001 能否被 hystrix-dashborad 監控** 啟動被監控模塊 cloud-provider-hystrix-payment8001 與 監控模塊 cloud-comsumer-hystrix-dashboard9001。 (1)訪問 http://localhost:8001/payment/hystrix/circuit/10 測試被監控模塊是否成功啟動。 (2)訪問 http://localhost:8001/hystrix.stream 測試被監控是否被監控到,得到如下類似響應信息則是被監控到了。 ``` data: {"type":"HystrixCommand","name":"paymentCircuitBreaker","group":"PaymentServiceImpl", "currentTime":1636957796450,"isCircuitBreakerOpen":false,"errorPercentage":0,"errorCount":0, "requestCount":0,"rollingCountBadRequests":0,"rollingCountCollapsedRequests":0,"rollingCountEmit":0, "rollingCountExceptionsThrown":0,"rollingCountFailure":0,"rollingCountFallbackEmit":0, "rollingCountFallbackFailure":0,"rollingCountFallbackMissing":0, "rollingCountFallbackRejection":0,... ``` **8. 通過圖形化查看被監控模塊的情況** (1)訪問 hystrix-dashboard 監控端 http://localhost:9001/hystrix 。 (2)將被監控模塊的監控地址 [http://localhost:8001/hystrix.stream](http://localhost:8001/hystrix.stream) 填寫到 hystrix-dashboard 監控端。 ![](https://img.kancloud.cn/2b/dc/2bdc6164eeb47b870a77774581308b20_1347x416.jpg) `Delay`:該參數用來控制服務器上輪詢監控信息的延遲時間,默認為2000毫秒,可以通過配置該屬性來降低客戶端的網絡和CPU消耗。 (3)點擊 【Monitor Stream】 按鈕后出現如界面。 ![](https://img.kancloud.cn/d2/81/d281ef1a81dc913a7fc3dc86d0166660_1417x447.jpg) 多刷新幾次 http://localhost:8001/payment/hystrix/circuit/10 ,模擬訪問被監控端,圖形就會有波動了。 (4)讀圖。 ![](https://img.kancloud.cn/b5/ba/b5ba498b55f4e889cb7069de2981ea09_1915x924.jpg)
                  <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>

                              哎呀哎呀视频在线观看