Skip to content

Fix DynamoDB batch attributes#18979

Merged
laurit merged 5 commits into
open-telemetry:mainfrom
trask:fix-dynamodb-stable-batch-attrs
Jun 15, 2026
Merged

Fix DynamoDB batch attributes#18979
laurit merged 5 commits into
open-telemetry:mainfrom
trask:fix-dynamodb-stable-batch-attrs

Conversation

@trask

@trask trask commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Fixes DynamoDB stable database semconv batch handling for AWS SDK 1.11 and 2.2 instrumentation.

Previously, BatchGetItem and BatchWriteItem stable operation names were based only on the AWS operation name. This PR counts the actual request items so that:

  • single-item BatchGetItem / BatchWriteItem requests emit logical stable item operations (GetItem / WriteItem)
  • multi-item batch requests emit BATCH GetItem / BATCH WriteItem
  • true batch requests emit db.operation.batch.size

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes DynamoDB stable database semconv behavior for AWS SDK v1.11 and v2.2 Batch* operations by deriving stable operation names from the actual number of request items, and emitting db.operation.batch.size for true batch requests.

Changes:

  • Compute BatchGetItem/BatchWriteItem request item counts to decide between logical item operations (GetItem/WriteItem) vs batch operations (BATCH GetItem/BATCH WriteItem).
  • Emit db.operation.batch.size when the computed batch size indicates a true batch request.
  • Extend test coverage (notably for AWS SDK v2.2) to validate stable batch attributes for multi-item requests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
instrumentation/aws-sdk/aws-sdk-2.2/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AbstractAws2ClientCoreTest.java Updates DynamoDB span assertions to handle item-vs-batch stable operation naming; adds multi-item batch tests asserting db.operation.batch.size.
instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/internal/DynamoDbAttributesExtractor.java Adds batch-size extraction and stable semconv mapping for BatchGetItem/BatchWriteItem, including db.operation.batch.size emission.
instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractDynamoDbClientTest.java Updates/extends BatchGetItem tests to distinguish single-item vs multi-item stable semantics and validate batch-size emission.
instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/internal/RequestAccess.java Adds reflective accessor for getKeys() to enable batch-size counting for v1.11 BatchGetItem requests.
instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/internal/DynamoDbAttributesExtractor.java Adds batch-size extraction and stable semconv mapping for BatchGetItem/BatchWriteItem, including db.operation.batch.size emission.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@trask trask changed the title Fix DynamoDB stable batch attributes Fix DynamoDB batch attributes Jun 13, 2026
@trask
trask requested a review from Copilot June 13, 2026 00:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@trask
trask marked this pull request as ready for review June 13, 2026 02:37
@trask
trask requested a review from a team as a code owner June 13, 2026 02:37
@laurit
laurit merged commit 172a705 into open-telemetry:main Jun 15, 2026
95 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants