-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming to otel-instrument and default configs (#956)
- Loading branch information
Showing
3 changed files
with
39 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
export OTEL_INSTRUMENTATION_AWS_SDK_EXPERIMENTAL_SPAN_ATTRIBUTES=true | ||
|
||
export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:-xray,tracecontext,b3,b3multi}" | ||
|
||
export OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-${AWS_LAMBDA_FUNCTION_NAME}} | ||
|
||
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 | ||
|
||
export OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT=10000 | ||
|
||
# Disable the Application Signals runtime metrics since we are on Lambda | ||
export OTEL_AWS_APPLICATION_SIGNALS_RUNTIME_ENABLED=false | ||
|
||
# Use OTLP traces exporter if not specified | ||
export OTEL_TRACES_EXPORTER=${OTEL_TRACES_EXPORTER:-"otlp"} | ||
|
||
# Disable metrics and logs export by default if not specified | ||
export OTEL_METRICS_EXPORTER=${OTEL_METRICS_EXPORTER:-"none"} | ||
export OTEL_LOGS_EXPORTER=${OTEL_LOGS_EXPORTER:-"none"} | ||
|
||
# Enable Application Signals by default if not specified | ||
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=${OTEL_AWS_APPLICATION_SIGNALS_ENABLED:-"true"} | ||
|
||
# Append Lambda Resource Attributes to OTel Resource Attribute List | ||
LAMBDA_RESOURCE_ATTRIBUTES="cloud.region=$AWS_REGION,cloud.provider=aws,faas.name=$AWS_LAMBDA_FUNCTION_NAME,faas.version=$AWS_LAMBDA_FUNCTION_VERSION,faas.instance=$AWS_LAMBDA_LOG_STREAM_NAME,aws.log.group.names=$AWS_LAMBDA_LOG_GROUP_NAME"; | ||
if [ -z "${OTEL_RESOURCE_ATTRIBUTES}" ]; then | ||
export OTEL_RESOURCE_ATTRIBUTES=$LAMBDA_RESOURCE_ATTRIBUTES; | ||
else | ||
export OTEL_RESOURCE_ATTRIBUTES="$LAMBDA_RESOURCE_ATTRIBUTES,$OTEL_RESOURCE_ATTRIBUTES"; | ||
fi | ||
|
||
exec "$@" |