Skip to content

Instrument AWS SNS PublishBatch #19835

Description

@trask

Is your feature request related to a problem? Please describe.

AWS SDK 2.2 instrumentation handles SNS PublishRequest but explicitly does not support PublishBatchRequest, which was introduced in AWS SDK 2.17.84. Batch publishes therefore do not receive SNS messaging propagation or per-message creation contexts.

Describe the solution you'd like

Add version-gated SNS PublishBatchRequest support using targeted muzzle-safe access to the newer API. Under stable messaging semantic conventions, emit one message-creation span for each eligible batch entry, inject its context into that entry, and make the batch send span link to every entry's creation context.

Use the common otel.instrumentation.messaging.batch-send.message-creation-spans.enabled setting to control the additional per-message spans. Preserve custom creation contexts already present on entries and cover supported and unsupported AWS SDK versions.

Describe alternatives you've considered

Inject the shared batch send context into every entry without creating per-message spans. This preserves propagation but gives every message in the batch the same creation context.

Additional context

SnsImpl documents the current limitation and points to the earlier muzzle discussion: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/internal/SnsImpl.java

Related SQS implementation: #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