Class MicrometerHttpClientInterceptor
java.lang.Object
io.micrometer.core.instrument.binder.httpcomponents.MicrometerHttpClientInterceptor
@Incubating(since="1.4.0") public class MicrometerHttpClientInterceptor extends java.lang.Object
Provides
HttpRequestInterceptor
and HttpResponseInterceptor
for
configuring with an HttpAsyncClient
. Usage example:
MicrometerHttpClientInterceptor interceptor = new MicrometerHttpClientInterceptor(registry,
request -> request.getRequestLine().getUri(),
Tags.empty(),
true);
CloseableHttpAsyncClient httpAsyncClient = HttpAsyncClients.custom()
.addInterceptorFirst(interceptor.getRequestInterceptor())
.addInterceptorLast(interceptor.getResponseInterceptor())
.build();
- Since:
- 1.4.0
-
Constructor Summary
Constructors Constructor Description MicrometerHttpClientInterceptor(MeterRegistry meterRegistry, java.lang.Iterable<Tag> extraTags, boolean exportTagsForRoute)
Create aMicrometerHttpClientInterceptor
instance withDefaultUriMapper
.MicrometerHttpClientInterceptor(MeterRegistry meterRegistry, java.util.function.Function<org.apache.http.HttpRequest,java.lang.String> uriMapper, java.lang.Iterable<Tag> extraTags, boolean exportTagsForRoute)
Create aMicrometerHttpClientInterceptor
instance. -
Method Summary
Modifier and Type Method Description org.apache.http.HttpRequestInterceptor
getRequestInterceptor()
org.apache.http.HttpResponseInterceptor
getResponseInterceptor()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
MicrometerHttpClientInterceptor
public MicrometerHttpClientInterceptor(MeterRegistry meterRegistry, java.util.function.Function<org.apache.http.HttpRequest,java.lang.String> uriMapper, java.lang.Iterable<Tag> extraTags, boolean exportTagsForRoute)Create aMicrometerHttpClientInterceptor
instance.- Parameters:
meterRegistry
- meter registry to binduriMapper
- URI mapper to createuri
tagextraTags
- extra tagsexportTagsForRoute
- whether to export tags for route
-
MicrometerHttpClientInterceptor
public MicrometerHttpClientInterceptor(MeterRegistry meterRegistry, java.lang.Iterable<Tag> extraTags, boolean exportTagsForRoute)Create aMicrometerHttpClientInterceptor
instance withDefaultUriMapper
.- Parameters:
meterRegistry
- meter registry to bindextraTags
- extra tagsexportTagsForRoute
- whether to export tags for route
-
-
Method Details
-
getRequestInterceptor
public org.apache.http.HttpRequestInterceptor getRequestInterceptor() -
getResponseInterceptor
public org.apache.http.HttpResponseInterceptor getResponseInterceptor()
-