码迷,mamicode.com
首页 > 其他好文 > 详细

开启turbine收集hystrix指标功能

时间:2018-03-12 18:36:17      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:work   localhost   置配   art   tar   启动   static   depend   framework   

使用turbine收集hystrix指标

1、pom中引入对turbin的依赖,并增加dashboard图形界面的展示

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

2、配置配置文件,设置需要收集指标的服务

# 配置Eureka中的serviceId列表, 表明监控哪些服务
turbine.app-config=ms-provider
# 指定聚合哪些集群, 多个使用","分割, 默认为default.
# 可使用http://.../turbine.stream?cluster={clusterConfig之一}访问
turbine.aggregator.cluster-config=default
turbine.cluster-name-expression=new String("default")
turbine.instanceUrlSuffix=manage/hystrix.stream

3、设置启动类

@SpringBootApplication
@EnableHystrixDashboard
@EnableTurbine
public class MsDashboardApplication {
    // 直接监控某服务的hystrix: http://localhost:10000/hystrix.stream

    // DashBoard: http://localhost:10000/hystrix
    // 单台监控:在界面输入 http://localhost:10000/hystrix  
    // 多台监控(通过turbine):http://localhost:10000/turbine.stream
    public static void main(String[] args) {
        SpringApplication.run(MsDashboardApplication.class, args);
    }
}

说明: @EnableTurbine开启turbine的支持、@EnableHystrixDashboard允许使用图形化的界面展示。

至此,就就完成了turbine收集指标的准备工作。

开启turbine收集hystrix指标功能

标签:work   localhost   置配   art   tar   启动   static   depend   framework   

原文地址:https://www.cnblogs.com/liangzs/p/8550175.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!