diff --git a/java/layer-javaagent/scripts/otel-handler b/java/layer-javaagent/scripts/otel-handler index a1db80f8c3..adb31a263e 100755 --- a/java/layer-javaagent/scripts/otel-handler +++ b/java/layer-javaagent/scripts/otel-handler @@ -1,11 +1,17 @@ #!/bin/bash +set -ef -o pipefail + export JAVA_TOOL_OPTIONS="-javaagent:/opt/opentelemetry-javaagent.jar ${JAVA_TOOL_OPTIONS}" if [[ $OTEL_RESOURCE_ATTRIBUTES != *"service.name="* ]]; then export OTEL_RESOURCE_ATTRIBUTES="service.name=${AWS_LAMBDA_FUNCTION_NAME},${OTEL_RESOURCE_ATTRIBUTES}" fi +if [[ -z "$OTEL_PROPAGATORS" ]]; then + export OTEL_PROPAGATORS="tracecontext,baggage,xray" +fi + export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000 ######################################## diff --git a/java/layer-wrapper/scripts/otel-handler b/java/layer-wrapper/scripts/otel-handler index 8138f12131..0bc9d33dd6 100755 --- a/java/layer-wrapper/scripts/otel-handler +++ b/java/layer-wrapper/scripts/otel-handler @@ -1,5 +1,7 @@ #!/bin/bash +set -ef -o pipefail + export OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER="$_HANDLER" export _HANDLER="io.opentelemetry.instrumentation.awslambdaevents.v2_2.TracingRequestWrapper" @@ -7,6 +9,10 @@ if [[ $OTEL_RESOURCE_ATTRIBUTES != *"service.name="* ]]; then export OTEL_RESOURCE_ATTRIBUTES="service.name=${AWS_LAMBDA_FUNCTION_NAME},${OTEL_RESOURCE_ATTRIBUTES}" fi +if [[ -z "$OTEL_PROPAGATORS" ]]; then + export OTEL_PROPAGATORS="tracecontext,baggage,xray" +fi + export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000 # java17 runtime puts the handler to run as a command line argument and seems to prefer diff --git a/java/layer-wrapper/scripts/otel-proxy-handler b/java/layer-wrapper/scripts/otel-proxy-handler index ee4e8e960b..86de184cd4 100755 --- a/java/layer-wrapper/scripts/otel-proxy-handler +++ b/java/layer-wrapper/scripts/otel-proxy-handler @@ -1,5 +1,7 @@ #!/bin/bash +set -ef -o pipefail + export OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER="$_HANDLER" export _HANDLER="io.opentelemetry.instrumentation.awslambdaevents.v2_2.TracingRequestApiGatewayWrapper" @@ -7,6 +9,10 @@ if [[ $OTEL_RESOURCE_ATTRIBUTES != *"service.name="* ]]; then export OTEL_RESOURCE_ATTRIBUTES="service.name=${AWS_LAMBDA_FUNCTION_NAME},${OTEL_RESOURCE_ATTRIBUTES}" fi +if [[ -z "$OTEL_PROPAGATORS" ]]; then + export OTEL_PROPAGATORS="tracecontext,baggage,xray" +fi + export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000 # java17 runtime puts the handler to run as a command line argument and seems to prefer diff --git a/java/layer-wrapper/scripts/otel-sqs-handler b/java/layer-wrapper/scripts/otel-sqs-handler index 69553569f0..11138faccb 100755 --- a/java/layer-wrapper/scripts/otel-sqs-handler +++ b/java/layer-wrapper/scripts/otel-sqs-handler @@ -1,5 +1,7 @@ #!/bin/bash +set -ef -o pipefail + export OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER="$_HANDLER" export _HANDLER="io.opentelemetry.instrumentation.awslambdaevents.v2_2.TracingSqsEventWrapper" @@ -7,6 +9,10 @@ if [[ $OTEL_RESOURCE_ATTRIBUTES != *"service.name="* ]]; then export OTEL_RESOURCE_ATTRIBUTES="service.name=${AWS_LAMBDA_FUNCTION_NAME},${OTEL_RESOURCE_ATTRIBUTES}" fi +if [[ -z "$OTEL_PROPAGATORS" ]]; then + export OTEL_PROPAGATORS="tracecontext,baggage,xray" +fi + export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000 # java17 runtime puts the handler to run as a command line argument and seems to prefer diff --git a/java/layer-wrapper/scripts/otel-stream-handler b/java/layer-wrapper/scripts/otel-stream-handler index 1d3dcffce3..c48263b87a 100755 --- a/java/layer-wrapper/scripts/otel-stream-handler +++ b/java/layer-wrapper/scripts/otel-stream-handler @@ -1,5 +1,7 @@ #!/bin/bash +set -ef -o pipefail + export OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER="$_HANDLER" export _HANDLER="io.opentelemetry.instrumentation.awslambdacore.v1_0.TracingRequestStreamWrapper" @@ -7,6 +9,10 @@ if [[ $OTEL_RESOURCE_ATTRIBUTES != *"service.name="* ]]; then export OTEL_RESOURCE_ATTRIBUTES="service.name=${AWS_LAMBDA_FUNCTION_NAME},${OTEL_RESOURCE_ATTRIBUTES}" fi +if [[ -z "$OTEL_PROPAGATORS" ]]; then + export OTEL_PROPAGATORS="tracecontext,baggage,xray" +fi + export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000 # java17 runtime puts the handler to run as a command line argument and seems to prefer diff --git a/nodejs/packages/layer/scripts/otel-handler b/nodejs/packages/layer/scripts/otel-handler index 531db3d37a..e5b5aed846 100755 --- a/nodejs/packages/layer/scripts/otel-handler +++ b/nodejs/packages/layer/scripts/otel-handler @@ -1,9 +1,15 @@ #!/bin/bash +set -ef -o pipefail + export NODE_OPTIONS="${NODE_OPTIONS} --require /opt/wrapper.js" if [[ $OTEL_RESOURCE_ATTRIBUTES != *"service.name="* ]]; then export OTEL_RESOURCE_ATTRIBUTES="service.name=${AWS_LAMBDA_FUNCTION_NAME},${OTEL_RESOURCE_ATTRIBUTES}" fi +if [[ -z "$OTEL_PROPAGATORS" ]]; then + export OTEL_PROPAGATORS="tracecontext,baggage,xray" +fi + exec "$@" diff --git a/python/sample-apps/run.sh b/python/sample-apps/run.sh index cd247a55b7..5306886809 100755 --- a/python/sample-apps/run.sh +++ b/python/sample-apps/run.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -e +set -euf -o pipefail cp -r ../src/otel . cp ../src/run.sh layer.sh diff --git a/python/src/otel/otel_sdk/otel-instrument b/python/src/otel/otel_sdk/otel-instrument index dc6ee6ba49..47c35d2da6 100755 --- a/python/src/otel/otel_sdk/otel-instrument +++ b/python/src/otel/otel_sdk/otel-instrument @@ -1,5 +1,7 @@ #!/bin/bash +set -ef -o pipefail + # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -98,6 +100,12 @@ if [ -z "${OTEL_SERVICE_NAME}" ]; then export OTEL_SERVICE_NAME=$AWS_LAMBDA_FUNCTION_NAME; fi +# - Set the propagators + +if [[ -z "$OTEL_PROPAGATORS" ]]; then + export OTEL_PROPAGATORS="tracecontext,baggage,xray" +fi + # - Set the Resource Detectors (Resource Attributes) # # TODO: waiting on OTel Python support for configuring Resource Detectors from diff --git a/utils/sam/run.sh b/utils/sam/run.sh index 9d1444cfcb..37c5b30996 100755 --- a/utils/sam/run.sh +++ b/utils/sam/run.sh @@ -1,7 +1,6 @@ #!/bin/bash -set -e -set -u +set -euf -o pipefail echo_usage() { echo "usage: Deploy Lambda layer/application by SAM"