Spring Boot v2.2.6.RELEASE 和 Turbine - 无法聚合矩阵
Spring Boot v2.2.6.RELEASE and Turbine - Unable to aggregate the metrix
我正在研究 Spring Boot v2.2.6.RELEASE + Eureka + Hystrix 和 Turbine。在发布这个问题之前,我浏览了许多链接,例如:
Spring Boot Turbine
但这两种解决方案都不适合我。
application.properties
server.port=8085
eureka.client.register-with-eureka=false
management.endpoints.web.cors.allowed-origins=true
#turbine settings
turbine.app-config=tollrate-billboard,fastpass-console
turbine.aggregator.clusterConfig=TOLLRATE-BILLBOARD,FASTPASS-CONSOLE
turbine.cluster-name-expression= new String("default")
turbine.combine-host-port=true
turbine.instanceUrlSuffix.default=/hystrix.stream
CoHystrixDashboardApplication.java
@EnableTurbine
@EnableHystrixDashboard
@SpringBootApplication
public class CoHystrixDashboardApplication {
public static void main(String[] args) {
SpringApplication.run(CoHystrixDashboardApplication.class, args);
}
}
即使我多次点击 url : http://localhost:8082/customerdetails?fastpassid=101
,聚合详细信息也不会出现在 Hystrix 中。
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>co-hystrix-dashboard</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>co-hystrix-dashboard</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR3</spring-cloud.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Hystrix Dashboard -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<!-- Turbine -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>
spring-cloud-starter-netflix-turbine
</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我能够使用以下更改解决此问题 -
我不得不从 fastpass-console
和 tollrate-billboard
.
中删除 management.endpoints.web.base-path=/
现在,当我点击:http://localhost:8085/turbine.stream?cluster=TOLLRATE-BILLBOARD
时,我会在此处获取详细信息 -
现在,当我点击:**http://localhost:8085/turbine.stream?cluster=FASTPASS-CONSOLE**
时,我会在此处获取详细信息 -
我正在研究 Spring Boot v2.2.6.RELEASE + Eureka + Hystrix 和 Turbine。在发布这个问题之前,我浏览了许多链接,例如:
Spring Boot Turbine
但这两种解决方案都不适合我。
application.properties
server.port=8085
eureka.client.register-with-eureka=false
management.endpoints.web.cors.allowed-origins=true
#turbine settings
turbine.app-config=tollrate-billboard,fastpass-console
turbine.aggregator.clusterConfig=TOLLRATE-BILLBOARD,FASTPASS-CONSOLE
turbine.cluster-name-expression= new String("default")
turbine.combine-host-port=true
turbine.instanceUrlSuffix.default=/hystrix.stream
CoHystrixDashboardApplication.java
@EnableTurbine
@EnableHystrixDashboard
@SpringBootApplication
public class CoHystrixDashboardApplication {
public static void main(String[] args) {
SpringApplication.run(CoHystrixDashboardApplication.class, args);
}
}
即使我多次点击 url : http://localhost:8082/customerdetails?fastpassid=101
,聚合详细信息也不会出现在 Hystrix 中。
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>co-hystrix-dashboard</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>co-hystrix-dashboard</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR3</spring-cloud.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Hystrix Dashboard -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<!-- Turbine -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>
spring-cloud-starter-netflix-turbine
</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我能够使用以下更改解决此问题 -
我不得不从 fastpass-console
和 tollrate-billboard
.
management.endpoints.web.base-path=/
现在,当我点击:http://localhost:8085/turbine.stream?cluster=TOLLRATE-BILLBOARD
时,我会在此处获取详细信息 -
现在,当我点击:**http://localhost:8085/turbine.stream?cluster=FASTPASS-CONSOLE**
时,我会在此处获取详细信息 -