Class ServerRequestObservationContext
java.lang.Object
io.micrometer.observation.Observation.Context
io.micrometer.observation.transport.ReceiverContext<ServerHttpRequest>
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionServerRequestObservationContext(ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> attributes) Create a newServerRequestObservationContextinstance. -
Method Summary
Modifier 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.RequestReplyReceiverContext
getResponse, setResponseMethods inherited from class io.micrometer.observation.transport.ReceiverContext
getCarrier, getGetter, getKind, getRemoteServiceAddress, getRemoteServiceName, setCarrier, setRemoteServiceAddress, setRemoteServiceNameMethods inherited from class io.micrometer.observation.Observation.Context
addHighCardinalityKeyValue, 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micrometer.observation.Observation.ContextView
getOrDefault
-
Field Details
-
CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE
-
-
Constructor Details
-
ServerRequestObservationContext
public ServerRequestObservationContext(ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> attributes) Create a newServerRequestObservationContextinstance.- Parameters:
request- the current requestresponse- the current responseattributes- the current attributes
-
-
Method Details
-
getAttributes
-
getPathPattern
-
setPathPattern
-
isConnectionAborted
public 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
-
setConnectionAborted
public 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
-
findCurrent
Get the currentobservation contextfrom the given attributes, if available.- Parameters:
attributes- the current exchange attributes- Returns:
- the current observation context
- Since:
- 6.1
-