4.0

You are viewing documentation for an older version of Lenses.io View latest documentation here

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.

<dependency>
    <groupId>com.landoop</groupId>
    <artifactId>lenses-topology-client-kafka</artifactId>
    <version>4.0.0</version>
</dependency>

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(
        builder.build(), 
        new StreamsConfig(streamProps), 
        new TopologyKafkaStreamsClientSupplier(client, topology)
);