public static class OkHttpMetricsEventListener.Builder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
OkHttpMetricsEventListener |
build() |
OkHttpMetricsEventListener.Builder |
includeHostTag(boolean includeHostTag)
Historically, OkHttp Metrics provided by
OkHttpMetricsEventListener included a
host tag for the target host being called. |
OkHttpMetricsEventListener.Builder |
requestTagKeys(java.lang.Iterable<java.lang.String> requestTagKeys)
Tag keys for
Request.tag() or Request.tag(Class) . |
OkHttpMetricsEventListener.Builder |
requestTagKeys(java.lang.String... requestTagKeys)
Tag keys for
Request.tag() or Request.tag(Class) . |
OkHttpMetricsEventListener.Builder |
tag(java.util.function.BiFunction<okhttp3.Request,okhttp3.Response,Tag> contextSpecificTag)
Add a context-specific tag.
|
OkHttpMetricsEventListener.Builder |
tag(Tag tag)
Add a
Tag to any already configured tags on this Builder. |
OkHttpMetricsEventListener.Builder |
tags(java.lang.Iterable<Tag> tags) |
OkHttpMetricsEventListener.Builder |
uriMapper(java.util.function.Function<okhttp3.Request,java.lang.String> uriMapper) |
public OkHttpMetricsEventListener.Builder tags(java.lang.Iterable<Tag> tags)
public OkHttpMetricsEventListener.Builder tag(Tag tag)
Tag
to any already configured tags on this Builder.tag
- tag to addpublic OkHttpMetricsEventListener.Builder tag(java.util.function.BiFunction<okhttp3.Request,okhttp3.Response,Tag> contextSpecificTag)
contextSpecificTag
- function to create a context-specific tagpublic OkHttpMetricsEventListener.Builder uriMapper(java.util.function.Function<okhttp3.Request,java.lang.String> uriMapper)
public OkHttpMetricsEventListener.Builder includeHostTag(boolean includeHostTag)
OkHttpMetricsEventListener
included a
host
tag for the target host being called. To align with other HTTP client metrics,
this was changed to target.host
, but to maintain backwards compatibility the host
tag can also be included. By default, includeHostTag
is true so both tags are included.includeHostTag
- whether to include the host
tagpublic OkHttpMetricsEventListener.Builder requestTagKeys(java.lang.String... requestTagKeys)
Request.tag()
or Request.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.requestTagKeys
- request tag keyspublic OkHttpMetricsEventListener.Builder requestTagKeys(java.lang.Iterable<java.lang.String> requestTagKeys)
Request.tag()
or Request.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.requestTagKeys
- request tag keyspublic OkHttpMetricsEventListener build()