Class HttpClientFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.confluent.telemetry.client.BufferingAsyncClient<ExportableMetric, io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse> get(HttpExporterConfigWrapper configWrapper) Retrieves or creates aBufferingAsyncClientinstance based on the provided configuration wrapper.static HttpClientFactory
-
Constructor Details
-
HttpClientFactory
public HttpClientFactory()
-
-
Method Details
-
getInstance
-
get
public io.confluent.telemetry.client.BufferingAsyncClient<ExportableMetric,io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse> get(HttpExporterConfigWrapper configWrapper) Retrieves or creates aBufferingAsyncClientinstance based on the provided configuration wrapper.If the
HttpExporterConfigWrappercontains a non-nullHttpClientConfig, this method attempts to reuse an existingCloseableReferenceTrackerfor the client name specified in theHttpClientConfig. 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
BufferingAsyncClientis a proxy that tracks references, ensuring that the underlying static client is closed only when all references (leases) are released.If the
HttpExporterConfigWrapperdoes not contain aHttpClientConfig(i.e., it's null), a new, non-staticBufferingAsyncClientis created directly by callingHttpExporterConfigWrapper.createBufferingClient().- Parameters:
configWrapper- The wrapper containing configuration for the HTTP exporter and its client.- Returns:
- A
BufferingAsyncClientinstance, potentially wrapped in aReferenceTrackingProxy.
-