Class OkHttpContext
java.lang.Object
io.micrometer.observation.Observation.Context
io.micrometer.observation.transport.SenderContext<okhttp3.Request.Builder>
io.micrometer.observation.transport.RequestReplySenderContext<okhttp3.Request.Builder, okhttp3.Response>
io.micrometer.core.instrument.binder.okhttp3.OkHttpContext
- All Implemented Interfaces:
io.micrometer.observation.Observation.ContextView, io.micrometer.observation.transport.ResponseContext<okhttp3.Response>, Supplier<OkHttpContext>
public class OkHttpContext
extends io.micrometer.observation.transport.RequestReplySenderContext<okhttp3.Request.Builder, okhttp3.Response>
implements Supplier<OkHttpContext>
A
SenderContext for OkHttp3.- Since:
- 1.10.0
-
Constructor Summary
ConstructorsConstructorDescriptionOkHttpContext(Function<okhttp3.Request, String> urlMapper, Iterable<io.micrometer.common.KeyValue> extraTags, Iterable<BiFunction<okhttp3.Request, @Nullable okhttp3.Response, io.micrometer.common.KeyValue>> contextSpecificTags, boolean includeHostTag, okhttp3.Request request) OkHttpContext(Function<okhttp3.Request, String> urlMapper, Iterable<io.micrometer.common.KeyValue> extraTags, Iterable<BiFunction<okhttp3.Request, @Nullable okhttp3.Response, io.micrometer.common.KeyValue>> contextSpecificTags, Iterable<io.micrometer.common.KeyValue> ignored, boolean includeHostTag, okhttp3.Request request) Deprecated.please use other constructor(s). -
Method Summary
Modifier and TypeMethodDescriptionget()okhttp3.Request.BuilderIterable<BiFunction<okhttp3.Request, @Nullable okhttp3.Response, io.micrometer.common.KeyValue>> Iterable<io.micrometer.common.KeyValue> okhttp3.RequestDeprecated.Deprecated in favor ofgetRequest().okhttp3.RequestIterable<io.micrometer.common.KeyValue> Deprecated.The request cannot be null according to the OkHttp APIbooleanokhttp3.RequestOkHttpContextbeing aRequestReplySenderContextmeans that during context-propagation, the request needs to be modified (extra headers are added).Methods inherited from class io.micrometer.observation.transport.RequestReplySenderContext
getResponse, setResponseMethods inherited from class io.micrometer.observation.transport.SenderContext
getKind, getRemoteServiceAddress, getRemoteServiceName, getSetter, 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
-
Constructor Details
-
OkHttpContext
public OkHttpContext(Function<okhttp3.Request, String> urlMapper, Iterable<io.micrometer.common.KeyValue> extraTags, Iterable<BiFunction<okhttp3.Request, @Nullable okhttp3.Response, io.micrometer.common.KeyValue>> contextSpecificTags, boolean includeHostTag, okhttp3.Request request) - Since:
- 1.17.0
-
OkHttpContext
@Deprecated public OkHttpContext(Function<okhttp3.Request, String> urlMapper, Iterable<io.micrometer.common.KeyValue> extraTags, Iterable<BiFunction<okhttp3.Request, @Nullable okhttp3.Response, io.micrometer.common.KeyValue>> contextSpecificTags, Iterable<io.micrometer.common.KeyValue> ignored, boolean includeHostTag, okhttp3.Request request) Deprecated.please use other constructor(s).
-
-
Method Details
-
rebuildAndGetRequest
public okhttp3.Request rebuildAndGetRequest()OkHttpContextbeing aRequestReplySenderContextmeans that during context-propagation, the request needs to be modified (extra headers are added). SinceRequestis immutable,OkHttpContextuses its builder as its "carrier" object (the builder is mutable). This means that after the builder mutation happens, the request stays the same unless this method is called which rebuilds the request using the modified builder (enhanced with the extra headers). It's unlikely that you need to call this method multiple times, once the builder was mutated, you can rebuild the request once and usegetRequest()subsequently.- Returns:
- request
- Since:
- 1.17.0
-
getUrlMapper
-
getExtraTags
-
getContextSpecificTags
public Iterable<BiFunction<okhttp3.Request, @Nullable okhttp3.Response, io.micrometer.common.KeyValue>> getContextSpecificTags() -
getUnknownRequestTags
Deprecated.The request cannot be null according to the OkHttp API -
isIncludeHostTag
public boolean isIncludeHostTag() -
getRequest
public okhttp3.Request getRequest()- Returns:
- request
- Since:
- 1.17.0
-
getOriginalRequest
Deprecated.Deprecated in favor ofgetRequest(). -
get
- Specified by:
getin interfaceSupplier<OkHttpContext>
-
getCarrier
public okhttp3.Request.Builder getCarrier()- Overrides:
getCarrierin classio.micrometer.observation.transport.SenderContext<okhttp3.Request.Builder>
-