Class OkHttpConnectionPoolMetrics

java.lang.Object
io.micrometer.core.instrument.binder.okhttp3.OkHttpConnectionPoolMetrics
All Implemented Interfaces:
MeterBinder

public class OkHttpConnectionPoolMetrics extends Object implements MeterBinder
MeterBinder for collecting metrics of a given OkHttp ConnectionPool.

Example usage:

     ConnectionPool connectionPool = new ConnectionPool(connectionPoolSize, connectionPoolKeepAliveMs, TimeUnit.MILLISECONDS);
     new OkHttpConnectionPoolMetrics(connectionPool).bindTo(registry);
 
Since:
1.6.0
  • Constructor Details

    • OkHttpConnectionPoolMetrics

      public OkHttpConnectionPoolMetrics(okhttp3.ConnectionPool connectionPool)
      Creates a meter binder for the given connection pool. Metrics will be exposed using "okhttp.pool" as name prefix.
      Parameters:
      connectionPool - The connection pool to monitor. Must not be null.
    • OkHttpConnectionPoolMetrics

      public OkHttpConnectionPoolMetrics(okhttp3.ConnectionPool connectionPool, Iterable<Tag> tags)
      Creates a meter binder for the given connection pool. Metrics will be exposed using "okhttp.pool" as name prefix.
      Parameters:
      connectionPool - The connection pool to monitor. Must not be null.
      tags - A list of tags which will be passed for all meters. Must not be null.
    • OkHttpConnectionPoolMetrics

      public OkHttpConnectionPoolMetrics(okhttp3.ConnectionPool connectionPool, String namePrefix, Iterable<Tag> tags)
      Creates a meter binder for the given connection pool.
      Parameters:
      connectionPool - The connection pool to monitor. Must not be null.
      namePrefix - The desired name prefix for the exposed metrics. Must not be null.
      tags - A list of tags which will be passed for all meters. Must not be null.
    • OkHttpConnectionPoolMetrics

      public OkHttpConnectionPoolMetrics(okhttp3.ConnectionPool connectionPool, String namePrefix, Iterable<Tag> tags, Integer maxIdleConnections)
      Creates a meter binder for the given connection pool.
      Parameters:
      connectionPool - The connection pool to monitor. Must not be null.
      namePrefix - The desired name prefix for the exposed metrics. Must not be null.
      tags - A list of tags which will be passed for all meters. Must not be null.
      maxIdleConnections - The maximum number of idle connections this pool will hold. This value is passed to the ConnectionPool constructor but is not exposed by this instance. Therefore this binder allows to pass it, to be able to monitor it.
  • Method Details