简体   繁体   English

在spring boot中导出指标

[英]Exporting metrics in spring boot

spring boot shows all the possible metrics in /metrics endpoint. spring boot显示/metrics端点中的所有可能指标。 on the other hand, internally it uses metrics exporters. 另一方面,它在内部使用指标导出器。 for example when you add dropwizard metrics (current de facto standard?) it gets registered automatically but not all spring-boot metrics are exported to dropwizard. 例如,当您添加dropwizard指标(当前事实上的标准?)时,它会自动注册,但并非所有spring-boot指标都会导出到dropwizard。 in order to have more/all metrics, one has to manually register different metric sets. 为了获得更多/所有指标,必须手动注册不同的指标集。 and it has to be maintained in parallel to what spring-boot does for /metrics endpoint. 它必须与spring-boot为/metrics端点做的并行维护。

so the question is: how it should be done properly? 所以问题是:如何正确完成? should i use metrics exporters and maintain it for each of dozens microservices or use Collection<PublicMetrics> used by /metrics endpoint and maintained by spring? 我应该使用指标导出器并为每个数十个微服务维护它,还是使用/metrics端点使用的Collection<PublicMetrics>并由spring维护?

Use only dropwizard metrics to instrument your code since it has a more intuitive API then the Spring. 仅使用dropwizard指标来检测代码,因为它具有比Spring更直观的API。

With the spring-dropwizard ( http://metrics.ryantenney.com/ ) integration, all dropwizard metrics are getting exposed to the endpoint /metrics, so you do not need to register anything manually. 使用spring-dropwizard( http://metrics.ryantenney.com/ )集成,所有dropwizard指标都会暴露给端点/指标,因此您无需手动注册任何内容。

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

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