hystrix-dashboard+turbine以及hystrix.stream数据问题

我的springcloudshe版本1.5.8.RELEASE如下:

hystrix-dashboard 是用于监控hystrix的调用情况,但是针对单个hystrix.stream监控

turbine  用于整合多个集群的hystrix.stream,通过turbine.stream对外提供整合数据,这样可以监控集群的hystrix.stream调用

http://localhost:port/hystrix.stream
http://localhost:port/turbine.stream

可以将两个hystrix-dashboard +turbine 合成一个项目节省下

1、配置监控平台

首先配置hystrix-dashboard+turbine  pom.xml

 

   <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.8.RELEASE</version>
    </parent>

    <groupId>com.zhou.demo</groupId>
    <artifactId>hystrix-dashboard</artifactId>
    <version>1.0.0</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Dalston.SR4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>


    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-turbine</artifactId>
        </dependency>
    </dependencies>

启动类

 

@SpringBootApplication
@EnableDiscoveryClient
@EnableTurbine
@EnableHystrixDashboard
public class HystrixDashboardApp {
    public static void main(String[] args) {
        SpringApplication.run(HystrixDashboardApp.class, args);
    }
}

 

配置文件:appConfig 需要拉取hystrix.stream的application-name

 

clusterNameExpression 配置集群name,我配置的是默认,这一块应该和eureka配置放在一起(具体自己尝试)

还有combineHostPort默认是true,用host和post来区分不同的服务

 

turbine:
  appConfig: zuul-server,zuul-inner-server
  clusterNameExpression: new String("default")

如此搭建完成。

 

 

2、如何让应用产生hystrix.stream

 

需要actuator hystrix的相关jar包,需要@EnableCircuitBreaker相关注解

1、网关服务zuul本来就有,不用额外配置

2、使用feign调用的服务,需要打开hystris feign:hystrix:enabled: true

3、非feign的springboot项目,使用resttemple调用服务时,需要以上相关包和相关注解,还需要 @HystrixCommand来使用hystrix来支持。

4、另外需要有调用任意hysrix接口,不然没有hystrix调用,访问hystrix.stream会一直ping,hystrix监控界面一直loading,查看hystrix.stream是没数据。

监控界面监控非网关服务时, Circuit显示具体调用hystrix的类和对应方法,下面的thread pools显示具体的application-name

参数解释

 

更完全的说明解释图如下

3、参考文章

https://mp.weixin.qq.com/s/c4PwWUJiTKdeuxdGGAC8sw  系列文章可看

https://www.jianshu.com/p/b7b20fc09ca9 系列文章,内有代码示例,版本1.5.6可以参考

 

 

 

 



 

 

 

 

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值