Skip to content

Don't set OTEL_* ENV vars when already set for non Lambda environment #176

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
37 changes: 29 additions & 8 deletions instrument.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,34 @@ if [ "$ENABLE_PROFILING" = "true" ]; then
export OTEL_DOTNET_AUTO_TRACES_HTTPCLIENT_INSTRUMENTATION_ENABLED="true";

else
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4316"
export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT="http://127.0.0.1:4316/v1/metrics"
export OTEL_METRICS_EXPORTER="none"
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED="true"
export OTEL_TRACES_SAMPLER="xray"
export OTEL_TRACES_SAMPLER_ARG="endpoint=http://127.0.0.1:2000"
if [ -z "${OTEL_EXPORTER_OTLP_PROTOCOL}" ]; then
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf";
fi

if [ -z "${OTEL_EXPORTER_OTLP_ENDPOINT}" ]; then
export OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4316";
fi

if [ -z "${OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT}" ]; then
export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT="http://127.0.0.1:4316/v1/metrics";
fi

if [ -z "${OTEL_METRICS_EXPORTER}" ]; then
export OTEL_METRICS_EXPORTER="none";
fi

if [ -z "${OTEL_AWS_APPLICATION_SIGNALS_ENABLED}" ]; then
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED="true";
fi

if [ -z "${OTEL_TRACES_SAMPLER}" ]; then
export OTEL_TRACES_SAMPLER="xray";
fi

if [ -z "${OTEL_TRACES_SAMPLER_ARG}" ]; then
export OTEL_TRACES_SAMPLER_ARG="endpoint=http://127.0.0.1:2000";
fi

fi

fi
Expand All @@ -242,4 +263,4 @@ if [ ! -z "${AWS_LAMBDA_FUNCTION_NAME}" ]; then
exec "${@//$OTEL_INSTRUMENTATION_AWS_LAMBDA_HANDLER/$_HANDLER}"
else
exec "$@"
fi
fi