我的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可以参考

 

 

 

 



 

 

 

 

GitHub 加速计划 / da / dashboard
8
2
下载
General-purpose web UI for Kubernetes clusters
最近提交(Master分支:17 天前 )
2f3f7b01 * feat(pod): add GPU resource allocation support and refactor request/limit functions * test(pod): add GPU allocation resource validation in unit tests 1 天前
1d1d9f43 * Add argument to Dashboard API to allow for a custom CA bundle * add tls bundle to auth * fix CA file usage with custom bundle path * override client config to after config exiss * fix whitespace * Review arguments documentation 6 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐