Class ServerRequestObservationContext
java.lang.Object
io.micrometer.observation.Observation.Context
io.micrometer.observation.transport.ReceiverContext<C>
io.micrometer.observation.transport.RequestReplyReceiverContext<ServerHttpRequest,ServerHttpResponse>
 
org.springframework.http.server.reactive.observation.ServerRequestObservationContext
- All Implemented Interfaces:
- io.micrometer.observation.Observation.ContextView,- io.micrometer.observation.transport.ResponseContext<ServerHttpResponse>
public class ServerRequestObservationContext
extends io.micrometer.observation.transport.RequestReplyReceiverContext<ServerHttpRequest,ServerHttpResponse> 
Context that holds information for metadata collection regarding
 
reactive HTTP requests
 observations.
 This context also extends RequestReplyReceiverContext for propagating
 tracing information during HTTP request processing.
- Since:
- 6.0
- Author:
- Brian Clozel
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionServerRequestObservationContext(ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> attributes) Create a newServerRequestObservationContextinstance.
- 
Method SummaryModifier and TypeMethodDescriptionfindCurrent(Map<String, Object> attributes) Get the currentobservation contextfrom the given attributes, if available.Return an immutable map of the current request attributes.Return the path pattern for the handler that matches the current request.booleanWhether the current connection was aborted by the client, resulting in acancel signalon the reactive chain, or anAbortedExceptionwhen reading the request.voidsetConnectionAborted(boolean connectionAborted) Set whether the current connection was aborted by the client, resulting in acancel signalon the reactive chain, or anAbortedExceptionwhen reading the request.voidsetPathPattern(@Nullable String pathPattern) Set the path pattern for the handler that matches the current request.Methods inherited from class io.micrometer.observation.transport.RequestReplyReceiverContextgetResponse, setResponseMethods inherited from class io.micrometer.observation.transport.ReceiverContextgetCarrier, getGetter, getKind, getRemoteServiceAddress, getRemoteServiceName, setCarrier, setRemoteServiceAddress, setRemoteServiceNameMethods inherited from class io.micrometer.observation.Observation.ContextaddHighCardinalityKeyValue, addHighCardinalityKeyValues, addLowCardinalityKeyValue, addLowCardinalityKeyValues, clear, computeIfAbsent, containsKey, get, getAllKeyValues, getContextualName, getError, getHighCardinalityKeyValue, getHighCardinalityKeyValues, getLowCardinalityKeyValue, getLowCardinalityKeyValues, getName, getOrDefault, getParentObservation, getRequired, put, remove, removeHighCardinalityKeyValue, removeHighCardinalityKeyValues, removeLowCardinalityKeyValue, removeLowCardinalityKeyValues, setContextualName, setError, setName, setParentObservation, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micrometer.observation.Observation.ContextViewgetOrDefault
- 
Field Details- 
CURRENT_OBSERVATION_CONTEXT_ATTRIBUTEName of the request attribute holding thecontextfor the current observation.- Since:
- 6.1
 
 
- 
- 
Constructor Details- 
ServerRequestObservationContextpublic ServerRequestObservationContext(ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> attributes) Create a newServerRequestObservationContextinstance.- Parameters:
- request- the current request
- response- the current response
- attributes- the current attributes
 
 
- 
- 
Method Details- 
getAttributesReturn an immutable map of the current request attributes.
- 
getPathPatternReturn the path pattern for the handler that matches the current request. For example,"/projects/{name}".Path patterns must have a low cardinality for the entire application. - Returns:
- the path pattern, or nullif none found
 
- 
setPathPatternSet the path pattern for the handler that matches the current request.Path patterns must have a low cardinality for the entire application. - Parameters:
- pathPattern- the path pattern, for example- "/projects/{name}".
 
- 
isConnectionAbortedpublic boolean isConnectionAborted()Whether the current connection was aborted by the client, resulting in acancel signalon the reactive chain, or anAbortedExceptionwhen reading the request.- Returns:
- if the connection has been aborted
 
- 
setConnectionAbortedpublic void setConnectionAborted(boolean connectionAborted) Set whether the current connection was aborted by the client, resulting in acancel signalon the reactive chain, or anAbortedExceptionwhen reading the request.- Parameters:
- connectionAborted- if the connection has been aborted
 
- 
findCurrentGet the currentobservation contextfrom the given attributes, if available.- Parameters:
- attributes- the current exchange attributes
- Returns:
- the current observation context
- Since:
- 6.1
 
 
-