Class OkHttpMetricsEventListener.Builder

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

public static class OkHttpMetricsEventListener.Builder
extends java.lang.Object
  • Method Details

    • tags

      public OkHttpMetricsEventListener.Builder tags​(java.lang.Iterable<Tag> tags)
    • tag

      Add a Tag to any already configured tags on this Builder.
      Parameters:
      tag - tag to add
      Returns:
      this builder
      Since:
      1.5.0
    • tag

      public OkHttpMetricsEventListener.Builder tag​(java.util.function.BiFunction<okhttp3.Request,​okhttp3.Response,​Tag> contextSpecificTag)
      Add a context-specific tag.
      Parameters:
      contextSpecificTag - function to create a context-specific tag
      Returns:
      this builder
      Since:
      1.5.0
    • uriMapper

      public OkHttpMetricsEventListener.Builder uriMapper​(java.util.function.Function<okhttp3.Request,​java.lang.String> uriMapper)
    • includeHostTag

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

      public OkHttpMetricsEventListener.Builder requestTagKeys​(java.lang.String... requestTagKeys)
      Tag 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
      Since:
      1.3.9
    • requestTagKeys

      public OkHttpMetricsEventListener.Builder requestTagKeys​(java.lang.Iterable<java.lang.String> requestTagKeys)
      Tag 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
      Since:
      1.3.9
    • build