我的設置是春季啓動雲使用netflix庫 我設法讓Turbine從一個服務聚合Hystrix指標。但是,當我添加更多的服務,我不能看到他們。如何添加到渦輪額外的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指標(航班集成服務,優惠券服務) 謝謝。
您是否嘗試使用turbine.aggregator取消註釋部分,然後添加'?cluster = FLIGHT-INTEGRATION-SERVICE'或' ?cluster = COUPON-SERVICE'到您放入hystrix儀表板的渦輪機網址? – spencergibb
但是,如果我添加LIGHT-INTEGRATION-SERVICE或?cluster = COUPON-SERVICE,那麼我將一次彙總一項服務。我希望看到渦輪機上的所有服務。 – rayman
這不是默認情況下渦輪機的構建方式。 spring-cloud-netflix-turbine-amqp彙總所有服務。 https://github.com/spring-cloud/spring-cloud-netflix/tree/master/spring-cloud-netflix-turbine-amqp – spencergibb