public class KafkaExporter extends AbstractExporter
| Modifier and Type | Class and Description |
|---|---|
static class |
KafkaExporter.Builder |
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
V1_HEADER_BYTES |
static String |
VERSION_HEADER_KEY |
| Constructor and Description |
|---|
KafkaExporter(KafkaExporter.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
doEmit(ContextExportableMetric metric) |
org.apache.kafka.clients.producer.Producer<byte[],io.opentelemetry.proto.metrics.v1.MetricsData> |
getProducer() |
static KafkaExporter.Builder |
newBuilder() |
static KafkaExporter.Builder |
newBuilder(KafkaExporterConfig config)
Create a new Builder using values from the
ConfluentTelemetryConfig. |
void |
setMetricsRegistry(org.apache.kafka.common.metrics.Metrics metrics)
Sets the Metrics registry for this exporter.
|
emit, getName, getPredicate, reconfigurePredicatepublic static final String VERSION_HEADER_KEY
public static final byte[] V1_HEADER_BYTES
public KafkaExporter(KafkaExporter.Builder builder)
public void doEmit(ContextExportableMetric metric)
doEmit in class AbstractExporterpublic org.apache.kafka.clients.producer.Producer<byte[],io.opentelemetry.proto.metrics.v1.MetricsData> getProducer()
public void setMetricsRegistry(org.apache.kafka.common.metrics.Metrics metrics)
The Metrics object is associated with the TelemetryReporter
instance. 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.
metrics - The Metrics registry to use.public static KafkaExporter.Builder newBuilder()
public static KafkaExporter.Builder newBuilder(KafkaExporterConfig config)
ConfluentTelemetryConfig.