-
public final class OkHttpInstrumentationConfigConfiguration for automatic instrumentation of okhttp requests.
-
-
Field Summary
Fields Modifier and Type Field Description private static List<String>capturedRequestHeadersprivate static List<String>capturedResponseHeadersprivate static Set<String>knownMethodsprivate static Map<String, String>peerServiceMappingprivate static booleanemitExperimentalHttpClientMetrics
-
Method Summary
Modifier and Type Method Description static List<String>getCapturedRequestHeaders()static voidsetCapturedRequestHeaders(List<String> requestHeaders)Configures the HTTP request headers that will be captured as span attributes as described inHTTPsemantic conventions. static List<String>getCapturedResponseHeaders()static voidsetCapturedResponseHeaders(List<String> responseHeaders)Configures the HTTP response headers that will be captured as span attributes as described inHTTPsemantic conventions. static Set<String>getKnownMethods()static voidsetKnownMethods(Set<String> knownMethods)Configures the attrs extractor to recognize an alternative set of HTTP request methods. static voidsetPeerServiceMapping(Map<String, String> peerServiceMapping)Configures the extractor of the {@code peer.service}span attribute, described in thespecification.static voidsetEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics)When enabled keeps track of non-stableHTTP client metrics: static PeerServiceResolvernewPeerServiceResolver()static booleanemitExperimentalHttpClientMetrics()-
-
Method Detail
-
getCapturedRequestHeaders
static List<String> getCapturedRequestHeaders()
-
setCapturedRequestHeaders
static void setCapturedRequestHeaders(List<String> requestHeaders)
Configures the HTTP request headers that will be captured as span attributes as described inHTTPsemantic conventions.
The HTTP request header values will be captured under the
{@code * http.request.header.}attribute key. The{@code }part in the attribute key isthe normalized header name: lowercase, with dashes replaced by underscores.- Parameters:
requestHeaders- A list of HTTP header names.
-
getCapturedResponseHeaders
static List<String> getCapturedResponseHeaders()
-
setCapturedResponseHeaders
static void setCapturedResponseHeaders(List<String> responseHeaders)
Configures the HTTP response headers that will be captured as span attributes as described inHTTPsemantic conventions.
The HTTP response header values will be captured under the
{@code * http.response.header.}attribute key. The{@code }part in the attribute key isthe normalized header name: lowercase, with dashes replaced by underscores.- Parameters:
responseHeaders- A list of HTTP header names.
-
getKnownMethods
static Set<String> getKnownMethods()
-
setKnownMethods
static void setKnownMethods(Set<String> knownMethods)
Configures the attrs extractor to recognize an alternative set of HTTP request methods.
By default, the extractor defines "known" methods as the ones listed in RFC9110 and the PATCHmethod defined in . If anunknown method is encountered, the extractor will use the value {@value HttpConstants#_OTHER} instead of it and put the original value in an extra attribute.
Note: calling this method overrides the default known method sets completely; itdoes not supplement it.
- Parameters:
knownMethods- A set of recognized HTTP request methods.
-
setPeerServiceMapping
static void setPeerServiceMapping(Map<String, String> peerServiceMapping)
Configures the extractor of the
{@code peer.service}span attribute, described in thespecification.
-
setEmitExperimentalHttpClientMetrics
static void setEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics)
When enabled keeps track of non-stableHTTP client metrics:
-
newPeerServiceResolver
static PeerServiceResolver newPeerServiceResolver()
-
emitExperimentalHttpClientMetrics
static boolean emitExperimentalHttpClientMetrics()
-
-
-
-