Class ServerHttpObservationFilter

All Implemented Interfaces:
Filter, Aware, BeanNameAware, DisposableBean, InitializingBean, EnvironmentAware, EnvironmentCapable, ServletContextAware

public class ServerHttpObservationFilter extends OncePerRequestFilter
Filter that creates observations for HTTP exchanges. This collects information about the execution time and information gathered from the ServerRequestObservationContext.

Web Frameworks can fetch the current context as a request attribute and contribute additional information to it. The configured ServerRequestObservationConvention will use this context to collect metadata and attach it to the observation.

Since:
6.0
Author:
Brian Clozel
  • Field Details

    • CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE

      public static final String CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE
      Name of the request attribute holding the context for the current observation.
  • Constructor Details

    • ServerHttpObservationFilter

      public ServerHttpObservationFilter(io.micrometer.observation.ObservationRegistry observationRegistry)
      Create an HttpRequestsObservationFilter that records observations against the given ObservationRegistry. The default convention will be used.
      Parameters:
      observationRegistry - the registry to use for recording observations
    • ServerHttpObservationFilter

      public ServerHttpObservationFilter(io.micrometer.observation.ObservationRegistry observationRegistry, ServerRequestObservationConvention observationConvention)
      Create an HttpRequestsObservationFilter that records observations against the given ObservationRegistry with a custom convention.
      Parameters:
      observationRegistry - the registry to use for recording observations
      observationConvention - the convention to use for all recorded observations
  • Method Details