【问题标题】:How to add into Turbine additional Hystrix metrics aggregations如何向 Turbine 添加额外的 Hystrix 指标聚合
【发布时间】:2015-08-15 08:45:14
【问题描述】:

我的设置是使用 netflix 库的 Spring Boot Cloud 我设法让 Turbine 从一项服务中聚合 Hystrix 指标。但是,当我添加更多服务时,我看不到它们。

这是我的设置(也将其上传到 github: Project On Github

服务 1:

FlightIntegrationService:

@SpringBootApplication
@EnableCircuitBreaker
@EnableDiscoveryClient
@ComponentScan("com.bootnetflix")
public class FlightIntegrationApplication {
..
}

application.yaml

server:
  port: 0

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    metadataMap:
      instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}}
  client:
    registryFetchIntervalSeconds: 5

bootstrap.yaml

spring:
  application:
    name: flight-integration-service

服务 2:

优惠券服务:

@SpringBootApplication
@EnableCircuitBreaker
@EnableDiscoveryClient
@ComponentScan("com.bootnetflix")
public class CouponServiceApp {
..
}

application yaml:

server:
  port: 0

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    metadataMap:
      instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}}
  client:
    registryFetchIntervalSeconds: 5

尤里卡应用服务:

@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication  {



Hystrix dashboard service:

    @SpringBootApplication
    @EnableHystrixDashboard
    @Controller
    public class HystrixDashboardApplication  {

application.yaml:

info:
  component: Hystrix Dashboard

endpoints:
  restart:
    enabled: true
  shutdown:
    enabled: true

server:
  port: 7979

logging:
  level:
    ROOT: INFO
    org.springframework.web: DEBUG

eureka:
  client:
    region: default


    preferSameZone: false

    us-east-1:
      availabilityZones: default

  instance:
    virtualHostName: ${spring.application.name}

bootstrap.yaml

spring:
  application:
    name: hystrixdashboard

最后是涡轮服务:

  EnableAutoConfiguration
    @EnableTurbine
    @EnableEurekaClient
    @EnableHystrixDashboard
    public class TurbineApplication {

application.yaml:

info:
  component: Turbine

PREFIX:

endpoints:
  restart:
    enabled: true
  shutdown:
    enabled: true

server:
  port: 8989

management:
  port: 8990



eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
  client:
      serviceUrl:
        defaultZone: http://localhost:8761/eureka/



#turbine:
 # aggregator:
  #  clusterConfig: FLIGHT-INTEGRATION-SERVICE,COUPON-SERVICE
  #appConfig: flight-integration-service,coupon-service


#turbine:
#  clusterNameExpression: 'default'
 # appConfig: flight-integration-service,coupon-service

turbine:
  appConfig: coupon-service,flight-integration-service
  clusterNameExpression: new String('default')




#As you can see I tried diff configurations.

我做错了什么?为什么我实际上不能汇总这两个服务 hystrix 指标(飞行集成服务、优惠券服务) 谢谢。

【问题讨论】:

  • 您是否尝试过取消注释带有turber.aggregator 的部分,然后将?cluster=FLIGHT-INTEGRATION-SERVICE?cluster=COUPON-SERVICE 添加到您放在hystrix 仪表板中的turber url?
  • 但如果我添加 LIGHT-INTEGRATION-SERVICE 或 ?cluster=COUPON-SERVICE ,我将一次聚合一项服务。我想在涡轮机上看到所有服务。
  • 默认情况下涡轮机不是这样构建的。 spring-cloud-netflix-turbine-amqp 聚合所有服务。 github.com/spring-cloud/spring-cloud-netflix/tree/master/…
  • 你能告诉我一个例子或一个链接,我应该如何以一种让涡轮将所有 hystrix commmands 指标聚合到 hystrixdashboard 的方式来实现它?

标签: spring-boot spring-cloud netflix hystrix turbine


【解决方案1】:

由@spencergibb 建议解决。我向每个客户端添加了 spring-boot-starter-amqp 的依赖项并创建了 rabbitMQ 代理。 Turbine 正在通过 amqp 聚合所有消息,我能够看到在我的 hystrix 仪表板服务器上聚合的所有 Hystrix 命令

【讨论】:

  • 能否请您在 github 中分享您的工作代码示例...我也遇到同样的问题...
猜你喜欢
  • 2017-10-24
  • 1970-01-01
  • 2015-12-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-12-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多