-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Add instrumentation for Lambda Java interface HandleStreamRequest #13466
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
Problem: AWS Lambda for Java provides two handler interfaces: com.amazonaws.services.lambda.runtime.RequestHandler com.amazonaws.services.lambda.runtime.RequestStreamHandler However, instrumentation for RequestStreamHandler is missing in the OpenTelemetry Java agent. Fix: Added instrumentation support for RequestStreamHandler. Test: Pass with green: ./gradlew spotlessCheck ./gradlew clean assemble ./gradlew instrumentation:test ./gradlew :smoke-tests:test Manual end-to-end tests pass: - Deployed Lambda functions with Spring Boot 3 and Amazon Serverless Java Container. - Enabled application signals, observed broken traces. - Disabled application signals and added a private build of the Java layer for Lambda with this change. - Verified traces and spans are now correct. Backward Compatibility: No risk of breaking existing functionality. The change only adds instrumentation for RequestStreamHandler without modifying existing behavior for RequestHandler. Existing users not using RequestStreamHandler remain unaffected.
|
|
| @Override | ||
| public List<TypeInstrumentation> typeInstrumentations() { | ||
| return singletonList(new AwsLambdaRequestHandlerInstrumentation()); | ||
| return Arrays.asList( |
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.
usually we static import the asList method when it is used in instrumentation module.
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.
some day I'm going to write an automation for this...
…8.0 (#1156) This updates upstream dependency OTel Java Agent to v2.18.1 and upgrades upstream OTel Contrib to v1.48.0. It removes two patch files, as those code has been migrated to upstream. For the OTel Java Contrib patch, it has been replaced by PR-1959 open-telemetry/opentelemetry-java-contrib#1959 , which is included in the OTel Java Contrib v1.48.0 release. For the OTel Java Agent patch for the Lambda stream handler, it has been replaced by PR-13466 open-telemetry/opentelemetry-java-instrumentation#13466 , which is included in the OTel Java Agent v2.18.1 release. Tests: - Unit tests pass: ./gradlew build test - Smoke/Contract tests pass: ./gradlew appsignals-tests:contract-tests:contractTests - X-Ray remote sampling service end-to-end manual tests pass - EC2 end-to-end tests with SpringBoot Java app pass - Lambda end-to-end tests with SpringBoot Java app pass By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Fixes #13444
Problem:
AWS Lambda for Java provides two handler interfaces:
com.amazonaws.services.lambda.runtime.RequestHandler
com.amazonaws.services.lambda.runtime.RequestStreamHandler
However, instrumentation for RequestStreamHandler is missing in the OpenTelemetry Java agent.
Fix:
Added instrumentation support for RequestStreamHandler.
Test:
Pass with green:
./gradlew spotlessCheck
./gradlew clean assemble
./gradlew instrumentation:test
./gradlew :smoke-tests:test
Manual end-to-end tests pass:
Backward Compatibility:
No risk of breaking existing functionality.
The change only adds instrumentation for RequestStreamHandler without modifying existing behavior for RequestHandler. Existing users not using RequestStreamHandler remain unaffected.