像我之前的其他几个人一样,我无法通过我的服务报告的hystrix流被涡轮机(本地,而不是amqp)聚合。我已经在SO上阅读了所有问题和答案,应用了他们的建议并且无处可去。这是我的设置。
版本:Brixton M4
在localhost上运行的服务:eureka,zuul,myservice,myservice2,turbine
myservice和myservice2是公开hystrix.stream
的微服务。与zuul一样,我可以直接连接到这些turbine.stream
端点并查看数据。 spring:
application:
name: turbine
server:
port: 8989
management:
port: 8990
turbine:
aggregator:
clusterNameExpression: metadata['cluster']
clusterConfig: LOCAL
appConfig: myservice,myservice2,zuul
InstanceMonitor:
eventStream:
skipLineLogic:
enabled: false
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
info:
component: Turbine!
始终为空。
turbine application.yml
此配置的涡轮机部分几乎直接来自spring cloud docs中的示例。
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
metadataMap:
cluster: LOCAL
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
3项服务均包括:
<applications>
<versions__delta>1</versions__delta>
<apps__hashcode>UP_4_</apps__hashcode>
<application>
<name>MYSERVICE</name>
<instance>
<instanceId>192.168.43.128:myservice:2222</instanceId>
<hostName>192.168.43.128</hostName>
<app>MYSERVICE</app>
<ipAddr>192.168.43.128</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">2222</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>10</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1453382031096</registrationTimestamp>
<lastRenewalTimestamp>1453382630966</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1453382031096</serviceUpTimestamp>
</leaseInfo>
<metadata>
<cluster>LOCAL</cluster>
</metadata>
从http://localhost:8761/eureka/apps
验证Eureka中的元数据地图是否正确o.s.c.n.t.CommonsInstanceDiscovery : Fetching instance list for apps: [myservice, myservice2, zuul]
o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instances for app: myservice
o.s.c.n.turbine.EurekaInstanceDiscovery : Received instance list for app: myservice, size=1
o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instances for app: myservice2
o.s.c.n.turbine.EurekaInstanceDiscovery : Received instance list for app: myservice2, size=1
o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instances for app: zuul
o.s.c.n.turbine.EurekaInstanceDiscovery : Received instance list for app: zuul, size=1
c.n.t.discovery.InstanceObservable : Retrieved hosts from InstanceDiscovery: 3
c.n.t.discovery.InstanceObservable : Found hosts that have been previously terminated: 0
当我运行涡轮机时,它正在Eureka中找到服务实例,但却没有选择它们来报告数据:
DEBUG
将日志记录提升到c.n.t.discovery.InstanceObservable : Retrieved hosts from InstanceDiscovery: [StatsInstance [hostname=192.168.43.128, cluster: MYSERVICE, isUp: true, attrs={cluster=LOCAL, port=2222}], StatsInstance [hostname=192.168.43.128, cluster: MYSERVICE2, isUp: true, attrs={cluster=LOCAL, port=2223}], StatsInstance [hostname=192.168.43.128, cluster: ZUUL, isUp: true, attrs={cluster=LOCAL, port=8765}]]
时显示的另一个(可能有用的?)日志行:
{{1}}
答案 0 :(得分:1)
好吧没关系,我在调试器中运行涡轮机时发现这是一个愚蠢的错误。 clusterNameExpression
是turbine
而非aggregator
的孩子。
纠正错误后,我可以看到逗号分隔列表中的第一个服务报告涡轮流中的数据而不是其他服务。这是预期的吗?即涡轮机是否设计用于监控来自构成相同逻辑应用的多个微服务的流,还是纯粹用于同一微服务的多个实例?