Skip to content

Commit bd6838d

Browse files
committed
polishing the layer script
1 parent f696f40 commit bd6838d

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lambda-layer/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
build
66

77
# Ignore Terraform state files
8-
.terraform
8+
.terraform/
99
*.tfstate
1010
*.tfstate.backup
1111
*.lock.hcl

lambda-layer/build-layer.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ popd
4646
echo "Info: Building ADOT Lambda Java SDK Layer Code"
4747
./gradlew build -PotelVersion=${version}
4848

49-
5049
## Copy ADOT Java Agent downloaded using Gradle task and bundle it with the Lambda handler script
5150
echo "Info: Creating the layer artifact"
52-
cp "$SOURCEDIR"/build/javaagent/aws-opentelemetry-agent*.jar ./opentelemetry-javaagent.jar
53-
zip -qr opentelemetry-javaagent-layer.zip opentelemetry-javaagent.jar otel-instrument
51+
mkdir -p "$SOURCEDIR"/build/distributions/
52+
cp "$SOURCEDIR"/build/javaagent/aws-opentelemetry-agent*.jar "$SOURCEDIR"/build/distributions/aws-opentelemetry-javaagent.jar
53+
zip -r ./build/distributions/aws-opentelemetry-java-layer.zip "$SOURCEDIR"/build/distributions/aws-opentelemetry-javaagent.jar otel-instrument
54+
55+
## Cleanup
56+
# revert the patch applied since it is only needed while building the layer.
57+
git restore ../dependencyManagement/build.gradle.kts

lambda-layer/otel-instrument

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:-xray,tracecontext,b3,b3multi}"
66

77
export OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-${AWS_LAMBDA_FUNCTION_NAME}}
88

9-
export JAVA_TOOL_OPTIONS="-javaagent:/opt/opentelemetry-javaagent.jar ${JAVA_TOOL_OPTIONS}"
9+
export JAVA_TOOL_OPTIONS="-javaagent:/opt/aws-opentelemetry-javaagent.jar ${JAVA_TOOL_OPTIONS}"
1010

1111
if [[ $OTEL_RESOURCE_ATTRIBUTES != *"service.name="* ]]; then
1212
export OTEL_RESOURCE_ATTRIBUTES="service.name=${AWS_LAMBDA_FUNCTION_NAME},${OTEL_RESOURCE_ATTRIBUTES}"

0 commit comments

Comments
 (0)