简体   繁体   English

如何在代码中获取 spring-boot-actuator 指标数据?

[英]How can I get the spring-boot-actuator metrics data in code?

I know that we can use web url to get the metrics.我知道我们可以使用网址来获取指标。 However, I want to get the data that created by spring-boot-actuator in my code.但是,我想在我的代码中获取由 spring-boot-actuator 创建的数据。 I want to program to get the metrics and then publish to other destination in my spring-boot project.我想编程以获取指标,然后在我的 spring-boot 项目中发布到其他目的地。 The micormeter-registy-xxxx can not solve my problem. micrometer-registy-xxxx 不能解决我的问题。

If you want to publish the data to another destination, you need to implement your own registry.如果要将数据发布到另一个目的地,则需要实现自己的注册表。 Take a look at other registries to see how to do it.查看其他注册表以了解如何操作。

If you want to push metrics to logs or use the data as string, you can take a look at LogingMeterRegistry and SimpleMeterRegistry#getMetersAsString .如果您想将指标推送到日志或将数据用作字符串,您可以查看LogingMeterRegistrySimpleMeterRegistry#getMetersAsString

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM