Class KafkaStreamsMetrics
- All Implemented Interfaces:
MeterBinder,AutoCloseable
It is based on the Kafka client's metrics() method returning a Metric
map.
Meter names have the following convention: kafka.(metric_group).(metric_name)
- Since:
- 1.4.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams) KafkaStreamsmetrics binderKafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams, Iterable<Tag> tags) KafkaStreamsmetrics binderKafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams, Iterable<Tag> tags, ScheduledExecutorService scheduler) KafkaStreamsmetrics binder.KafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams, Iterable<Tag> tags, ScheduledExecutorService scheduler, Duration refreshInterval) KafkaStreamsmetrics binder. -
Method Summary
-
Constructor Details
-
KafkaStreamsMetrics
KafkaStreamsmetrics binder- Parameters:
kafkaStreams- instance to be instrumentedtags- additional tags
-
KafkaStreamsMetrics
public KafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams) KafkaStreamsmetrics binder- Parameters:
kafkaStreams- instance to be instrumented
-
KafkaStreamsMetrics
public KafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams, Iterable<Tag> tags, ScheduledExecutorService scheduler) KafkaStreamsmetrics binder. The lifecycle of the custom scheduler passed is the responsibility of the caller. It will not be shut down when this instance isclosed. A scheduler can be shared among multiple instances ofKafkaStreamsMetricsto reduce resource usage by reducing the number of threads if there will be many instances.- Parameters:
kafkaStreams- instance to be instrumentedtags- additional tagsscheduler- customer scheduler to run the task that checks and binds metrics- Since:
- 1.14.0
-
KafkaStreamsMetrics
public KafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams, Iterable<Tag> tags, ScheduledExecutorService scheduler, Duration refreshInterval) KafkaStreamsmetrics binder. The lifecycle of the custom scheduler passed is the responsibility of the caller. It will not be shut down when this instance isclosed. A scheduler can be shared among multiple instances ofKafkaStreamsMetricsto reduce resource usage by reducing the number of threads if there will be many instances.The refresh interval governs how frequently Micrometer should call the Kafka Client's Metrics API to discover new metrics to register and discard old ones since the Kafka Client can add/remove/recreate metrics on-the-fly. Please notice that this is not for fetching values for already registered metrics but for updating the list of registered metrics when the Kafka Client adds/removes/recreates them. It is the responsibility of the caller to choose the right value since this process can be expensive and metrics can appear and disappear without being published if the interval is not chosen appropriately.
- Parameters:
kafkaStreams- instance to be instrumentedtags- additional tagsscheduler- customer scheduler to run the task that checks and binds metricsrefreshInterval- interval of discovering new/removed/recreated metrics by the Kafka Client- Since:
- 1.16.0
-
-
Method Details
-
bindTo
- Specified by:
bindToin interfaceMeterBinder
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-