Class KafkaProducerTelemetry
java.lang.Object
io.opentelemetry.instrumentation.kafkaclients.v2_6.internal.KafkaProducerTelemetry
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
ConstructorsConstructorDescriptionKafkaProducerTelemetry(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 TypeMethodDescription<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.
-
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 infocallback- the producer send callback- Returns:
- send function's result
-