public final class ConnPoolMeters extends Object implements io.micrometer.core.instrument.binder.MeterBinder
HttpClientBuilder.
Exposes:
<prefix>.pool.leased – number of leased connections<prefix>.pool.available – number of available (idle) connections<prefix>.pool.pending – number of pending connection requestsprefix and any common tags come from MetricConfig.
Usage
MeterRegistry meters = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
MetricConfig mc = MetricConfig.builder().prefix("http_client").build();
HttpClientBuilder b = HttpClients.custom()
.setConnectionManager(PoolingHttpClientConnectionManagerBuilder.create().build());
// after the connection manager is attached to the builder:
ConnPoolMeters.bindTo(b, meters, mc);
Note: This binder reads the connection manager from the
HttpClientBuilder. Ensure the builder has a compatible connection
manager (implementing ConnPoolControl) before calling bindTo.
| Modifier and Type | Method and Description |
|---|---|
static void |
bindTo(HttpClientBuilder builder,
io.micrometer.core.instrument.MeterRegistry registry)
Binds pool gauges using
MetricConfig.DEFAULT. |
static void |
bindTo(HttpClientBuilder builder,
io.micrometer.core.instrument.MeterRegistry registry,
MetricConfig mc)
Binds pool gauges for the connection manager currently attached to the given builder.
|
void |
bindTo(io.micrometer.core.instrument.MeterRegistry registry) |
public void bindTo(io.micrometer.core.instrument.MeterRegistry registry)
bindTo in interface io.micrometer.core.instrument.binder.MeterBinderpublic static void bindTo(HttpClientBuilder builder, io.micrometer.core.instrument.MeterRegistry registry, MetricConfig mc)
ConnPoolControl,
this method is a no-op.builder - classic client builderregistry - meter registrymc - metric configuration (prefix, common tags)public static void bindTo(HttpClientBuilder builder, io.micrometer.core.instrument.MeterRegistry registry)
MetricConfig.DEFAULT.builder - classic client builderregistry - meter registryCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.