Top Description Fields Constructors Methods
org.springframework.web.reactive.function.client

public Class ClientRequestObservationContext

extends RequestReplySenderContext<ClientRequest.Builder, ClientResponse>
Class Inheritance
Imports
java.util.Optional, io.micrometer.observation.transport.RequestReplySenderContext, org.springframework.lang.Nullable

Context that holds information for metadata collection during the HTTP client exchange observations.

The tracing context carrier is a request builder, since the actual request is immutable. For KeyValue extraction, the actual request should be used instead.

Author
Brian Clozel
Since
6.0

Field Summary

Modifier and TypeField and Description
private boolean
public static final String
CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE

Name of the request attribute holding the context for the current observation.

private ClientRequest
private String

Constructor Summary

AccessConstructor and Description
public
ClientRequestObservationContext()
Deprecated for removal since 6.1.2. as of 6.1.2, in favor of ClientRequestObservationContext(ClientRequest.Builder)

Create a new Observation context for HTTP client observations.

public
ClientRequestObservationContext(ClientRequest.Builder
client request builder
request
)

Create a new Observation context for HTTP client observations.

Method Summary

Modifier and TypeMethod and Description
public static Optional<ClientRequestObservationContext>

Returns:

the current observation context
findCurrent
(ClientRequest
the current client request
request
)

Get the current observation context from the given request, if available.

public ClientRequest
getRequest()

Return the immutable client request.

public String
getUriTemplate()

Return the URI template used for the current client exchange, null if none was used.

public boolean

Returns:

whether the exchange has been aborted
isAborted
()

Whether the client aborted the current HTTP exchange before receiving any response.

pack-priv void
setAborted(boolean
whether the exchange has been aborted
aborted
)

Set whether the client aborted the current HTTP exchange.

public void
setRequest(ClientRequest request)

Set the client request.

private static void
public void
setUriTemplate(String uriTemplate)

Set the URI template used for the current client exchange.

Inherited from io.micrometer.observation.transport.RequestReplySenderContext:
getResponsesetResponse

Field Detail

abortedback to summary
private boolean aborted
CURRENT_OBSERVATION_CONTEXT_ATTRIBUTEback to summary
public static final String CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE

Name of the request attribute holding the context for the current observation.

Since
6.0.15
requestback to summary
private ClientRequest request
Annotations
@Nullable
uriTemplateback to summary
private String uriTemplate
Annotations
@Nullable

Constructor Detail

ClientRequestObservationContextback to summary
public ClientRequestObservationContext()

Deprecated

for removal since 6.1.2.

as of 6.1.2, in favor of ClientRequestObservationContext(ClientRequest.Builder)

Create a new Observation context for HTTP client observations.

Annotations
@Deprecated
since:6.1.2
forRemoval:true
ClientRequestObservationContextback to summary
public ClientRequestObservationContext(ClientRequest.Builder request)

Create a new Observation context for HTTP client observations.

Parameters
request:ClientRequest.Builder

client request builder

Since
6.1.2

Method Detail

findCurrentback to summary
public static Optional<ClientRequestObservationContext> findCurrent(ClientRequest request)

Get the current observation context from the given request, if available.

Parameters
request:ClientRequest

the current client request

Returns:Optional<ClientRequestObservationContext>

the current observation context

Since
6.0.15
getRequestback to summary
public ClientRequest getRequest()

Return the immutable client request.

Annotations
@Nullable
getUriTemplateback to summary
public String getUriTemplate()

Return the URI template used for the current client exchange, null if none was used.

Annotations
@Nullable
isAbortedback to summary
public boolean isAborted()

Whether the client aborted the current HTTP exchange before receiving any response.

Returns:boolean

whether the exchange has been aborted

setAbortedback to summary
pack-priv void setAborted(boolean aborted)

Set whether the client aborted the current HTTP exchange.

Parameters
aborted:boolean

whether the exchange has been aborted

setRequestback to summary
public void setRequest(ClientRequest request)

Set the client request.

setRequestHeaderback to summary
private static void setRequestHeader(ClientRequest.Builder request, String name, String value)
setUriTemplateback to summary
public void setUriTemplate(String uriTemplate)

Set the URI template used for the current client exchange.