Spring boot 指标不';I don’我不会出现在/prometheus端点上

Spring boot 指标不';I don’我不会出现在/prometheus端点上,spring-boot,spring-cloud,hystrix,prometheus,micrometer,Spring Boot,Spring Cloud,Hystrix,Prometheus,Micrometer,我有两项服务,ping和pong,其中ping向pong发送请求。此度量显示在ping服务的/metrics端点上: gauge.servo.hystrix.hystrixcommand。http://pong.pongclient#hello().90 但是它没有出现在/prometheus端点上。此端点上会显示其他指标,但不会显示包含有关Faign/Hystrix http请求信息的伺服指标 如何让这些指标出现在/prometheus端点上 我的build.gradle compile 'o

我有两项服务,
ping
pong
,其中
ping
pong
发送请求。此度量显示在
ping
服务的
/metrics
端点上:

gauge.servo.hystrix.hystrixcommand。http://pong.pongclient#hello().90

但是它没有出现在
/prometheus
端点上。此端点上会显示其他指标,但不会显示包含有关Faign/Hystrix http请求信息的伺服指标

如何让这些指标出现在
/prometheus
端点上

我的
build.gradle

compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.cloud:spring-cloud-starter-eureka'
compile 'org.springframework.cloud:spring-cloud-starter-hystrix'
compile 'org.springframework.cloud:spring-cloud-starter-feign'
compile 'org.springframework.retry:spring-retry'
compile "io.micrometer:micrometer-core:${micrometerVersion}"
compile "io.micrometer:micrometer-spring-legacy:${micrometerVersion}"
compile "io.micrometer:micrometer-registry-prometheus:${micrometerVersion}"
使用以下版本

springCloudVersion = 'Dalston.SR4'
micrometerVersion = '1.0.0-rc.4'

代码可在此处找到

您需要为spring boot服务插入指令并进行配置,以便使用prometheus进行监控,如下所示:

  • 您需要在gradle.build文件中包含依赖项
  • 您需要实现度量端点
  • 您需要添加来自Prometheus JVM的标准导出器

  • 有关如何实现的更多实施细节,请参见示例,您还需要手动添加Hystrix插件:

    HystrixPlugins.getInstance().registerMetricsPublisher(new MicrometerMetricsPublisher(Metrics.globalRegistry));
    
    您可以将其添加到配置中的
    @PostConstruct


    我创建此项服务是为了在将来解决这个缺点。

    您可以添加一个到源的链接吗?请澄清:我看到了/prometheus端点上的指标。只是我没有看到
    servo
    指标中有关于使用Feign/Hystrix进行http请求的信息。这都是通过他使用
    千分尺弹簧遗产
    解决的。Dimenomer.io将是监视Spring应用程序的首选方法,因为它被烘焙到SpringBoot 2中。这个答案并没有具体解决Hystrix metrics没有出现的问题,而且两个示例都没有引用Hystrix。