Skip to content

feat: Add auto-instrumentation support for AWS resources in AWS SDK v1 #13980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lukeina2z
Copy link
Contributor

This PR adds auto-instrumentation support for the following AWS resources:

Lambda
Secrets Manager
SNS
Step Functions

Tests Run:
./gradlew spotlessCheck
./gradlew clean assemble
./gradlew instrumentation:test
./gradlew :smoke-tests:test

No regression issues found. All newly added tests pass.

Backward Compatibility:
There is no risk of breaking existing functionality. This change only adds instrumentation for additional AWS resources without modifying the existing behavior of the auto-instrumentation library.

@lukeina2z lukeina2z requested a review from a team as a code owner June 4, 2025 14:03
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

public abstract class AbstractLambdaClientTest extends AbstractBaseAwsClientTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since there isn't a class that extends this abstract class these tests won't be run. Perhaps you forgot to add some classes to the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct. I need add tests.

getStateMachineArn = findAccessorOrNull(clz, "getStateMachineArn");
getStepFunctionsActivityArn = findAccessorOrNull(clz, "getActivityArn");
getSnsTopicArn = findAccessorOrNull(clz, "getTopicArn");
getSecretArn = findAccessorOrNull(clz, "getARN");
Copy link
Contributor

Choose a reason for hiding this comment

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

getARN is also present in https://github.com/aws/aws-sdk-java/blob/76838885247a94fc6b0acc49c46f718473d38e63/aws-java-sdk-wafv2/src/main/java/com/amazonaws/services/wafv2/model/GetRuleGroupRequest.java#L377 and in some other classes. Perhaps you need to find a way to only read this from some specific types? Or perhaps there should be a generic arn attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good feedback. I will add conditional check with the class name.

@@ -90,6 +150,12 @@ private RequestAccess(Class<?> clz) {
getTableName = findAccessorOrNull(clz, "getTableName");
getTopicArn = findAccessorOrNull(clz, "getTopicArn");
getTargetArn = findAccessorOrNull(clz, "getTargetArn");
getStateMachineArn = findAccessorOrNull(clz, "getStateMachineArn");
getStepFunctionsActivityArn = findAccessorOrNull(clz, "getActivityArn");
getSnsTopicArn = findAccessorOrNull(clz, "getTopicArn");
Copy link
Contributor

Choose a reason for hiding this comment

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

there is already getTopicArn that is used to fill messaging.destination.name attribute for sns messages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will use the existing one.

getStepFunctionsActivityArn = findAccessorOrNull(clz, "getActivityArn");
getSnsTopicArn = findAccessorOrNull(clz, "getTopicArn");
getSecretArn = findAccessorOrNull(clz, "getARN");
getLambdaName = findAccessorOrNull(clz, "getFunctionName");
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will address this.

getSnsTopicArn = findAccessorOrNull(clz, "getTopicArn");
getSecretArn = findAccessorOrNull(clz, "getARN");
getLambdaName = findAccessorOrNull(clz, "getFunctionName");
getLambdaResourceId = findAccessorOrNull(clz, "getUUID");
Copy link
Contributor

Choose a reason for hiding this comment

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

I couldn't find it being used outside of lambda sdk, but given its generic name it could benefit from an extra check to ensure that it is not added to some random request

Copy link
Contributor Author

@lukeina2z lukeina2z Jun 6, 2025

Choose a reason for hiding this comment

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

I will address this with getFunctionName().

This PR adds auto-instrumentation support for the following AWS resources:

Lambda
Secrets Manager
SNS
Step Functions

Tests Run:
./gradlew spotlessCheck
./gradlew clean assemble
./gradlew instrumentation:test
./gradlew :smoke-tests:test

No regression issues found. All newly added tests pass.

Backward Compatibility:
There is no risk of breaking existing functionality.
This change only adds instrumentation for additional AWS resources without modifying the existing behavior of the auto-instrumentation library.
@lukeina2z
Copy link
Contributor Author

@laurit I addressed all the review comments. Would you please review the new iteration? Sorry I made a rebase from main branch, which makes the diff between 1st and 2nd iterations a bit out of sync.

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.

2 participants