I am trying to configure my Micronaut Application with Micrometer and Prometheus. I want to do some calculation at the time of prometheus endpoint call. Can someone guide me here?
I tried to define a bean in Micronaut as follows, but it didn't get triggered and no metric with name SampleMetric was there:
@Prototype
public class MyBean {
@Inject
MeterRegistry registry;
public MyBean() {
Gauge.builder("SampleMetric", 12).register(registry);
// I also tried the following but that also didn't work
//registry.gauge("SampleMetric", 12);
}
}
Thanks in advance