-
Notifications
You must be signed in to change notification settings - Fork 1k
Add AWS_LAMBDA_RESOURCE_MAPPING_ID Semantic Convention Support for AWS Lambda SDK #14229
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
Conversation
…S Lambda SDK This PR adds support for the AWS_LAMBDA_RESOURCE_MAPPING_ID semantic convention attribute in the AWS Lambda SDK instrumentation library. It also introduces the following two experimental attributes. Work is currently underway to add these keys to the AWS section of the Semantic Conventions (SemConv) registry: aws.lambda.function.arn aws.lambda.function.name Name is extracted from request object. ARN is extracted from response object. Resource Mapping ID is extracted from both request and response objects. This behavior is covered by unit tests. Tests Run: ./gradlew spotlessCheck ./gradlew instrumentation:check ./gradlew :smoke-tests:test All newly added tests pass, and no regressions were found. Backward Compatibility: This change is fully backward compatible. It introduces instrumentation for an additional AWS resource without modifying existing behavior in the auto-instrumentation library.
if (config == null) { | ||
return null; | ||
} | ||
Method method = config.getClass().getMethod("getFunctionArn"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we try to avoid doing reflective lookups on each method invocation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it and that makes sense. The current design in AwsSDK-v2 supports nested visit: response(AWS_LAMBDA_ARN.getKey(), "Configuration.FunctionArn").
Unfortunately, I am not able to figure out how to do nested query in V1. It seems the current design in v1 only supports direct access to the top layer methods.
May I know your advice here? Is there a way to do that without reflection for v1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could do the class.getMethod("getFunctionArn")
call only once and cache the Method/MethodHandle for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the advice. Now the method handler is cached. We only call once: getMethod("getFunctionArn")
075acbb
to
e7e941d
Compare
This PR adds support for the AWS_LAMBDA_RESOURCE_MAPPING_ID semantic convention attribute in the AWS Lambda SDK instrumentation library.
It also introduces the following two experimental attributes. Work is currently underway to add these keys to the AWS section of the Semantic Conventions (SemConv) registry:
aws.lambda.function.arn
aws.lambda.function.name
Name is extracted from request object.
ARN is extracted from response object.
Resource Mapping ID is extracted from both request and response objects. This behavior is covered by unit tests.
Tests Run:
./gradlew spotlessCheck
./gradlew instrumentation:check
./gradlew :smoke-tests:test
All newly added tests pass, and no regressions were found.
Backward Compatibility:
This change is fully backward compatible. It introduces instrumentation for an additional AWS resource without modifying existing behavior in the auto-instrumentation library.