Skip to content

Add per-message creation spans for RocketMQ 4.8 batch sends #19836

Description

@trask

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestneeds triageNew issue that requires triage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions