如何从 spring boot 应用程序 CF 集群向 Prometheus 公开指标

How to expose metrics to Prometheus from springboot application CF cluster

我正在使用 Springboot (Jhipster) 从头开发一个应用程序,并打算部署在具有多个节点的 cloudfoundry 中。计划设置可以从集群中提取指标的普罗米修斯服务器。

我想了解如何设置 Prometheus 来查询集群的各个节点。由于应用部署在cloud foundry,可能无法获取到个别节点的ip地址。

因为我是 Prometheus 的新手,所以想确保我的解决方案是正确的。

我建议使用 Micrometer.io

您可以使用服务发现(例如 Netflix Eureka)或以某种形式使用 Pushgateway。 https://prometheus.io/docs/instrumenting/pushing/ https://prometheus.github.io/client_java/io/prometheus/client/exporter/PushGateway.html