I enabled Wildfly metrics and I got the default ones exposed on 9990/metrics. This works perfectly fine, but I’m now having issues with adding metrics to the same endpoint.
I was trying to add custom metrics e.g. user logins count, failed user logins count, and I followed this Microprofile README but with no success.
I tried injecting the MetricRegistry
@Inject @RegistryType(type = MetricRegistry.Type.APPLICATION) private MetricRegistry applicationRegistry;
but it doesn’t get injected, ie. it’s null which breaks when trying to use it for creating eg a custom Counter.
I was expecting that I’d inject this registry and then use it to create custom metrics in something like an event listener SPI, or any other custom SPI.
Why doesn’t this work? How can I get the registry which is used for 9990/metrics, or what other options do I have to export custom metrics?