Class AbstractKafkaMetricsReporter
java.lang.Object
io.micronaut.configuration.kafka.metrics.AbstractKafkaMetricsReporter
- All Implemented Interfaces:
io.micrometer.core.instrument.binder.MeterBinder, Closeable, AutoCloseable, Configurable, MetricsReporter, Reconfigurable
- Direct Known Subclasses:
ConsumerKafkaMetricsReporter, KafkaStreamsMetricsReporter, ProducerKafkaMetricsReporter
@Internal
public abstract class AbstractKafkaMetricsReporter
extends Object
implements MetricsReporter, io.micrometer.core.instrument.binder.MeterBinder, Closeable
A
MetricsReporter that binds metrics to micrometer.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbindTo(@NonNull io.micrometer.core.instrument.MeterRegistry registry) voidclose()voidThe tags to include in the gauge.protected StringgetMetricName(KafkaMetric metric) Resolve the exported metric name for the supplied Kafka metric.protected final MetricNameStyleprotected abstract StringAbstract method to implement with the metric prefix for the reporter.protected final StringgetMicrometerMetricName(KafkaMetric metric) Resolve the Micrometer-style metric name for the supplied Kafka metric group and name.voidinit(List<KafkaMetric> metrics) protected final booleanisClientCountMetric(KafkaMetric metric) voidmetricChange(KafkaMetric metric) voidmetricRemoval(KafkaMetric metric) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MetricsReporter
contextChange, reconfigurableConfigs, reconfigure, validateReconfiguration
-
Field Details
-
METRIC_NAME_STYLE_CONFIG
- See Also:
-
CLIENT_ID_TAG
- See Also:
-
TOPIC_TAG
- See Also:
-
NODE_ID_TAG
- See Also:
-
-
Constructor Details
-
AbstractKafkaMetricsReporter
public AbstractKafkaMetricsReporter()
-
-
Method Details
-
bindTo
public void bindTo(@NonNull io.micrometer.core.instrument.MeterRegistry registry) - Specified by:
bindToin interfaceio.micrometer.core.instrument.binder.MeterBinder
-
init
- Specified by:
initin interfaceMetricsReporter
-
metricChange
- Specified by:
metricChangein interfaceMetricsReporter
-
metricRemoval
- Specified by:
metricRemovalin interfaceMetricsReporter
-
configure
- Specified by:
configurein interfaceConfigurable
-
close
@PreDestroy public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceMetricsReporter
-
getMetricName
Resolve the exported metric name for the supplied Kafka metric.- Parameters:
metric- The Kafka metric- Returns:
- The metric name to register with Micrometer
-
getMicrometerMetricName
Resolve the Micrometer-style metric name for the supplied Kafka metric group and name.- Parameters:
metric- The Kafka metric- Returns:
- The normalized metric name
-
getMetricNameStyle
- Returns:
- The configured metric name style
-
isClientCountMetric
- Parameters:
metric- The Kafka metric- Returns:
- Whether the metric is the generic Kafka client count metric
-
getIncludedTags
-
getMetricPrefix
Abstract method to implement with the metric prefix for the reporter.- Returns:
- prefix name
-