[英]Metrics not appearing at prometheus endpoint when I'm using micrometer's PrometheusMeterRegistry
[英]Custom metrics using Micrometer is not available in Prometheus endpoint
我在Java Spring Boot 1.5应用程序中使用Micrometer来为Prometheus刮取自定义指标。
我正在使用“ guageCollectionSize”方法来计算HashMap中的条目数。 当我打印测量值时,我得到了预期的正确输出。 但是问题是我无法在/ prometheus端点中查看自定义指标。
请在下面找到代码
private Map<String, String> _strings;
private MeterRegistry registry;
_strings = new ConcurrentHashMap<String, String>();
_strings.put("Test","Test");
_strings.put("Test2","Test");
registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
registry.gaugeCollectionSize("strings_count", Tags.empty(),_strings.keySet());
System.out.println(registry.get("strings_count").gauge().value());
有人可以帮我解决此问题吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.