【问题标题】:Unable to get /hystrix.stream in Spring Cloud无法在 Spring Cloud 中获取 /hystrix.stream
【发布时间】:2017-03-19 18:39:39
【问题描述】:

我创建了一个微服务,它具有以下 Spring Cloud 版本 Camden.SR2 的依赖项。春季启动 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


    【解决方案1】:

    在 Spring Boot 1.5.x 中,Hystrix.stream 仅在实际执行的调用被 @HystrixCommand 注释时才会显示数据

    如果你注释一个方法,它会在使用它时将数据发布到流中。

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

    【讨论】:

      【解决方案2】:

      对于使用spring boot 2的人(我使用2.0.2.RELEASE)hystrix.stream端点已移至/actuator/hystrix.stream

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

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

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

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

      【讨论】:

        猜你喜欢
        • 2017-03-09
        • 2016-07-28
        • 2018-05-26
        • 2018-07-04
        • 2023-04-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-11-21
        相关资源
        最近更新 更多