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 a MicrometerHttpClientInterceptor instance with DefaultUriMapper.
    MicrometerHttpClientInterceptor​(MeterRegistry meterRegistry, java.util.function.Function<org.apache.http.HttpRequest,​java.lang.String> uriMapper, java.lang.Iterable<Tag> extraTags, boolean exportTagsForRoute)
    Create a MicrometerHttpClientInterceptor 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 a MicrometerHttpClientInterceptor instance.
      Parameters:
      meterRegistry - meter registry to bind
      uriMapper - URI mapper to create uri tag
      extraTags - extra tags
      exportTagsForRoute - whether to export tags for route
    • MicrometerHttpClientInterceptor

      public MicrometerHttpClientInterceptor​(MeterRegistry meterRegistry, java.lang.Iterable<Tag> extraTags, boolean exportTagsForRoute)
      Create a MicrometerHttpClientInterceptor instance with DefaultUriMapper.
      Parameters:
      meterRegistry - meter registry to bind
      extraTags - extra tags
      exportTagsForRoute - whether to export tags for route
  • Method Details

    • getRequestInterceptor

      public org.apache.http.HttpRequestInterceptor getRequestInterceptor()
    • getResponseInterceptor

      public org.apache.http.HttpResponseInterceptor getResponseInterceptor()