Package org.springframework.web.filter.reactive

# Class ServerHttpObservationFilter

java.lang.Object
org.springframework.web.filter.reactive.ServerHttpObservationFilter

All Implemented Interfaces:
  `WebFilter`

@Deprecated(since="6.1", forRemoval=true) public class ServerHttpObservationFilter extends Object implements WebFilter
Deprecated, for removal: This API element is subject to removal in a future version.
since 6.1 in favor of `WebHttpHandlerBuilder`.
`WebFilter` 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 Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE`
Deprecated, for removal: This API element is subject to removal in a future version.
Name of the request attribute holding the `context` for the current observation.

## Constructor Summary

Constructors
Constructor
Description
`ServerHttpObservationFilter(io.micrometer.observation.ObservationRegistry observationRegistry)`
Deprecated, for removal: This API element is subject to removal in a future version.
Create an `HttpRequestsObservationWebFilter` that records observations against the given `ObservationRegistry`.
`ServerHttpObservationFilter(io.micrometer.observation.ObservationRegistry observationRegistry, ServerRequestObservationConvention observationConvention)`
Deprecated, for removal: This API element is subject to removal in a future version.
Create an `HttpRequestsObservationWebFilter` that records observations against the given `ObservationRegistry` with a custom convention.

## Method Summary

Modifier and Type
Method
Description
`reactor.core.publisher.Mono<Void>`
`filter(ServerWebExchange exchange, WebFilterChain chain)`
Deprecated, for removal: This API element is subject to removal in a future version.
Process the Web request and (optionally) delegate to the next `WebFilter` through the given `WebFilterChain`.
`static Optional<ServerRequestObservationContext>`
`findObservationContext(ServerWebExchange exchange)`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the current `observation context` from the given request, if available.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE

public static final String CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE
Deprecated, for removal: This API element is subject to removal in a future version.
Name of the request attribute holding the `context` for the current observation.

## Constructor Details

### ServerHttpObservationFilter

public ServerHttpObservationFilter(io.micrometer.observation.ObservationRegistry observationRegistry)
Deprecated, for removal: This API element is subject to removal in a future version.
Create an `HttpRequestsObservationWebFilter` 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)
Deprecated, for removal: This API element is subject to removal in a future version.
Create an `HttpRequestsObservationWebFilter` 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

### findObservationContext

public static Optional<ServerRequestObservationContext> findObservationContext(ServerWebExchange exchange)
Deprecated, for removal: This API element is subject to removal in a future version.
Get the current `observation context` from the given request, if available.

Parameters:
  `exchange` - the current exchange
Returns:
  the current observation context

### filter

public reactor.core.publisher.Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain)
Deprecated, for removal: This API element is subject to removal in a future version.
Description copied from interface: `WebFilter`
Process the Web request and (optionally) delegate to the next `WebFilter` through the given `WebFilterChain`.

Specified by:
  `filter` in interface `WebFilter`
Parameters:
  `exchange` - the current server exchange
  `chain` - provides a way to delegate to the next filter
Returns:
  `Mono<Void>` to indicate when request processing is complete