Cloud Foundry 上的多个应用程序实例未显示在 Netflix Hystrix 仪表板中

Multiple app instances on Cloud Foundry not shown in Netflix Hystrix dashboard

我在 Cloud Foundry 上设置了 Netflix Eureka、Hystrix 和 Turbine,分为两个应用程序:

监控应用程序 "mrc-service" 包括 Eureka Server、Turbine 和 Hystrix Dashboard。此应用程序的 application.yml 如下所示:

---
spring:
  profiles: cloud
eureka:
  instance:
    nonSecurePort: 80
    hostname: ${vcap.application.uris[0]}
    leaseRenewalIntervalInSeconds: 10
    metadataMap:
      instanceId: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
  client:
    registerWithEureka: true
    fetchRegistry: true
    service-url:
      defaultZone: https://mrc-service.myurl/eureka/

turbine:
  aggregator:
    clusterConfig: LOG-TEST
  appConfig: log-test

名为 "log-test" 的 Hystrix 流生成应用程序在 Cloud Foundry 上有多个实例。该应用程序是一个 Eureka 客户端,并使用 Spring 执行器公开一个 Hystrix 流。这里是应用程序的 application.yml:

---
spring:
  profiles: cloud
eureka:
  instance:
    nonSecurePort: 80
    hostname: ${vcap.application.uris[0]}
    metadataMap:
      instanceId: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
    secure-port-enabled: true
  client:
    healthcheck:
        enabled: true
    service-url:
      defaultZone: https://mrc-service.myurl/eureka/

log-test 应用程序的两个实例正确注册到 Eureka 服务器:

但是当我开始监控涡轮流时,Hystrix 仪表板只显示一台主机(如红色箭头所示)而不是两台:

Turbine 日志正确检索了两个实例,但随后说只有一个主机启动:

2017-08-23T10:12:10.764+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instances for app: log-test
2017-08-23T10:12:10.764+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Received instance list for app: log-test, size=2
2017-08-23T10:12:10.764+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.763 INFO 19 --- [ Timer-0] o.s.c.n.t.CommonsInstanceDiscovery : Fetching instance list for apps: [log-test]
2017-08-23T10:12:10.764+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Retrieved hosts from InstanceDiscovery: 2
2017-08-23T10:12:10.765+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Found hosts that have been previously terminated: 0
2017-08-23T10:12:10.765+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 DEBUG 19 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Retrieved hosts from InstanceDiscovery: [StatsInstance [hostname=log-test.myurl:80, cluster: LOG-TEST, isUp: true, attrs={securePort=443, fusedHostPort=log-test.myurl:443, instanceId=log-test:97d83c44-8b9e-44c4-56b4-742cef7bada0, port=80}], StatsInstance [hostname=log-test.myurl:80, cluster: LOG-TEST, isUp: true, attrs={securePort=443, fusedHostPort=log-test.myurl:443, instanceId=log-test:3d8359e4-a5c1-4aa0-5109-5b49a77a1f6f, port=80}]]
2017-08-23T10:12:10.765+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Hosts up:1, hosts down: 0

所以我想知道Turbine是否真的聚合了两个实例的Hystrix流。涡轮机必须联系实例,例如使用 Cloud Foundry 特定的 header 参数,例如 X-CF-APP-INSTANCE。不确定这是否已经发生了。

所描述的方法在 Cloud Foundry 上是否可行,或者我是否必须将 Turbine Stream 与 RabbitMQ 结合使用?

以聚合方式开启Turbine,步骤同Hystrix,但需要通过Turbine通知集群:http://localhost:8989//turbine.stream?cluster=READ.

这将打开与 Hystrix 相同的屏幕,但如果我有更多服务,它们将以聚合方式显示。

我从 Spring Cloud Netflix 问题跟踪器得到了一个官方 reply:来自 Cloud Foundry 上多个应用程序实例的 Hystrix 数据的聚合需要 Turbine Stream 与代理(例如 RabbitMQ)相结合。