Kafka Stream metrics

For more advanced applications, you may wish to display metrics in addition to the topology overlay. In the case of Kafka Streams this is as simple as providing an implementation of the KafkaClientSupplier interface when creating the KafkaStreams object. This interface is used by the streams library to instantiate instances of producers and consumers. By using a custom supplier, the topology client is able to access the metrics of each producer and consumer and dispatch these to Lenses.


Then, you must instantiate an instance of TopologyKafkaStreamsClientSupplier, which is created by passing in the topology object that describes the application, as well as the client from earlier. This instance is then provided to the Kafka Streams constructor.

For example:

KafkaStreams streams = 
    new KafkaStreams(
        new StreamsConfig(streamProps), 
        new TopologyKafkaStreamsClientSupplier(client, topology)