Class OkHttpObservationInterceptor.Builder
java.lang.Object
io.micrometer.core.instrument.binder.okhttp3.OkHttpObservationInterceptor.Builder
- Enclosing class:
OkHttpObservationInterceptor
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Header name for URI patterns which will be used for tag values. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
includeHostTag
(boolean includeHostTag) Historically, OkHttp Metrics provided byOkHttpObservationInterceptor
included ahost
tag for the target host being called.observationConvention
(OkHttpObservationConvention observationConvention) requestTagKeys
(Iterable<String> requestTagKeys) KeyValue keys forRequest.tag()
orRequest.tag(Class)
.requestTagKeys
(String... requestTagKeys) KeyValue keys forRequest.tag()
orRequest.tag(Class)
.tag
(io.micrometer.common.KeyValue tag) Add aKeyValue
to any already configured tags on this Builder.tag
(BiFunction<okhttp3.Request, okhttp3.Response, io.micrometer.common.KeyValue> contextSpecificTag) Add a context-specific tag.
-
Field Details
-
URI_PATTERN
Header name for URI patterns which will be used for tag values.- See Also:
-
-
Method Details
-
tags
-
observationConvention
public OkHttpObservationInterceptor.Builder observationConvention(OkHttpObservationConvention observationConvention) -
tag
Add aKeyValue
to any already configured tags on this Builder.- Parameters:
tag
- tag to add- Returns:
- this builder
-
tag
public OkHttpObservationInterceptor.Builder tag(BiFunction<okhttp3.Request, okhttp3.Response, io.micrometer.common.KeyValue> contextSpecificTag) Add a context-specific tag.- Parameters:
contextSpecificTag
- function to create a context-specific tag- Returns:
- this builder
-
uriMapper
-
includeHostTag
Historically, OkHttp Metrics provided byOkHttpObservationInterceptor
included ahost
tag for the target host being called. To align with other HTTP client metrics, this was changed totarget.host
, but to maintain backwards compatibility thehost
tag can also be included. By default,includeHostTag
is true so both tags are included.- Parameters:
includeHostTag
- whether to include thehost
tag- Returns:
- this builder
-
requestTagKeys
KeyValue keys forRequest.tag()
orRequest.tag(Class)
.These keys will be added with UNKNOWN values when
Request
is null. Note that this is required only for Prometheus as it requires tag match for the same metric.- Parameters:
requestTagKeys
- request tag keys- Returns:
- this builder
-
requestTagKeys
KeyValue keys forRequest.tag()
orRequest.tag(Class)
.These keys will be added with UNKNOWN values when
Request
is null. Note that this is required only for Prometheus as it requires tag match for the same metric.- Parameters:
requestTagKeys
- request tag keys- Returns:
- this builder
-
build
-