Class OkHttpObservationInterceptor.Builder

java.lang.Object
io.micrometer.core.instrument.binder.okhttp3.OkHttpObservationInterceptor.Builder
Enclosing class:
OkHttpObservationInterceptor

public static class OkHttpObservationInterceptor.Builder extends Object
  • Field Details

    • URI_PATTERN

      public static final String URI_PATTERN
      Header name for URI patterns which will be used for tag values.
      See Also:
  • Method Details

    • tags

      public OkHttpObservationInterceptor.Builder tags(Iterable<io.micrometer.common.KeyValue> tags)
    • observationConvention

      public OkHttpObservationInterceptor.Builder observationConvention(OkHttpObservationConvention observationConvention)
    • tag

      public OkHttpObservationInterceptor.Builder tag(io.micrometer.common.KeyValue tag)
      Add a KeyValue to any already configured tags on this Builder.
      Parameters:
      tag - tag to add
      Returns:
      this builder
    • tag

      public OkHttpObservationInterceptor.Builder tag(BiFunction<okhttp3.Request,okhttp3.Response,io.micrometer.common.KeyValue> contextSpecificTag)
      Add a context-specific tag.
      Parameters:
      contextSpecificTag - function to create a context-specific tag
      Returns:
      this builder
    • uriMapper

      public OkHttpObservationInterceptor.Builder uriMapper(Function<okhttp3.Request,String> uriMapper)
    • includeHostTag

      public OkHttpObservationInterceptor.Builder includeHostTag(boolean includeHostTag)
      Historically, OkHttp Metrics provided by OkHttpObservationInterceptor 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.
      Parameters:
      includeHostTag - whether to include the host tag
      Returns:
      this builder
    • requestTagKeys

      public OkHttpObservationInterceptor.Builder requestTagKeys(String... requestTagKeys)
      KeyValue keys for 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.

      Parameters:
      requestTagKeys - request tag keys
      Returns:
      this builder
    • requestTagKeys

      public OkHttpObservationInterceptor.Builder requestTagKeys(Iterable<String> requestTagKeys)
      KeyValue keys for 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.

      Parameters:
      requestTagKeys - request tag keys
      Returns:
      this builder
    • build