Class OkHttpObservationInterceptor.Builder
java.lang.Object
io.micrometer.core.instrument.binder.okhttp3.OkHttpObservationInterceptor.Builder
- Enclosing class:
OkHttpObservationInterceptor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringHeader name for URI patterns which will be used for tag values. -
Method Summary
Modifier and TypeMethodDescriptionbuild()includeHostTag(boolean includeHostTag) Historically, OkHttp Metrics provided byOkHttpObservationInterceptorincluded ahosttag 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 aKeyValueto 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 aKeyValueto 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 byOkHttpObservationInterceptorincluded ahosttag for the target host being called. To align with other HTTP client metrics, this was changed totarget.host, but to maintain backwards compatibility thehosttag can also be included. By default,includeHostTagis true so both tags are included.- Parameters:
includeHostTag- whether to include thehosttag- Returns:
- this builder
-
requestTagKeys
KeyValue keys forRequest.tag()orRequest.tag(Class).These keys will be added with UNKNOWN values when
Requestis 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
Requestis 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
-