Skip to content

Commit bf1e526

Browse files
rapphilhumivo
andauthored
POC to fix lambda layers (#572)
* POC for reverting lambda context propagation change * fix build.sh * Fix build.sh * Fix patch * Increase duration for creds * Remove run on pull request --------- Co-authored-by: Huy Vo <[email protected]>
1 parent d508bca commit bf1e526

9 files changed

+662
-11
lines changed

.github/workflows/main-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
if: ${{ matrix.language == 'java' }}
9090
with:
9191
distribution: corretto
92-
java-version: '11'
92+
java-version: '17'
9393
- name: Cache (Java)
9494
uses: actions/cache@v3
9595
if: ${{ matrix.language == 'java' }}
@@ -136,7 +136,7 @@ jobs:
136136
- uses: aws-actions/configure-aws-credentials@v1-node16
137137
with:
138138
role-to-assume: ${{ secrets.INTEG_TEST_LAMBDA_ROLE_ARN }}
139-
role-duration-seconds: 1200
139+
role-duration-seconds: 7200
140140
aws-region: us-east-1
141141
- name: Patch ADOT
142142
run: ./patch-upstream.sh

.github/workflows/pr-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
if: ${{ matrix.language == 'java' }}
3030
with:
3131
distribution: corretto
32-
java-version: '11'
32+
java-version: '17'
3333
- name: Cache (Java)
3434
uses: actions/cache@v3
3535
if: ${{ matrix.language == 'java' }}

collector.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,16 @@ index 7cdea69..553e649 100644
3737
Version: c.version,
3838
},
3939
ConfigProvider: c.configProvider,
40+
diff --git a/collector/Makefile b/collector/Makefile
41+
index 8a3d532..e272d83 100644
42+
--- a/collector/Makefile
43+
+++ b/collector/Makefile
44+
@@ -44,7 +44,7 @@ package: build
45+
@echo Package zip file for collector extension layer
46+
mkdir -p $(BUILD_SPACE)/collector-config
47+
cp config* $(BUILD_SPACE)/collector-config
48+
- cd $(BUILD_SPACE) && zip -r opentelemetry-collector-layer-$(GOARCH).zip collector-config extensions
49+
+ cd $(BUILD_SPACE) && zip -r collector-extension-$(GOARCH).zip collector-config extensions
50+
51+
.PHONY: publish
52+
publish:

java/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ val javaagentDependency by configurations.creating {
2828
}
2929

3030
dependencies {
31-
compileOnly(platform("io.opentelemetry:opentelemetry-bom:1.25.0"))
32-
compileOnly(platform("io.opentelemetry:opentelemetry-bom-alpha:1.25.0-alpha"))
31+
compileOnly(platform("io.opentelemetry:opentelemetry-bom:1.26.0"))
32+
compileOnly(platform("io.opentelemetry:opentelemetry-bom-alpha:1.26.0-alpha"))
3333
// Already included in wrapper so compileOnly
3434
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
3535
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-aws")
36-
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:1.26.0")
36+
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:1.26.0-adot-lambda1")
3737
}
3838

3939
tasks.register<Copy>("download") {

java/build.sh

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

33
SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
44

5+
6+
## revert https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/7970
7+
8+
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git
9+
pushd opentelemetry-java-instrumentation
10+
git checkout v1.26.0 -b tag-v1.26.0
11+
patch -p1 < "$SOURCEDIR"/../patches/opentelemetry-java-instrumentation.patch
12+
git add -A
13+
git commit -m "Create patch version"
14+
./gradlew publishToMavenLocal
15+
popd
16+
17+
rm -rf opentelemetry-java-instrumentation
18+
19+
20+
git clone https://github.com/aws-observability/aws-otel-java-instrumentation.git
21+
22+
pushd aws-otel-java-instrumentation
23+
24+
git checkout v1.26.0 -b tag-v1.26.0
25+
patch -p1 < "${SOURCEDIR}"/../patches/aws-otel-java-instrumentation.patch
26+
git add -A
27+
git commit -a -m "Create patch version"
28+
CI=false ./gradlew publishToMavenLocal -Prelease.version=1.26.0-adot-lambda1
29+
popd
30+
31+
rm -rf aws-otel-java-instrumentation
32+
533
# Build collector
634

735
pushd ../opentelemetry-lambda/collector || exit
@@ -13,12 +41,12 @@ popd || exit
1341
./gradlew build
1442

1543
# Move the ADOT Lambda Java SDK code into OTel Lambda Java folder
16-
mkdir -p ../opentelemetry-lambda/java/build/extensions
17-
cp ./build/libs/aws-otel-lambda-java-extensions.jar ../opentelemetry-lambda/java/build/extensions
44+
mkdir -p ../opentelemetry-lambda/java/layer-wrapper/build/extensions
45+
cp ./build/libs/aws-otel-lambda-java-extensions.jar ../opentelemetry-lambda/java/layer-wrapper/build/extensions
1846

1947
# Go to OTel Lambda Java folder
2048
cd ../opentelemetry-lambda/java || exit
21-
49+
patch -p2 < "${SOURCEDIR}/../patches/opentelemetry-lambda_java.patch"
2250
./gradlew build
2351

2452
# Combine Java Agent build and ADOT Collector
@@ -41,6 +69,6 @@ mv otel-handler otel-handler-upstream
4169
mv otel-stream-handler otel-stream-handler-upstream
4270
mv otel-proxy-handler otel-proxy-handler-upstream
4371
cp "$SOURCEDIR"/scripts/* .
44-
unzip -qo ../../../../collector/build/collector-extension-$1.zip
72+
unzip -qo ${SOURCEDIR}/../opentelemetry-lambda/collector/build/collector-extension-$1.zip
4573
zip -qr opentelemetry-java-wrapper.zip *
4674
popd || exit
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts
2+
index edf21b4..c5eb1c3 100644
3+
--- a/dependencyManagement/build.gradle.kts
4+
+++ b/dependencyManagement/build.gradle.kts
5+
@@ -27,7 +27,7 @@ data class DependencySet(val group: String, val version: String, val modules: Li
6+
val TEST_SNAPSHOTS = rootProject.findProperty("testUpstreamSnapshots") == "true"
7+
8+
// This is the version of the upstream instrumentation BOM
9+
-val otelVersion = "1.26.0"
10+
+val otelVersion = "1.26.0-adot-lambda1"
11+
val otelSnapshotVersion = "1.27.0"
12+
13+
// All versions below are only used in testing and do not affect the released artifact.

0 commit comments

Comments
 (0)