Skip to content

Commit 9f7f969

Browse files
authored
feat: Add instrumentation for Lambda Java interface HandleStreamRequest (#1036)
Problem: All Lambda Java users using HandleStreamRequest experience broken application signal traces. This issue affects all Spring Boot 3 users. Cause: 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: Unit tests pass (./gradlew spotlessCheck assemble instrumentation: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. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent cd3c2c5 commit 9f7f969

File tree

2 files changed

+507
-0
lines changed

2 files changed

+507
-0
lines changed

lambda-layer/build-layer.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ patch -p1 < "$SOURCEDIR"/../.github/patches/opentelemetry-java-instrumentation.p
2828
# This patch is for Lambda related context propagation
2929
patch -p1 < "$SOURCEDIR"/patches/opentelemetry-java-instrumentation.patch
3030

31+
patch -p1 < "$SOURCEDIR"/patches/StreamHandlerInstrumentation.patch
32+
3133
./gradlew publishToMavenLocal
3234
popd
3335
rm -rf opentelemetry-java-instrumentation

0 commit comments

Comments
 (0)