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.observation.reactive.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 during observations
for
reactive HTTP exchanges.
This context also extends RequestReplyReceiverContext for propagating
tracing information with the HTTP server exchange.
- Since:
- 6.0
- Author:
- Brian Clozel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the path pattern for the handler that matches the current request.Return the currentHTTP exchange.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(PathPattern 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, getRemoteServiceName, setCarrier, setRemoteServiceNameMethods inherited from class io.micrometer.observation.Observation.Context
addHighCardinalityKeyValue, addHighCardinalityKeyValues, addLowCardinalityKeyValue, addLowCardinalityKeyValues, clear, computeIfAbsent, containsKey, get, getAllKeyValues, getContextualName, getError, getHighCardinalityKeyValues, getLowCardinalityKeyValues, getName, getOrDefault, getParentObservation, getRequired, put, remove, setContextualName, setError, setName, setParentObservation, toString
-
Constructor Details
-
ServerRequestObservationContext
-
-
Method Details
-
getServerWebExchange
Return the currentHTTP exchange. -
getPathPattern
Return 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
-
setPathPattern
Set 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}".
-
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
-