Skip to content

Classify AWS SDK service error codes - #20777

Merged
laurit merged 7 commits into
mainfrom
copilot/aws-sdk-service-error-classification
Oct 21, 2026
Merged

laurit merged 7 commits into
mainfrom
copilot/aws-sdk-service-error-classification

Conversation

Copilot AI commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Use structured AWS service error codes for RPC error.type in preview conventions, retaining the existing exception-class fallback when codes are missing.

  • SDK v1: Read AmazonServiceException.getErrorCode().
  • SDK v2: Read AwsServiceException.awsErrorDetails().errorCode().
  • Preserve legacy HTTP classification and existing error handling.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-21 05:56 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI changed the title [WIP] Add structured AWS service error classification for SDK RPC Classify AWS SDK service error codes Oct 20, 2026
Copilot AI requested a review from trask October 20, 2026 19:05
@trask
trask requested a balanced review from Copilot October 20, 2026 19:05

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.

🟢 Approval recommended

The narrow changes preserve existing fallback behavior and include focused mode coverage, with no unresolved findings.

No open issues 🎉

What changed in this PR

Updates AWS SDK v1 and v2 instrumentation to use structured service error codes for preview RPC error.type, preserving exception-class fallback and legacy HTTP classification.

Changes:

  • Extract nonblank service error codes from both SDKs.
  • Test service errors, fallback cases, and successful requests.
  • Wire RPC preview and duplicate-mode tests into check.
File Description
instrumentation/​aws-sdk/​aws-sdk-2.2/​library/​src/​test/​java/​io/​opentelemetry/​instrumentation/​awssdk/​v2_2/​internal/​AwsSdkErrorTypeTest.java Tests v2 classification and fallback behavior.
instrumentation/​aws-sdk/​aws-sdk-2.2/​library/​src/​main/​java/​io/​opentelemetry/​instrumentation/​awssdk/​v2_2/​internal/​AwsSdkRpcAttributesGetter.java Extracts v2 service error codes.
instrumentation/​aws-sdk/​aws-sdk-2.2/​library/​build.gradle.kts Adds v2 preview test variants.
instrumentation/​aws-sdk/​aws-sdk-1.11/​library/​src/​test/​java/​io/​opentelemetry/​instrumentation/​awssdk/​v1_11/​internal/​AwsSdkErrorTypeTest.java Tests v1 classification and fallback behavior.
instrumentation/​aws-sdk/​aws-sdk-1.11/​library/​src/​main/​java/​io/​opentelemetry/​instrumentation/​awssdk/​v1_11/​internal/​AwsSdkRpcAttributesGetter.java Extracts v1 service error codes.
instrumentation/​aws-sdk/​aws-sdk-1.11/​library/​build.gradle.kts Adds v1 preview test variants.

Review effort: Balanced

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 20, 2026 22:00
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 20, 2026 22:28
}
String errorCode = details.errorCode();
return errorCode == null || errorCode.trim().isEmpty() ? null : errorCode;
return details.errorCode();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unrelated cleanup from another PR from earlier today

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 20, 2026 22:48
Assert the parsed service error code directly instead of dereferencing the optional raw response, which is null with the latest SDK. Keep the existing telemetry and missing-code fallback assertions for all shared test consumers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@trask
trask marked this pull request as ready for review October 21, 2026 02:39
@trask
trask requested a review from a team as a code owner October 21, 2026 02:39

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.

🟡 Changes recommended

Removing DynamoDB blank-code normalization changes existing error classification even outside RPC preview.

2 open issues

Review effort: Balanced

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 21, 2026 02:57
@trask
trask requested a balanced review from Copilot October 21, 2026 03:53

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.

🟢 Approval recommended

No blocking defects were identified; only a non-blocking test naming suggestion remains.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Rename inline assertion parameters from value to val

instrumentation/​aws-sdk/​aws-sdk-2.2/​testing/​src/​main/​java/​io/​opentelemetry/​instrumentation/​awssdk/​v2_2/​AbstractAws2ClientTest.java:569

[Testing] Non-blocking: rename both inline attribute-assertion parameters from value to val, keeping v for the nested lambdas. This follows .github/instructions/java-tests.instructions.md:235–236 and the existing assertions in this file; these outer parameters are assertion objects, not raw attribute values.

2 resolved since last review

Review effort: Balanced

@laurit
laurit merged commit e4bdd59 into main Oct 21, 2026
128 of 130 checks passed
@laurit
laurit deleted the copilot/aws-sdk-service-error-classification branch October 21, 2026 05:56
@trask trask mentioned this pull request Oct 22, 2026
14 of 25 tasks
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.

4 participants