Skip to content

Commit d876343

Browse files
authored
To support java17 runtime, substitute wrapper handler for original in exec command line (aws-observability#944)
* To support java17 runtime, Substitute wrapper handler for original in exec command line * Add comment describing the bash string replacement incantation
1 parent 40bfb8c commit d876343

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

java/layer-wrapper/scripts/otel-handler

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ fi
99

1010
export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000
1111

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

java/layer-wrapper/scripts/otel-proxy-handler

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ fi
99

1010
export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000
1111

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

java/layer-wrapper/scripts/otel-sqs-handler

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ fi
99

1010
export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000
1111

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

java/layer-wrapper/scripts/otel-stream-handler

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ fi
99

1010
export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000
1111

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

0 commit comments

Comments
 (0)