Unable to get /hystrix.stream in Spring Cloud

二次信任 提交于 2020-01-01 10:48:29

问题


I have created a microservice with following dependencies of Spring cloud version Camden.SR2. Spring Boot 1.4.1. http://localhost:8080/hystrix.stream is not responding.

If I make the Spring Cloud version as Brixton.*(RELEASE, SR1,...), I get only ping: as reply in browser.

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-hystrix</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

application.properties

spring.application.name=sample-service
server.port = 8080

Application

@SpringBootApplication
@EnableCircuitBreaker
public class SampleApplication {

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

回答1:


In Spring Boot 1.5.x Hystrix.stream will only show data if there are actually call's being executed that are annotated with @HystrixCommand

If you annotate a method it will publish data to the stream when its being used.

More info: http://cloud.spring.io/spring-cloud-static/Brixton.SR6/#_circuit_breaker_hystrix_clients




回答2:


For those who are using spring boot 2 (I am using 2.0.2.RELEASE), the hystrix.stream endpoint has been moved to /actuator/hystrix.stream.

For me this url worked:

http://localhost:8082/actuator/hystrix.stream

And yes, have this actuator endpoint enabled via following property:

management.endpoints.web.exposure.include=hystrix.stream


来源:https://stackoverflow.com/questions/40447916/unable-to-get-hystrix-stream-in-spring-cloud

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!