【发布时间】:2016-04-26 02:14:09
【问题描述】:
我有一个启用了 Actuator 和 Hystrix 的 spring-boot-app。
Spring-Boot-版本:1.3.1.RELEASE
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
当我将@HystrixCommand添加到某些方法时,/metrics Endpoint 会显示来自 hystrix 的所有指标:
gauge.hystrix.HystrixCommand.RestEndpoints.TestController.test.errorPercentage: 0,
gauge.hystrix.HystrixThreadPool.RestEndpoints.rollingMaxActiveThreads: 1,
...
问题:
如何从/metricsendpoint 中完全排除 hystrix-metrics?
更新 1
我试图用这些方法排除 ServoMetrics 和 SpectatorMetrics:
1)
@EnableAutoConfiguration(exclude={ServoMetricsAutoConfiguration.class,
SpectatorMetricsAutoConfiguration.class} )
2)
@SpringBootApplication(exclude={ServoMetricServices.class, SpectatorMetricServices.class})
但两者都没有达到预期的效果。
【问题讨论】:
-
目前无法排除它们,除非您从依赖项中排除
com.netflix.hystrix:hystrix-metrics-event-stream,这也会导致/hystrix.stream也停止工作。 -
@spencergibb 感谢您的澄清。太糟糕了......这可能值得一个功能请求......
-
完成,看我的新答案。
-
哇,真快!谢谢你一千次!
标签: spring spring-boot spring-cloud hystrix spring-boot-actuator