Skip to content

Commit 81ecdb1

Browse files
authored
Fix invalid SQSHelper usage in AWS async client instrumentation (#3266)
* Fix invalid SQSHelper usage in AWS async client instrumentation * Fix invalid SQSHelper usage in AWS async client instrumentation
1 parent 04aeded commit 81ecdb1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CHANGELOG.asciidoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ Use subheadings with the "=====" level for adding notes for unreleased changes:
3131
3232
=== Unreleased
3333
34-
[float]
35-
===== Features
36-
* Added virtual thread support - {pull}#3239[#3239]
37-
3834
[float]
3935
===== Bug fixes
4036
* Fixed Micrometer histograms to be correctly exported with non-cumulative bucket counts - {pull}3264[#3264]
37+
* Fixed SQS NoClassDefFoundError in AWS SDK instrumentation for async clients - {pull}3266[#3266]
38+
39+
[float]
40+
===== Refactorings
41+
* Replaced thread-local IO buffers with pooled ones for virtual thread friendliness - {pull}#3239[#3239]
42+
4143
4244
[[release-notes-1.x]]
4345
=== Java Agent version 1.x

apm-agent-plugins/apm-aws-sdk/apm-aws-sdk-2-plugin/src/main/java/co/elastic/apm/agent/awssdk/v2/BaseAsyncClientHandlerInstrumentation.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,23 @@ public static TransformingAsyncResponseHandler<?> enterDoExecute(@Advice.Argumen
8080
SdkRequest sdkRequest = clientExecutionParams.getInput();
8181
URI uri = clientConfiguration.option(SdkClientOption.ENDPOINT);
8282
Span<?> span = null;
83+
boolean isSqs = false;
8384
if ("S3".equalsIgnoreCase(awsService)) {
8485
span = S3Helper.getInstance().startSpan(sdkRequest, uri, executionContext);
8586
} else if ("DynamoDb".equalsIgnoreCase(awsService)) {
8687
span = DynamoDbHelper.getInstance().startSpan(sdkRequest, uri, executionContext);
8788
} else if ("Sqs".equalsIgnoreCase(awsService)) {
89+
isSqs = true;
8890
span = SQSHelper.getInstance().startSpan(sdkRequest, uri, executionContext);
8991
}
9092

9193
if (span != null) {
9294
span.withSync(false).activate();
9395
}
9496
try {
95-
SQSHelper.getInstance().modifyRequestObject(tracer.currentContext(), clientExecutionParams, executionContext);
97+
if (isSqs) {
98+
SQSHelper.getInstance().modifyRequestObject(tracer.currentContext(), clientExecutionParams, executionContext);
99+
}
96100
} finally {
97101
if (span != null) {
98102
span.deactivate();

0 commit comments

Comments
 (0)