zoukankan      html  css  js  c++  java
  • 28 Spring Cloud Hystrix的实时监控功能

    在微服务架构中,Hystrix 除了实现容错外,还提供了实时监控功能。在服务调用时,Hystrix 会实时累积关于 HystrixCommand 的执行信息,比如每秒的请求数、成功数等。

    Hystrix 监控需要两个必备条件:

    1)必须有 Actuator 的依赖

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

    2)必须有 Hystrix 的依赖,Spring Cloud 中必须在启动类中添加 @EnableHystrix 开启 Hystrix

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

    我们改造下 hystrix-feign-demo 这个项目,加入上边两段代码的依赖,将 actuator 中的端点暴露出来,访问端点地址(http://localhost:8086/actuator/hystrix.stream)  

     从图中可以看到一直在输出“ping:”,出现这种情况是因为还没有数据,等到 HystrixCommand 执行了之后就可以看到具体数据了。

    调用一下 /callHello 接口 http://localhost:8086/callHello,访问之后就可以看到 http://localhost:8086/actuator/hystrix.stream 这个页面中输出的数据了

  • 相关阅读:
    搜索框下拉列表
    定时器修改button标题闪烁
    按钮设置文字图片排版
    SSKeychain
    IQKeyboardManager
    App内存性能优化
    支付宝集成
    友盟分享
    iOS 线程同步 加锁 @synchronized
    iOS 线程同步-信号量 dispatch_semaphore
  • 原文地址:https://www.cnblogs.com/jrkl/p/14385979.html
Copyright © 2011-2022 走看看