Class OkHttpMetricsEventListener
java.lang.Object
okhttp3.EventListener
io.micrometer.core.instrument.binder.okhttp3.OkHttpMetricsEventListener
EventListener
for collecting metrics from OkHttpClient
.
uri tag is usually limited to URI patterns to mitigate tag cardinality explosion but OkHttpClient
doesn't provide URI patterns. We provide "URI_PATTERN" header to support uri tag or you can
configure a URI mapper
to provide your own tag values for uri tag.
-
Nested Class Summary
Nested classes/interfaces inherited from class okhttp3.EventListener
okhttp3.EventListener.Companion, okhttp3.EventListener.Factory
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
Header name for URI patterns which will be used for tag values.Fields inherited from class okhttp3.EventListener
Companion, NONE
-
Constructor Summary
ModifierConstructorDescriptionprotected
OkHttpMetricsEventListener(MeterRegistry registry, String requestsMetricName, Function<okhttp3.Request,String> urlMapper, Iterable<Tag> extraTags, Iterable<BiFunction<okhttp3.Request,okhttp3.Response,Tag>> contextSpecificTags)
-
Method Summary
Modifier and TypeMethodDescriptionbuilder(MeterRegistry registry, String name)
void
callEnd(okhttp3.Call call)
void
callFailed(okhttp3.Call call, IOException e)
void
callStart(okhttp3.Call call)
void
responseHeadersEnd(okhttp3.Call call, okhttp3.Response response)
Methods inherited from class okhttp3.EventListener
cacheConditionalHit, cacheHit, cacheMiss, canceled, connectEnd, connectFailed, connectionAcquired, connectionReleased, connectStart, dnsEnd, dnsStart, proxySelectEnd, proxySelectStart, requestBodyEnd, requestBodyStart, requestFailed, requestHeadersEnd, requestHeadersStart, responseBodyEnd, responseBodyStart, responseFailed, responseHeadersStart, satisfactionFailure, secureConnectEnd, secureConnectStart
-
Field Details
-
URI_PATTERN
Header name for URI patterns which will be used for tag values.- See Also:
- Constant Field Values
-
-
Constructor Details
-
OkHttpMetricsEventListener
protected OkHttpMetricsEventListener(MeterRegistry registry, String requestsMetricName, Function<okhttp3.Request,String> urlMapper, Iterable<Tag> extraTags, Iterable<BiFunction<okhttp3.Request,okhttp3.Response,Tag>> contextSpecificTags)
-
-
Method Details
-
builder
-
callStart
public void callStart(okhttp3.Call call)- Overrides:
callStart
in classokhttp3.EventListener
-
callFailed
- Overrides:
callFailed
in classokhttp3.EventListener
-
callEnd
public void callEnd(okhttp3.Call call)- Overrides:
callEnd
in classokhttp3.EventListener
-
responseHeadersEnd
public void responseHeadersEnd(okhttp3.Call call, okhttp3.Response response)- Overrides:
responseHeadersEnd
in classokhttp3.EventListener
-