Search code examples
javaspring-bootspring-cloud-netflixhystrix

Unable to connect to Command Metric Stream in hystrix dashboard


I am trying to build simple spring cloud application using Netflix eureka service discovery and hystrix circuit breaker .

Circuit Breaker Service:

@EnableCircuitBreaker
@SpringBootApplication
@EnableEurekaClient
public class PluralsightEurekaFastpassConsoleApplication {

    public static void main(String[] args) {
        SpringApplication.run(PluralsightEurekaFastpassConsoleApplication.class, args);
    }
}

pom.xml

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>
                spring-cloud-starter-netflix-hystrix
            </artifactId>
        </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>

Hystrix Dashboard

@EnableHystrixDashboard
@SpringBootApplication
@EnableDiscoveryClient
public class PluralsiteHystrixDashboardApplication {

    public static void main(String[] args) {
        SpringApplication.run(PluralsiteHystrixDashboardApplication.class, args);
    }
}

pom.xml

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </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>

hystrix dashboard hystrix-dashboard

Console Log

2018-07-04 20:15:25.051 INFO 17516 --- [nio-8088-exec-1] ashboardConfiguration$ProxyStreamServlet : Proxy opening connection to: http://localhost:8088/actuator/hystrix.stream 2018-07-04 20:15:25.052 INFO 17516 --- [nio-8088-exec-6] ashboardConfiguration$ProxyStreamServlet : Proxy opening connection to: http://localhost:8088/actuator/hystrix.stream 2018-07-04 20:15:25.058 WARN 17516 --- [nio-8088-exec-1] ashboardConfiguration$ProxyStreamServlet : Failed opening connection to http://localhost:8088/actuator/hystrix.stream : 404 : HTTP/1.1 404 2018-07-04 20:15:25.058 WARN 17516 --- [nio-8088-exec-6] ashboardConfiguration$ProxyStreamServlet : Failed opening connection to http://localhost:8088/actuator/hystrix.stream : 404 : HTTP/1.1 404

I tried Unable to connect to Command Metric Stream for Hystrix Dashboard with Spring Cloud

but the problem still exist .


Solution

  • The question doesn't provide enough information, so probably the best would be to make sure that:

    1. A Circuit Breaker Service is running on port 8088
    2. A spring boot actuator endpoints in the Circuit breaker service are indeed deployed and accessible under actuator context path. In order to check where the actuator actually is, analyze the startup logs, and if there is no information about deployed endpoints, add --debug to the application startup of the micro-service.

    It looks like the second step will reveal the real issue. Then the actuator context path can be set up by using management.context-path or hystix dashboard should be customized