Reputation: 11
I am new to Jersey and was exploring how to use Micrometer with Jersey. I am following https://docs.micrometer.io/micrometer/reference/reference/jetty.html
Goal
How can /metrics
endpoint come up?
How can I have an existing endpoint configured to be counted as some configuration?
@Path("sample")
public class Sample {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
}
}
Found some code snippet here but could not understand where to plugin below code.
Can someone please review and suggest.
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.register(new MetricsApplicationEventListener(
registry,
new DefaultJerseyTagsProvider(),
"http.server.requests",
true));
ServletContainer servletContainer = new ServletContainer(resourceConfig);
I did try adding a SimpleApplicationEventListener
and registering above but it doesn't work.
Upvotes: 0
Views: 86