Class KafkaProducerTelemetry

java.lang.Object
io.opentelemetry.instrumentation.kafkaclients.v2_6.internal.KafkaProducerTelemetry

public class KafkaProducerTelemetry extends Object
Helper for producer-side instrumentation.

This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

  • Constructor Summary

    Constructors
    Constructor
    Description
    KafkaProducerTelemetry(io.opentelemetry.context.propagation.TextMapPropagator propagator, io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<io.opentelemetry.instrumentation.kafkaclients.common.v0_11.internal.KafkaProducerRequest,org.apache.kafka.clients.producer.RecordMetadata> producerInstrumenter, boolean producerPropagationEnabled)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <K, V> void
    buildAndInjectSpan(org.apache.kafka.clients.producer.ProducerRecord<K,V> record, String clientId)
    Build and inject span into record.
    <K, V> Future<org.apache.kafka.clients.producer.RecordMetadata>
    buildAndInjectSpan(org.apache.kafka.clients.producer.ProducerRecord<K,V> record, org.apache.kafka.clients.producer.Producer<K,V> producer, org.apache.kafka.clients.producer.Callback callback, BiFunction<org.apache.kafka.clients.producer.ProducerRecord<K,V>,org.apache.kafka.clients.producer.Callback,Future<org.apache.kafka.clients.producer.RecordMetadata>> sendFn)
    Build and inject span into record.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KafkaProducerTelemetry

      public KafkaProducerTelemetry(io.opentelemetry.context.propagation.TextMapPropagator propagator, io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<io.opentelemetry.instrumentation.kafkaclients.common.v0_11.internal.KafkaProducerRequest,org.apache.kafka.clients.producer.RecordMetadata> producerInstrumenter, boolean producerPropagationEnabled)
  • Method Details

    • buildAndInjectSpan

      public <K, V> void buildAndInjectSpan(org.apache.kafka.clients.producer.ProducerRecord<K,V> record, String clientId)
      Build and inject span into record.
      Parameters:
      record - the producer record to inject span info.
    • buildAndInjectSpan

      public <K, V> Future<org.apache.kafka.clients.producer.RecordMetadata> buildAndInjectSpan(org.apache.kafka.clients.producer.ProducerRecord<K,V> record, org.apache.kafka.clients.producer.Producer<K,V> producer, org.apache.kafka.clients.producer.Callback callback, BiFunction<org.apache.kafka.clients.producer.ProducerRecord<K,V>,org.apache.kafka.clients.producer.Callback,Future<org.apache.kafka.clients.producer.RecordMetadata>> sendFn)
      Build and inject span into record.
      Parameters:
      record - the producer record to inject span info
      callback - the producer send callback
      Returns:
      send function's result