feat: Add instrumentation for Lambda Java interface HandleStreamRequest#13466
Merged
trask merged 1 commit intoopen-telemetry:mainfrom Mar 12, 2025
Merged
feat: Add instrumentation for Lambda Java interface HandleStreamRequest#13466trask merged 1 commit intoopen-telemetry:mainfrom
trask merged 1 commit intoopen-telemetry:mainfrom
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.
|
|
laurit
approved these changes
Mar 7, 2025
laurit
reviewed
Mar 7, 2025
| @Override | ||
| public List<TypeInstrumentation> typeInstrumentations() { | ||
| return singletonList(new AwsLambdaRequestHandlerInstrumentation()); | ||
| return Arrays.asList( |
Contributor
There was a problem hiding this comment.
usually we static import the asList method when it is used in instrumentation module.
Member
There was a problem hiding this comment.
some day I'm going to write an automation for this...
lukeina2z
added a commit
to aws-observability/aws-otel-java-instrumentation
that referenced
this pull request
Aug 22, 2025
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.