From 7e9e544a6444ebfeb13e1f5864f9660f70c12b40 Mon Sep 17 00:00:00 2001 From: Andrew Clemons Date: Mon, 10 Jul 2023 17:11:09 +0900 Subject: [PATCH] Use `exec` to launch python in `otel-instrument` for signal handling. Otherwise, we cannot setup signal handlers in python to do things at shutdown. This now matches how the scripts work for java / node etc: - https://github.com/open-telemetry/opentelemetry-lambda/blob/b004abbc9af28f9a384f7c0c254abcfe578a2a59/java/layer-wrapper/scripts/otel-handler#L12 - https://github.com/open-telemetry/opentelemetry-lambda/blob/b004abbc9af28f9a384f7c0c254abcfe578a2a59/java/layer-wrapper/scripts/otel-proxy-handler#L12 - https://github.com/open-telemetry/opentelemetry-lambda/blob/b004abbc9af28f9a384f7c0c254abcfe578a2a59/java/layer-wrapper/scripts/otel-sqs-handler#L12 - https://github.com/open-telemetry/opentelemetry-lambda/blob/b004abbc9af28f9a384f7c0c254abcfe578a2a59/java/layer-wrapper/scripts/otel-stream-handler#L12 - https://github.com/open-telemetry/opentelemetry-lambda/blob/b004abbc9af28f9a384f7c0c254abcfe578a2a59/nodejs/packages/layer/scripts/otel-handler#L9 --- python/src/otel/otel_sdk/otel-instrument | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/src/otel/otel_sdk/otel-instrument b/python/src/otel/otel_sdk/otel-instrument index c159be6b79..dc6ee6ba49 100755 --- a/python/src/otel/otel_sdk/otel-instrument +++ b/python/src/otel/otel_sdk/otel-instrument @@ -151,4 +151,4 @@ export _HANDLER="otel_wrapper.lambda_handler"; # - Call the upstream auto instrumentation script -python3 $LAMBDA_LAYER_PKGS_DIR/bin/opentelemetry-instrument "$@" +exec python3 $LAMBDA_LAYER_PKGS_DIR/bin/opentelemetry-instrument "$@"