[英]Spring boot Prometheus , micrometer not able to publish data
I am using micrometer to publish some event 我正在使用千分尺发布一些事件
import io.micrometer.core.instrument.Metrics;
/**
*
* @param eventName : event name to publish
*/
public static void recordEvent(String eventName){
Metrics.counter(eventName).increment();
}
and calling it from my application class like this 然后从我的应用程序类中调用它
metricsCollector.recordEvent("metric name");
and mapping prometheus end point like this in properties file 并在属性文件中映射prometheus端点
endpoints.prometheus.path=metrics
but when i go to the http://localhost:8082/metrics i am not able to see the event 但是当我转到http:// localhost:8082 / metrics时,我无法看到该事件
I assumed it to be some problem with the registry and tried to add registry like this 我认为这是注册表的一些问题,并试图添加这样的注册表
Metrics.addRegistry(new CompositeMeterRegistry());
but it also didn't worked out. 但它也没有成功。
Spring boot version : 1.5.9
Java version 1.8
Spring Boot 1.x doesn't have built-in support for micrometer. Spring Boot 1.x没有对千分尺的内置支持。 That's in Spring boot 2.x.
那是在Spring Boot 2.x中。 For custom metrics in Spring Boot 1.x see here: https://docs.spring.io/spring-boot/docs/1.5.9.RELEASE/reference/htmlsingle/#production-ready-enabling
有关Spring Boot 1.x中的自定义指标,请参见此处: https : //docs.spring.io/spring-boot/docs/1.5.9.RELEASE/reference/htmlsingle/#production-ready-enabling
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.