2015-05-14 107 views
5

我在Spring Boot + Spring云项目中使用ConfigServer。我曾经监视端点/运行状况,但由于ConfigClient在每个请求中都询问ConfigServer,因此调用度量标准“/ health”的速度很慢。Spring Cloud - Config Client减慢度量/健康

这是由于这样一个事实,即对于ConfigServer的每一个请求,这个实际上都会调用BitBucket - >因此整个请求链很长/很慢。

有没有办法来禁用ConfigServer的检查可用?我想单独监视这一个。

最佳 周五

回答

3

目前不。你多久检查一次健康状况?您可以提交问题以拥有禁用健康检查的属性。

您可以通过扩展ConfigServerHealthIndicator和覆盖doHealthCheck来解决此问题。

在做这样的事情:

@Bean 
public ConfigServerHealthIndicator configServerHealthIndicator(
     ConfigServicePropertySourceLocator locator) { 
    return new MyEmptyConfigServerHealthIndicator(locator); 
} 
+0

好,谢谢,我会创造一个功能请求。 – Fritz

+0

在此处添加了一项功能请求:https://github.com/spring-cloud/spring-cloud-config/issues/159 – Fritz

1

为了解决问题,需要做的客户端应用程序的更改如下:

需要更改的build.gradle文件相关

编译(” org.springframework.cloud:spring-cloud-config-client:1.0.4.RELEASE“)

在bootstrap.yml中为客户端应用程序添加一段代码

健康: 配置:启用 :对于假