Class OkHttpMetricsEventListener.Builder
java.lang.Object
io.micrometer.core.instrument.binder.okhttp3.OkHttpMetricsEventListener.Builder
- Enclosing class:
- OkHttpMetricsEventListener
public static class OkHttpMetricsEventListener.Builder
extends java.lang.Object
-
Method Summary
Modifier and Type Method Description OkHttpMetricsEventListener
build()
OkHttpMetricsEventListener.Builder
includeHostTag(boolean includeHostTag)
Historically, OkHttp Metrics provided byOkHttpMetricsEventListener
included ahost
tag for the target host being called.OkHttpMetricsEventListener.Builder
requestTagKeys(java.lang.Iterable<java.lang.String> requestTagKeys)
Tag keys forRequest.tag()
orRequest.tag(Class)
.OkHttpMetricsEventListener.Builder
requestTagKeys(java.lang.String... requestTagKeys)
Tag keys forRequest.tag()
orRequest.tag(Class)
.OkHttpMetricsEventListener.Builder
tag(Tag tag)
Add aTag
to any already configured tags on this Builder.OkHttpMetricsEventListener.Builder
tag(java.util.function.BiFunction<okhttp3.Request,okhttp3.Response,Tag> contextSpecificTag)
Add a context-specific tag.OkHttpMetricsEventListener.Builder
tags(java.lang.Iterable<Tag> tags)
OkHttpMetricsEventListener.Builder
uriMapper(java.util.function.Function<okhttp3.Request,java.lang.String> uriMapper)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
tags
-
tag
Add aTag
to any already configured tags on this Builder.- Parameters:
tag
- tag to add- Returns:
- this builder
- Since:
- 1.5.0
-
tag
public OkHttpMetricsEventListener.Builder tag(java.util.function.BiFunction<okhttp3.Request,okhttp3.Response,Tag> contextSpecificTag)Add a context-specific tag.- Parameters:
contextSpecificTag
- function to create a context-specific tag- Returns:
- this builder
- Since:
- 1.5.0
-
uriMapper
public OkHttpMetricsEventListener.Builder uriMapper(java.util.function.Function<okhttp3.Request,java.lang.String> uriMapper) -
includeHostTag
Historically, OkHttp Metrics provided byOkHttpMetricsEventListener
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
- Since:
- 1.5.0
-
requestTagKeys
Tag keys forRequest.tag()
orRequest.tag(Class)
. These keys will be added with UNKNOWN values whenRequest
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
- Since:
- 1.3.9
-
requestTagKeys
public OkHttpMetricsEventListener.Builder requestTagKeys(java.lang.Iterable<java.lang.String> requestTagKeys)Tag keys forRequest.tag()
orRequest.tag(Class)
. These keys will be added with UNKNOWN values whenRequest
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
- Since:
- 1.3.9
-
build
-