gpt4 book ai didi

spring - Spring Actuator-来自Docker容器的指标聚合

转载 作者:行者123 更新时间:2023-12-02 18:23:19 25 4
gpt4 key购买 nike

我有一个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 Boot文档中的指标: https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-metrics.html

关于spring - Spring Actuator-来自Docker容器的指标聚合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42393102/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com