Skip to content

ClientMetrics

ClientMetrics registers performance metrics of a KafkaStreams instance (and associated StreamThreads).

Name Description RecordingLevel Value
state The state of the Kafka Streams client INFO state
version The version of the Kafka Streams client INFO version
topology-description The description of the topology executed in the Kafka Streams client INFO
alive-stream-threads The current number of alive stream threads that are running or participating in rebalance INFO getNumLiveStreamThreads
failed-stream-threads The number of failed stream threads since the start of the Kafka Streams client INFO failedStreamThreadSensor

ClientMetrics was introduced in KIP-444.

Creating Instance

ClientMetrics takes no arguments to be created.

kafka-streams-version.properties

While being created, ClientMetrics loads /kafka/kafka-streams-version.properties file (from the CLASSPATH) for the version and commitId values.

The values are used when KafkaStreams is created (and prints them out as INFO message to the logs).

Kafka Streams version: [version]
Kafka Streams commit ID: [commitId]

addVersionMetric

void addVersionMetric(
  StreamsMetricsImpl streamsMetrics)

addVersionMetric requests the given StreamsMetricsImpl to addClientLevelImmutableMetric with the following:

  • Name: version
  • Description: The version of the Kafka Streams client
  • RecordingLevel: INFO
  • Value: version

addVersionMetric is used when:

addTopologyDescriptionMetric

void addTopologyDescriptionMetric(
  StreamsMetricsImpl streamsMetrics,
  String topologyDescription)

addTopologyDescriptionMetric requests the given StreamsMetricsImpl to addClientLevelImmutableMetric with the following:

  • Name: topology-description
  • Description: The description of the topology executed in the Kafka Streams client
  • RecordingLevel: INFO
  • Value: The given topologyDescription

addTopologyDescriptionMetric is used when:

addStateMetric

void addStateMetric(
  StreamsMetricsImpl streamsMetrics,
  Gauge<State> stateProvider)

addStateMetric requests the given StreamsMetricsImpl to addClientLevelMutableMetric with the following:

  • Name: state
  • Description: The state of the Kafka Streams client
  • RecordingLevel: INFO
  • Value: The given Gauge<State> (with the state of the owning KafkaStreams instance)

addStateMetric is used when:

addNumAliveStreamThreadMetric

void addNumAliveStreamThreadMetric(
  StreamsMetricsImpl streamsMetrics,
  Gauge<Integer> stateProvider)

addNumAliveStreamThreadMetric requests the given StreamsMetricsImpl to addClientLevelMutableMetric with the following:

  • Name: alive-stream-threads
  • Description: The current number of alive stream threads that are running or participating in rebalance
  • RecordingLevel: INFO
  • Value: The given Gauge<Integer> (with getNumLiveStreamThreads of the owning KafkaStreams instance)

addNumAliveStreamThreadMetric is used when:

Back to top