【问题标题】:Hystrix metrics in the actuator/metrics endpoint [spring-boot 2.0]执行器/指标端点中的 Hystrix 指标 [spring-boot 2.0]
【发布时间】:2018-11-16 15:10:33
【问题描述】:

是否可以通过类似于 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”等术语的任何引用。

我已经用@EnableCircuitBreakerhystrix:metrics:enabled: true 配置了我的应用程序。

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

【问题讨论】:

    标签: spring-boot hystrix spring-boot-actuator


    【解决方案1】:

    tutorial 之后,您必须将以下 bean 添加到您的应用程序中以注册 Hystrix Metrics Binder:

    @Configuration
    public class MetricsConfig {
    
    @Bean
    HystrixMetricsBinder registerHystrixMetricsBinder() {
        return new HystrixMetricsBinder();
     }
    }
    

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

    hystrix.errors{event="short_circuited"}

    【讨论】:

    • @JoelC 经过一些测试,建议的答案有效。你能删除你的 -1 吗?
    • 很好听;抱歉,我看不出这是如何回答这个问题的。 -1 不是我的,如果可以的话,我会删除我之前的评论。
    猜你喜欢
    • 2018-07-08
    • 2018-11-29
    • 2015-07-04
    • 1970-01-01
    • 2021-11-12
    • 1970-01-01
    • 2020-10-26
    • 2019-09-21
    • 2016-07-24
    相关资源
    最近更新 更多