Class TracingConsumerInterceptor<K,V>

java.lang.Object
io.opentelemetry.instrumentation.kafkaclients.v2_6.TracingConsumerInterceptor<K,V>
All Implemented Interfaces:
AutoCloseable, org.apache.kafka.clients.consumer.ConsumerInterceptor<K,V>, org.apache.kafka.common.Configurable

public class TracingConsumerInterceptor<K,V> extends Object implements org.apache.kafka.clients.consumer.ConsumerInterceptor<K,V>
A ConsumerInterceptor that adds tracing capability. Add this interceptor's class name or class via ConsumerConfig.INTERCEPTOR_CLASSES_CONFIG property to your Consumer's properties to get it instantiated and used. See more details on ConsumerInterceptor usage in its Javadoc.
  • Constructor Details

    • TracingConsumerInterceptor

      public TracingConsumerInterceptor()
  • Method Details

    • onConsume

      @CanIgnoreReturnValue public org.apache.kafka.clients.consumer.ConsumerRecords<K,V> onConsume(org.apache.kafka.clients.consumer.ConsumerRecords<K,V> records)
      Specified by:
      onConsume in interface org.apache.kafka.clients.consumer.ConsumerInterceptor<K,V>
    • onCommit

      public void onCommit(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets)
      Specified by:
      onCommit in interface org.apache.kafka.clients.consumer.ConsumerInterceptor<K,V>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.apache.kafka.clients.consumer.ConsumerInterceptor<K,V>
    • configure

      public void configure(Map<String,?> configs)
      Specified by:
      configure in interface org.apache.kafka.common.Configurable