Class KafkaExporter
java.lang.Object
io.confluent.telemetry.exporter.AbstractExporter
io.confluent.telemetry.exporter.kafka.KafkaExporter
- All Implemented Interfaces:
Exporter,AutoCloseable
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddoEmit(ContextExportableMetric metric) org.apache.kafka.clients.producer.Producer<byte[], io.opentelemetry.proto.metrics.v1.MetricsData> static KafkaExporter.Builderstatic KafkaExporter.BuildernewBuilder(KafkaExporterConfig config) Create a new Builder using values from theConfluentTelemetryConfig.voidsetMetricsRegistry(org.apache.kafka.common.metrics.Metrics metrics) Sets the Metrics registry for this exporter.Methods inherited from class io.confluent.telemetry.exporter.AbstractExporter
emit, getName, getPredicate, reconfigurePredicate
-
Field Details
-
VERSION_HEADER_KEY
- See Also:
-
METRIC_NAME_HEADER_KEY
- See Also:
-
V1_HEADER_BYTES
public static final byte[] V1_HEADER_BYTES
-
-
Constructor Details
-
KafkaExporter
-
-
Method Details
-
doEmit
- Specified by:
doEmitin classAbstractExporter
-
close
-
getProducer
public org.apache.kafka.clients.producer.Producer<byte[], io.opentelemetry.proto.metrics.v1.MetricsData> getProducer() -
setMetricsRegistry
public void setMetricsRegistry(org.apache.kafka.common.metrics.Metrics metrics) Sets the Metrics registry for this exporter.The
Metricsobject is associated with theTelemetryReporterinstance. When the TelemetryReporter is reconfigured, the old KafkaExporter instance is closed, and a new KafkaExporter instance is created.The null check
if (metrics.metric(exporterMetricName) == null)is essential because the created KafkaExporter instance receives the same Metrics object. Since KafkaProducer can be shared by the exporters, we need to make sure that the same metric is not already registered with this Metrics instance.- Parameters:
metrics- The Metrics registry to use.
-
newBuilder
-
newBuilder
Create a new Builder using values from theConfluentTelemetryConfig.
-