Skip to content
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

To support java17 runtime, substitute wrapper handler for original in exec command line #944

Merged
merged 7 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion java/layer-wrapper/scripts/otel-handler
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ fi

export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000

exec "$@"
# java17 runtime puts the handler to run as a command line argument and seems to prefer
# this over _HANDLER, so apply a regex to replace the original handler name with our wrapper
exec "${@//$OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER/$_HANDLER}"
johnbley marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion java/layer-wrapper/scripts/otel-proxy-handler
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ fi

export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000

exec "$@"
# java17 runtime puts the handler to run as a command line argument and seems to prefer
# this over _HANDLER, so apply a regex to replace the original handler name with our wrapper
exec "${@//$OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER/$_HANDLER}"
Copy link
Member

Choose a reason for hiding this comment

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

@johnbley did you confirm this doesn't break anything with Java 11? I assume it doesn't but just want to be sure.
(I think it would still help to include an example string before/after in the PR description on both Java 11 and Java 17 -- unless they're the same.)

Copy link
Member Author

Choose a reason for hiding this comment

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

java17:

sun.java.command=com.amazonaws.services.lambda.runtime.api.client.AWSLambda example.Hello::handleRequest

java11:

sun.java.command=lambdainternal.AWSLambda

And, yes, I verified with our internal tests that this regex works for both 11 and 17.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

4 changes: 3 additions & 1 deletion java/layer-wrapper/scripts/otel-sqs-handler
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ fi

export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000

exec "$@"
# java17 runtime puts the handler to run as a command line argument and seems to prefer
# this over _HANDLER, so apply a regex to replace the original handler name with our wrapper
exec "${@//$OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER/$_HANDLER}"
4 changes: 3 additions & 1 deletion java/layer-wrapper/scripts/otel-stream-handler
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ fi

export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000

exec "$@"
# java17 runtime puts the handler to run as a command line argument and seems to prefer
# this over _HANDLER, so apply a regex to replace the original handler name with our wrapper
exec "${@//$OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER/$_HANDLER}"