我有一个Spring云应用程序充当涡轮服务器和Hystrix仪表板。它有一个Eureka客户端,仪表板出现正常,可以看到一个单独的Hystrix流,但我在涡轮机流中没有任何东西。
这是application.yml:
eureka:
client:
serviceUrl:
defaultZone: ${vcap.services.eureka-service.credentials.uri:http://10.12.2.99:8761}/eureka/
turbine:
aggregator:
clusterConfig: ITEMS-SERVICE
appConfig: items-service
如果我在Turbine / dashboard应用程序启动时查看日志,看起来它可以找到我的Hystrix服务:
2015-03-10 14:45:35.256 INFO 1383 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instance list for apps: [items-service]
2015-03-10 14:45:35.257 INFO 1383 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instances for app: items-service
2015-03-10 14:45:35.257 INFO 1383 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Received instance list for app: items-service, size=2
2015-03-10 14:45:35.264 INFO 1383 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Retrieved hosts from InstanceDiscovery: 2
2015-03-10 14:45:35.265 INFO 1383 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Found hosts that have been previously terminated: 0
2015-03-10 14:45:35.265 INFO 1383 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Hosts up:2, hosts down: 0
2015-03-10 14:45:35.270 INFO 1383 --- [ Timer-0] c.n.t.monitor.instance.InstanceMonitor : Url for host: http://nf-app1:8080/hystrix.stream ITEMS-SERVICE
2015-03-10 14:45:35.270 INFO 1383 --- [ Timer-0] c.n.t.handler.TurbineDataDispatcher :
Just added and starting handler tuple: ITEMS-SERVICE_agg_aggClusterEventHandler
2015-03-10 14:45:35.271 INFO 1383 --- [ Timer-0] c.n.turbine.data.AggDataFromCluster : Per handler dispacher started for: ITEMS-SERVICE_agg_aggClusterEventHandler
2015-03-10 14:45:35.273 INFO 1383 --- [ Timer-0] c.n.t.monitor.instance.InstanceMonitor : Url for host: http://nf-app2:8080/hystrix.stream ITEMS-SERVICE
如果我在
点击了涡轮流http://localhost:8080/turbine.stream?cluster=ITEMS-SERVICE
我明白了:
: ping
data: {"timestamp":1426018670641,"name":"meta","reportingHostsLast10Seconds":0,"type":"meta"}
: ping
data: {"timestamp":1426018673643,"name":"meta","reportingHostsLast10Seconds":0,"type":"meta"}
: ping
data: {"timestamp":1426018676645,"name":"meta","reportingHostsLast10Seconds":0,"type":"meta"}
当我查看Turbine /仪表板日志时,我没有看到任何错误:
2015-03-10 14:48:33.804 INFO 1383 --- [nio-8080-exec-1] c.n.t.s.servlet.TurbineStreamServlet : FilterCriteria: []
2015-03-10 14:48:33.804 INFO 1383 --- [nio-8080-exec-1] c.n.t.s.servlet.TurbineStreamServlet : StatsType filters: []
2015-03-10 14:48:33.808 INFO 1383 --- [nio-8080-exec-1] c.n.t.s.TurbineStreamingConnection : Relevance config: []
2015-03-10 14:48:33.808 INFO 1383 --- [nio-8080-exec-1] c.n.t.s.TurbineStreamingConnection : Relevance metrics config: {}
2015-03-10 14:48:33.809 INFO 1383 --- [nio-8080-exec-1] c.n.t.monitor.cluster.ClusterMonitor : Registering event handler for cluster monitor: StreamingHandler_f1b7fc33-d0ed-4206-9976-fd4b2347bdd5
2015-03-10 14:48:33.809 INFO 1383 --- [nio-8080-exec-1] c.n.t.handler.TurbineDataDispatcher :
Just added and starting handler tuple: StreamingHandler_f1b7fc33-d0ed-4206-9976-fd4b2347bdd5
2015-03-10 14:48:33.809 INFO 1383 --- [nio-8080-exec-1] c.n.turbine.data.AggDataFromCluster : Per handler dispacher started for: StreamingHandler_f1b7fc33-d0ed-4206-9976-fd4b2347bdd5
2015-03-10 14:48:33.809 INFO 1383 --- [nio-8080-exec-1] c.n.t.monitor.cluster.ClusterMonitor : All event handlers for cluster monitor: [StaticListener_For_Aggregator, StreamingHandler_f1b7fc33-d0ed-4206-9976-fd4b2347bdd5]
2015-03-10 14:48:33.809 INFO 1383 --- [nio-8080-exec-1] c.n.t.monitor.cluster.ClusterMonitor : Starting up the cluster monitor for ITEMS-SERVICE_agg
2015-03-10 14:48:35.265 INFO 1383 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instance list for apps: [items-service]
2015-03-10 14:48:35.266 INFO 1383 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instances for app: items-service
2015-03-10 14:48:35.266 INFO 1383 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Received instance list for app: items-service, size=2
2015-03-10 14:48:35.266 INFO 1383 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Retrieved hosts from InstanceDiscovery: 2
2015-03-10 14:48:35.266 INFO 1383 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Found hosts that have been previously terminated: 0
2015-03-10 14:48:35.267 INFO 1383 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Hosts up:2, hosts down: 0
如果我直接或通过仪表板(例如http://nf-app1:8080/hystrix.stream)点击其中一个项目流,我会获得有效的Hystrix数据。
看起来Turbine应用程序正在通过Eureka找到两个项目 - 服务,他们的Hystrix流端点是有效的,因此我无法弄清楚为什么Turbine流是空的。
答案 0 :(得分:3)
问题是Turbine运行的机器没有时间同步到运行Hysterix服务的机器。关于不同Turbine问题的This Answer表明Turbine默认会忽略“旧”事件。我尝试在我的application.yml中禁用turbine.InstanceMonitor.eventStream.skipLineLogic
,一切都开始工作了。