Class KafkaTelemetryBuilder
java.lang.Object
io.opentelemetry.instrumentation.kafkaclients.v2_6.KafkaTelemetryBuilder
-
Method Summary
Modifier and TypeMethodDescriptionaddConsumerAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest, Void> extractor) addProducerAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaProducerRequest, org.apache.kafka.clients.producer.RecordMetadata> extractor) build()setCapturedHeaders(List<String> capturedHeaders) Configures the messaging headers that will be captured as span attributes.setCaptureExperimentalSpanAttributes(boolean captureExperimentalSpanAttributes) Sets whether experimental attributes should be set to spans.setPropagationEnabled(boolean propagationEnabled) Set whether to propagate trace context in producers.
-
Method Details
-
addProducerAttributesExtractors
@CanIgnoreReturnValue public KafkaTelemetryBuilder addProducerAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaProducerRequest, org.apache.kafka.clients.producer.RecordMetadata> extractor) -
addConsumerAttributesExtractors
@CanIgnoreReturnValue public KafkaTelemetryBuilder addConsumerAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest, Void> extractor) -
setCapturedHeaders
Configures the messaging headers that will be captured as span attributes.- Parameters:
capturedHeaders- A list of messaging header names.
-
setCaptureExperimentalSpanAttributes
@CanIgnoreReturnValue public KafkaTelemetryBuilder setCaptureExperimentalSpanAttributes(boolean captureExperimentalSpanAttributes) Sets whether experimental attributes should be set to spans. These attributes may be changed or removed in the future, so only enable this if you know you do not require attributes filled by this instrumentation to be stable across versions. -
setPropagationEnabled
@CanIgnoreReturnValue public KafkaTelemetryBuilder setPropagationEnabled(boolean propagationEnabled) Set whether to propagate trace context in producers. Enabled by default.You will need to disable this if there are kafka consumers using kafka-clients version prior to 0.11, since those old versions do not support headers, and attaching trace context propagation headers upstream causes those consumers to fail when reading the messages.
-
build
-