I’m trying to add some metrics to my custom RealmResourceProvider and would like the metrics to show up in the /metrics endpoint.
I have tried this in my RealmResourceProvider
@Timed(name = "work-time",
description = "Metrics to monitor time to do work",
unit = MetricUnits.MINUTES,
absolute = true)
@GET
@Path("/dowork")
public String doWork() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return "work done!";
}
But the metric does not show up in the /metrics result.
Im running on Keycloak 13.0.0 using the docker image and have enabled metrics using the KEYCLOAK_STATISTICS environment variable.
Have i completely misunderstod how to add metrics in a Wildfly application or is there some special Keycloak trickery that needs to be done?