Class KafkaStreamsMetrics

java.lang.Object
io.micrometer.core.instrument.binder.kafka.KafkaStreamsMetrics
All Implemented Interfaces:
MeterBinder, AutoCloseable

@Incubating(since="1.4.0") @NonNullApi @NonNullFields public class KafkaStreamsMetrics extends Object
Kafka Streams metrics binder.

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)

Note: the AutoCloseable.close() method should be called when the application shuts down to shut down the internal metrics-refresh scheduler (when not externally managed) and to remove the meters this binder registered.

Since:
1.4.0
See Also:
  • Constructor Details

    • KafkaStreamsMetrics

      public KafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams, Iterable<Tag> tags)
      KafkaStreams metrics binder
      Parameters:
      kafkaStreams - instance to be instrumented
      tags - additional tags
    • KafkaStreamsMetrics

      public KafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams)
      KafkaStreams metrics binder
      Parameters:
      kafkaStreams - instance to be instrumented
    • KafkaStreamsMetrics

      public KafkaStreamsMetrics(org.apache.kafka.streams.KafkaStreams kafkaStreams, Iterable<Tag> tags, ScheduledExecutorService scheduler)
      KafkaStreams metrics binder. The lifecycle of the custom scheduler passed is the responsibility of the caller. It will not be shut down when this instance is closed. A scheduler can be shared among multiple instances of KafkaStreamsMetrics to reduce resource usage by reducing the number of threads if there will be many instances.
      Parameters:
      kafkaStreams - instance to be instrumented
      tags - additional tags
      scheduler - customer scheduler to run the task that checks and binds metrics
      Since:
      1.14.0
  • Method Details