Add messaging.message.body.size
in spans of producers writing to kafka
#12415
Labels
messaging.message.body.size
in spans of producers writing to kafka
#12415
Is your feature request related to a problem? Please describe.
Java instrumenter (for kafka client instrumentation) uses the same attributesExtractor for both producer and consumer spans, yet
messaging.message.body.size
is not present for producers, the attribute list is here. (I've highlighted the diff)The bytes attribute is extracted from for producers
opentelemetry-java-instrumentation/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaConsumerAttributesGetter.java
Line 52 in 8b686b5
But for producers, kafka client library is not instrumented and returns
null
from the request.opentelemetry-java-instrumentation/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaProducerAttributesGetter.java
Line 36 in 8b686b5
Describe the solution you'd like
Add frame work support for kafka client >= 2.6 to get the bytes in producer spans as well.framework
Describe alternatives you've considered
The data is present in the MBean object but it should also be present in producer spans as well according to messaging semconv for spans
Additional context
Details in the Slack thread here
The text was updated successfully, but these errors were encountered: