一.前言
- 上篇介绍 Hystrix Dashboard是Hystrix指标数据的可视化面板,主要依托于
spring-boot-actuator
暴露的监控接口,将@HystrixCommand
所修饰的方法的请求监控起来,集中展示 - 但是在实际的项目中,一个访问量比较大的拆分业务,往往启动不止一个实例,这个时候就需使用
turbine
将同一服务的所有实例监控信息,聚集到一起,然后在Hystrix Dashboard
面板上集中展示 - 项目地址完整例子传送门
- 此篇文章用到项目模块:
- 模块介绍:
1.eureka-server-standalone
: 提供注册中心的服务
2.hystrix-client
:提供接口服务
3.hystrix-consumer
: 消费接口服务,包含hystrix模块功能
4.hystrix-dashboard
:服务实例运行的监控面板
5.hystrix-turbine
:将多个服务实例的监控数据聚集到一起,进行联合监控
二.使用turbine进行服务监控
- 有时查看单个实例的监控数据不是很有用。Turbine是一个应用程序,它将所有相关/hystrix.stream端点数据聚合为一个/turbine.stream流,以便在Hystrix仪表板中查看
1.官网资料
2.创建hystrix-turbine项目
- 在启动类中
HystrixTurbineApplication.java
@EnableTurbine
@EnableDiscoveryClient
@SpringBootApplication
public class HystrixTurbineApplication {
public static void main(String[] args) {
SpringApplication.run(HystrixTurbineApplication.class, args);
}
}
加