Spring 执行器 - 来自 docker 个容器的指标聚合

Spring Actuator - metrics aggregation from docker containers

我有一个 Spring Boot REST 服务应用程序。此应用程序使用 Spring Actuator 来显示指标和健康信息。我如何从两个或多个容器 运行 同一应用程序中聚合此信息?

您需要将指标导出到中央系统。

Spring Boot provides a couple of implementations of a marker interface called Exporter which can be used to copy metric readings from the in-memory buffers to a place where they can be analyzed and displayed.

更具体地说,我个人喜欢将指标导出到 statsD

To export metrics to Statsd, make sure first that you have added com.timgroup:java-statsd-client as a dependency of your project (Spring Boot provides a dependency management for it). Then add a spring.metrics.export.statsd.host value to your application.properties file. Connections will be opened to port 8125 unless a spring.metrics.export.statsd.port override is provided. You can use spring.metrics.export.statsd.prefix if you want a custom prefix.

以上信息全部来自Spring关于指标的引导文档:https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-metrics.html