【问题标题】:How to enable spring-actuator to collect metrics from multiple applications如何启用 spring-actuator 从多个应用程序收集指标
【发布时间】:2019-09-12 11:45:32
【问题描述】:

我有一个 pod,它由多个容器组成,每个容器都有一个正在运行的应用程序。如何让执行器从这些应用程序中获取指标。我找不到这样做的方法。

Pod 中有四个微服务在不同的端口上运行,例如 8082、8080、8081、8083。但是执行器仅从运行在 8080(默认端口)上的微服务中抓取指标。

我尝试将代码部分中指示的应用程序属性添加到所有属性。但它没有用。这是application.property的内容:

management.endpoint.metrics.enabled=true  
management.endpoints.web.exposure.include=*  
management.endpoint.prometheus.enabled=true  
management.metrics.export.prometheus.enabled=true  
management.metrics.use-global-registry=true  
management.server.port=8888  

预期输出:我应该能够使用 /metrics 端点查看每个应用程序的指标。

【问题讨论】:

标签: spring-boot spring-boot-actuator


【解决方案1】:

我能够解决这个问题。步骤如下:

  1. 在 application.properties 中为每个服务配置单独的执行器端口。
  2. 在部署 yaml 中公开配置端口(在 kubernetes 的情况下)。

就是这样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-27
    • 1970-01-01
    • 2015-11-29
    • 1970-01-01
    • 1970-01-01
    • 2014-10-28
    • 1970-01-01
    相关资源
    最近更新 更多