public class HttpClientFactory extends Object
| Constructor and Description |
|---|
HttpClientFactory() |
| Modifier and Type | Method and Description |
|---|---|
io.confluent.telemetry.client.BufferingAsyncClient<ExportableMetric,io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse> |
get(HttpExporterConfigWrapper configWrapper)
Retrieves or creates a
BufferingAsyncClient instance based on the provided configuration wrapper. |
static HttpClientFactory |
getInstance() |
public static HttpClientFactory getInstance()
public io.confluent.telemetry.client.BufferingAsyncClient<ExportableMetric,io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse> get(HttpExporterConfigWrapper configWrapper)
BufferingAsyncClient instance based on the provided configuration wrapper.
If the HttpExporterConfigWrapper contains a non-null HttpClientConfig, this method
attempts to reuse an existing CloseableReferenceTracker for the client name specified in the
HttpClientConfig. If no tracker exists, or if the existing tracker's configuration has
changed and the tracker is marked for replacement, a new tracker is created and stored,
replacing the old one to allow GC to collect it.
The returned BufferingAsyncClient is a proxy that tracks references, ensuring that the
underlying static client is closed only when all references (leases) are released.
If the HttpExporterConfigWrapper does not contain a HttpClientConfig (i.e., it's null),
a new, non-static BufferingAsyncClient is created directly by calling
HttpExporterConfigWrapper.createBufferingClient().
configWrapper - The wrapper containing configuration for the HTTP exporter and its client.BufferingAsyncClient instance, potentially wrapped in a ReferenceTrackingProxy.