Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add messaging.message.body.size in spans of producers writing to kafka #12415

Open
shivanshuraj1333 opened this issue Oct 8, 2024 · 1 comment
Labels
enhancement New feature or request needs triage New issue that requires triage

Comments

@shivanshuraj1333
Copy link
Member

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

But for producers, kafka client library is not instrumented and returns null from the request.

---producer attributes related with messaging queues---
  {Key: "messaging.kafka.message.offset", Value: 143375.0},
  {Key: "messaging.kafka.message.key", Value: "key1"},
  {Key: "messaging.destination.partition.id", Value: "2"},
  {Key: "messaging.client_id", Value: "producer-1"},
  {Key: "messaging.system", Value: "kafka"},
  {Key: "messaging.operation", Value: "publish"},
  {Key: "messaging.destination.name", Value: "topic2"},

---producer attributes related with messaging queues---
-> {Key: "messaging.message.body.size", Value: 14.0},
  {Key: "messaging.kafka.message.offset", Value: 85405.0},
  {Key: "messaging.destination.partition.id", Value: "2"},
  {Key: "messaging.operation", Value: "process"},
  {Key: "messaging.client_id", Value: "consumer-cg1-1"},
  {Key: "messaging.system", Value: "kafka"},
-> {Key: "messaging.kafka.consumer.group", Value: "cg1"},
  {Key: "messaging.destination.name", Value: "topic1"},
  {Key: "messaging.kafka.message.key", Value: "key1"},
---

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

@shivanshuraj1333 shivanshuraj1333 added enhancement New feature or request needs triage New issue that requires triage labels Oct 8, 2024
@trask
Copy link
Member

trask commented Oct 8, 2024

just a note, this attribute recently became opt-in: open-telemetry/semantic-conventions#1442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage New issue that requires triage
Projects
None yet
Development

No branches or pull requests

2 participants