Class KafkaMetricsSupport<C>
java.lang.Object
org.springframework.kafka.core.KafkaMetricsSupport<C>
- Type Parameters:
C- the Kafka Client type.
- Direct Known Subclasses:
KafkaStreamsMicrometerListener,MicrometerConsumerListener,MicrometerProducerListener
An abstract class to manage
KafkaClientMetrics.- Since:
- 3.3
- Author:
- Artem Bilan
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.micrometer.core.instrument.MeterRegistryprotected final ScheduledExecutorServiceprotected final List<io.micrometer.core.instrument.Tag> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedKafkaMetricsSupport(io.micrometer.core.instrument.MeterRegistry meterRegistry) Construct an instance with the provided registry.protectedKafkaMetricsSupport(io.micrometer.core.instrument.MeterRegistry meterRegistry, List<io.micrometer.core.instrument.Tag> tags) Construct an instance with the providedMeterRegistryand tags.protectedKafkaMetricsSupport(io.micrometer.core.instrument.MeterRegistry meterRegistry, List<io.micrometer.core.instrument.Tag> tags, TaskScheduler taskScheduler) Construct an instance with the providedMeterRegistry, tags andTaskScheduler.protectedKafkaMetricsSupport(io.micrometer.core.instrument.MeterRegistry meterRegistry, TaskScheduler taskScheduler) Construct an instance with the providedMeterRegistryandTaskScheduler. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidbindClient(String id, C client) Bind metrics for the Apache Kafka client with provided id.protected io.micrometer.core.instrument.binder.MeterBindercreateClientMetrics(C client, List<io.micrometer.core.instrument.Tag> tags) Create aio.micrometer.core.instrument.binder.kafka.KafkaMetricsinstance for the provided Kafka client and metric tags.protected final voidunbindClient(String id, C client) Unbind aio.micrometer.core.instrument.binder.kafka.KafkaMetricsfor the provided Kafka client.
-
Field Details
-
meterRegistry
protected final io.micrometer.core.instrument.MeterRegistry meterRegistry -
tags
-
scheduler
-
-
Constructor Details
-
KafkaMetricsSupport
protected KafkaMetricsSupport(io.micrometer.core.instrument.MeterRegistry meterRegistry) Construct an instance with the provided registry.- Parameters:
meterRegistry- the registry.
-
KafkaMetricsSupport
protected KafkaMetricsSupport(io.micrometer.core.instrument.MeterRegistry meterRegistry, TaskScheduler taskScheduler) Construct an instance with the providedMeterRegistryandTaskScheduler.- Parameters:
meterRegistry- the registry.taskScheduler- the task scheduler.
-
KafkaMetricsSupport
protected KafkaMetricsSupport(io.micrometer.core.instrument.MeterRegistry meterRegistry, List<io.micrometer.core.instrument.Tag> tags) Construct an instance with the providedMeterRegistryand tags.- Parameters:
meterRegistry- the registry.tags- the tags.
-
KafkaMetricsSupport
protected KafkaMetricsSupport(io.micrometer.core.instrument.MeterRegistry meterRegistry, List<io.micrometer.core.instrument.Tag> tags, TaskScheduler taskScheduler) Construct an instance with the providedMeterRegistry, tags andTaskScheduler.- Parameters:
meterRegistry- the registry.tags- the tags.taskScheduler- the task scheduler.
-
-
Method Details
-
bindClient
-
createClientMetrics
protected io.micrometer.core.instrument.binder.MeterBinder createClientMetrics(C client, List<io.micrometer.core.instrument.Tag> tags) Create aio.micrometer.core.instrument.binder.kafka.KafkaMetricsinstance for the provided Kafka client and metric tags. By default, this factory is aware ofConsumer,ProducerandAdminClienttypes. For other use-case this method can be overridden.- Parameters:
client- the client to create aio.micrometer.core.instrument.binder.kafka.KafkaMetricsinstance for.tags- the tags for theio.micrometer.core.instrument.binder.kafka.KafkaMetrics.- Returns:
- the
io.micrometer.core.instrument.binder.kafka.KafkaMetrics.
-
unbindClient
-