Spring Boot v2.2.6.RELEASE和Turbine-无法聚合metrix [英] Spring Boot v2.2.6.RELEASE and Turbine - Unable to aggregate the metrix

查看:108
本文介绍了Spring Boot v2.2.6.RELEASE和Turbine-无法聚合metrix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 Spring Boot v2.2.6.RELEASE + Eureka + Hystrix and Turbine .在发布此问题之前,我经历了很多链接,例如:

I am working on Spring Boot v2.2.6.RELEASE + Eureka + Hystrix and Turbine. Before posting this question I went through many links like:

Spring Boot + Eureka Server + Hystrix与Turbine:空turbo.stream

涡轮仪表盘不是在Spring Cloud Microservice中为聚合加载

但是没有一个解决方案对我有用.

But neither solution worked for me.

application.properties

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

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的总体详细信息也不会出现.

Even If I hit url many times : http://localhost:8082/customerdetails?fastpassid=101, the aggregate details are not coming to the 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>

推荐答案

我能够使用以下更改来解决此问题-

I was able to solve this using below changes -

我必须从 fastpass-console tollrate-billboard中删除management.endpoints.web.base-path=/.

现在,当我点击:http://localhost:8085/turbine.stream?cluster=TOLLRATE-BILLBOARD时,我在这里获取详细信息-

Now when I hit: http://localhost:8085/turbine.stream?cluster=TOLLRATE-BILLBOARD, I am getting details here -

现在,当我点击:**http://localhost:8085/turbine.stream?cluster=FASTPASS-CONSOLE**时,我在这里获取详细信息-

Now when I hit: **http://localhost:8085/turbine.stream?cluster=FASTPASS-CONSOLE**, I am getting details here -

这篇关于Spring Boot v2.2.6.RELEASE和Turbine-无法聚合metrix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆