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

Set default Propagators list and bash script flags #1226

Merged
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
6 changes: 6 additions & 0 deletions java/layer-javaagent/scripts/otel-handler
Original file line number Diff line number Diff line change
@@ -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

########################################
Expand Down
6 changes: 6 additions & 0 deletions java/layer-wrapper/scripts/otel-handler
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/bash

set -ef -o pipefail

export OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER="$_HANDLER"
export _HANDLER="io.opentelemetry.instrumentation.awslambdaevents.v2_2.TracingRequestWrapper"

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
Expand Down
6 changes: 6 additions & 0 deletions java/layer-wrapper/scripts/otel-proxy-handler
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/bash

set -ef -o pipefail

export OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER="$_HANDLER"
export _HANDLER="io.opentelemetry.instrumentation.awslambdaevents.v2_2.TracingRequestApiGatewayWrapper"

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
Expand Down
6 changes: 6 additions & 0 deletions java/layer-wrapper/scripts/otel-sqs-handler
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/bash

set -ef -o pipefail

export OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER="$_HANDLER"
export _HANDLER="io.opentelemetry.instrumentation.awslambdaevents.v2_2.TracingSqsEventWrapper"

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
Expand Down
6 changes: 6 additions & 0 deletions java/layer-wrapper/scripts/otel-stream-handler
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/bash

set -ef -o pipefail

export OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER="$_HANDLER"
export _HANDLER="io.opentelemetry.instrumentation.awslambdacore.v1_0.TracingRequestStreamWrapper"

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
Expand Down
6 changes: 6 additions & 0 deletions nodejs/packages/layer/scripts/otel-handler
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion python/sample-apps/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -euf -o pipefail

cp -r ../src/otel .
cp ../src/run.sh layer.sh
Expand Down
8 changes: 8 additions & 0 deletions python/src/otel/otel_sdk/otel-instrument
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -ef -o pipefail

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions utils/sam/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

set -e
set -u
set -euf -o pipefail

echo_usage() {
echo "usage: Deploy Lambda layer/application by SAM"
Expand Down
Loading