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) Deprecated.addConsumerProcessAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest, Void> extractor) addConsumerReceiveAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaReceiveRequest, Void> extractor) addProducerAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaProducerRequest, org.apache.kafka.clients.producer.RecordMetadata> extractor) build()setCapturedHeaders(Collection<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.setMessagingReceiveInstrumentationEnabled(boolean messagingReceiveInstrumentationEnabled) Set whether to capture the consumer message receive telemetry in messaging instrumentation.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
@Deprecated @CanIgnoreReturnValue public KafkaTelemetryBuilder addConsumerAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest, Void> extractor) Deprecated. -
addConsumerProcessAttributesExtractors
@CanIgnoreReturnValue public KafkaTelemetryBuilder addConsumerProcessAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaProcessRequest, Void> extractor) -
addConsumerReceiveAttributesExtractors
@CanIgnoreReturnValue public KafkaTelemetryBuilder addConsumerReceiveAttributesExtractors(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<io.opentelemetry.instrumentation.kafka.internal.KafkaReceiveRequest, Void> extractor) -
setCapturedHeaders
@CanIgnoreReturnValue public KafkaTelemetryBuilder setCapturedHeaders(Collection<String> capturedHeaders) 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.
-
setMessagingReceiveInstrumentationEnabled
@CanIgnoreReturnValue public KafkaTelemetryBuilder setMessagingReceiveInstrumentationEnabled(boolean messagingReceiveInstrumentationEnabled) Set whether to capture the consumer message receive telemetry in messaging instrumentation.Note that this will cause the consumer side to start a new trace, with only a span link connecting it to the producer trace.
-
build
-