SpringCloud Hystrix通過(guò)Turbine和Consul進(jìn)行指標(biāo)匯總

2023-12-04 16:19 更新

Turbine(由Spring Cloud Netflix項(xiàng)目提供)匯總了多個(gè)實(shí)例Hystrix指標(biāo)流,因此儀表板可以顯示匯總視圖。Turbine使用DiscoveryClient接口查找相關(guān)實(shí)例。要將Turbine與Spring Cloud Consul結(jié)合使用,請(qǐng)以類(lèi)似于以下示例的方式配置Turbine應(yīng)用程序:

pom.xml。 

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-netflix-turbine</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>

請(qǐng)注意,Turbine依賴(lài)項(xiàng)不是啟動(dòng)器。渦輪啟動(dòng)器包括對(duì)Netflix Eureka的支持。

application.yml。 

spring.application.name: turbine
applications: consulhystrixclient
turbine:
  aggregator:
    clusterConfig: ${applications}
  appConfig: ${applications}

clusterConfigappConfig部分必須匹配,因此將以逗號(hào)分隔的服務(wù)ID列表放入單獨(dú)的配置屬性中很有用。

Turbine。java。 

@EnableTurbine
@SpringBootApplication
public class Turbine {
    public static void main(String[] args) {
        SpringApplication.run(DemoturbinecommonsApplication.class, args);
    }
}

以上內(nèi)容是否對(duì)您有幫助:
在線(xiàn)筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)