首页 > 解决方案 > 执行器/指标端点中的 Hystrix 指标 [spring-boot 2.0]

问题描述

是否可以以与 spring-boot 1.5 中类似的方式获取 hystrix 指标信息?

在 1.5 公制端点中,我有这样的东西:

"gauge.servo.hystrix.hystrixcommand.[service-name].[method].errorcount": 0,     
"gauge.servo.hystrix.hystrixcommand.[service-name].[method].requestcount": 0,
"gauge.servo.hystrix.hystrixcommand.[service-name].[method].latencytotal_mean": 0,

但是现在有了使用 Micrometer 的执行器/度量端点,我找不到对“hystrix”、“netflix”等术语的任何引用。

@EnableCircuitBreaker我已经用和配置了我的应用程序hystrix:metrics:enabled: true

有一些方法可以在不使用 hystrix.stream 端点的情况下获取这些信息吗?或者这应该有效,我做错了什么?

标签: spring-boothystrixspring-boot-actuator

解决方案


按照本教程,您必须将以下 bean 添加到您的应用程序以注册 Hystrix Metrics Binder:

@Configuration
public class MetricsConfig {

@Bean
HystrixMetricsBinder registerHystrixMetricsBinder() {
    return new HystrixMetricsBinder();
 }
}

正如本期中的解释,hystrix 指标现在应该如下所示:

hystrix.errors{event="short_circuited"}


推荐阅读