Class ObservationApplicationEventListener

java.lang.Object
org.glassfish.jersey.micrometer.server.ObservationApplicationEventListener
All Implemented Interfaces:
ApplicationEventListener

public class ObservationApplicationEventListener extends Object implements ApplicationEventListener
The Micrometer ApplicationEventListener which registers RequestEventListener for instrumenting Jersey server requests with observations.
Since:
2.41
Author:
Marcin Grzejszczak
  • Constructor Details

    • ObservationApplicationEventListener

      public ObservationApplicationEventListener(io.micrometer.observation.ObservationRegistry observationRegistry, String metricName)
    • ObservationApplicationEventListener

      public ObservationApplicationEventListener(io.micrometer.observation.ObservationRegistry observationRegistry, String metricName, JerseyObservationConvention jerseyObservationConvention)
  • Method Details

    • onEvent

      public void onEvent(ApplicationEvent event)
      Description copied from interface: ApplicationEventListener
      Process the application event. This method is called when new event occurs.
      Specified by:
      onEvent in interface ApplicationEventListener
      Parameters:
      event - Application event.
    • onRequest

      public RequestEventListener onRequest(RequestEvent requestEvent)
      Description copied from interface: ApplicationEventListener
      Process a new request and return a request event listener if listening to request events is required. The method is called once for each new incoming request. If listening to the request is required then request event must be returned from the method. Such a request event listener will receive all request events that one request. If listening to request event for the request is not required then null must be returned from the method (do not return empty mock listener in these cases as it will have negative performance impact).
      Specified by:
      onRequest in interface ApplicationEventListener
      Parameters:
      requestEvent - Event of type RequestEvent.Type.START.
      Returns:
      Request event listener that will monitor the events of the request connected with requestEvent; null otherwise.