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)
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 https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/8b686b571b8e67bb6ea98af875d3d74cb5063a7c/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaConsumerAttributesGetter.java#L52
But for producers, kafka client library is not instrumented and returns
null
from the request.https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/8b686b571b8e67bb6ea98af875d3d74cb5063a7c/instrumentation/kafka/kafka-clients/kafka-clients-common/library/src/main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaProducerAttributesGetter.java#L36
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