open-telemetry / open-telemetry/opentelemetry-java-instrumentation
Add per-message creation spans for RocketMQ 4.8 batch sends
@YaoYingLong is already working on this.
Since Aug 31, 2026.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1.2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 228
Description
Is your feature request related to a problem? Please describe.
RocketMQ 4.8 exposes the explicit DefaultMQProducer.send(Collection<Message>) batch API. The instrumentation currently creates one producer send span and propagates its context to every message. The stable-semconv batch test consequently asserts multiple identical consumer links to that shared producer context instead of one distinct creation context per message.
Describe the solution you'd like
For RocketMQ 4.8 batch sends, emit one message-creation span per eligible message, inject its context into that message, and make the batch send span link to every message creation context. Preserve custom creation contexts when present.
Use the common otel.instrumentation.messaging.batch-send.message-creation-spans.enabled setting to control the additional per-message spans. Keep single-message sends unchanged.
Describe alternatives you've considered
Keep propagating the shared batch send context. This preserves propagation but prevents consumers from identifying the individual message creation context represented by each link.
Additional context
The current test demonstrates the duplicate-link behavior: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/rocketmq/rocketmq-client-4.8/testing/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/AbstractRocketMqClientTest.java
Configuration design is tracked in #19700. The SQS implementation is #19485. Messaging semantic conventions recommend one Create span per message for batch-oriented APIs and a configuration option to disable them: https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/#producer-spans
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.