无法在Spring Cloud中获取/hystrix.stream

问题描述 投票:4回答:2

我创建了一个微服务,具有以下Spring云版本Camden.SR2的依赖关系。 Spring Boot 1.4.1。 http://localhost:8080/hystrix.stream没有回应。

如果我将Spring Cloud版本设为Brixton.*(RELEASE,SR1,...),我只能在浏览器中获得ping:作为回复。

<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

应用

@SpringBootApplication
@EnableCircuitBreaker
public class SampleApplication {

    public static void main(String[] args) {
        SpringApplication.run(SampleApplication.class, args);
    }
}
spring-cloud hystrix spring-cloud-netflix
2个回答
5
投票

在Spring Boot 1.5.x中,Hystrix.stream只会显示数据,如果实际正在执行的调用使用@HystrixCommand进行注释

如果您注释方法,它将在使用时将数据发布到流。

更多信息:http://cloud.spring.io/spring-cloud-static/Brixton.SR6/#_circuit_breaker_hystrix_clients


10
投票

对于那些使用弹簧靴2的人(我正在使用2.0.2.RELEASE)hystrix.stream端点已被移动到/actuator/hystrix.stream

对我来说,这个网址有效:

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

是的,通过以下属性启用此执行器端点:

management.endpoints.web.exposure.include=hystrix.stream
© www.soinside.com 2019 - 2024. All rights reserved.