Skip to content

Commit 4a1db2e

Browse files
authored
[chore] Fix Java and nodejs Lambda Layer failures. (#1110)
* Use stable otel lambda submodule * Pass node instrumentations and modify build script * Revert 2.x changes to java * Add python 3.13 in integration tests
1 parent c6e9a58 commit 4a1db2e

File tree

15 files changed

+1175
-2473
lines changed

15 files changed

+1175
-2473
lines changed

OTEL_Version.patch

Lines changed: 430 additions & 2446 deletions
Large diffs are not rendered by default.

adot/python/src/template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Resources:
1818
- python3.9
1919
- python3.10
2020
- python3.11
21+
- python3.12
22+
- python3.13
2123
Metadata:
2224
BuildMethod: makefile
2325
api:

java/build.gradle.kts

Lines changed: 4 additions & 4 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.42.0"))
32-
compileOnly(platform("io.opentelemetry:opentelemetry-bom-alpha:1.42.0-alpha"))
31+
compileOnly(platform("io.opentelemetry:opentelemetry-bom:1.32.0"))
32+
compileOnly(platform("io.opentelemetry:opentelemetry-bom-alpha:1.32.0-alpha"))
3333
// Already included in wrapper so compileOnly
3434
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
35-
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-aws:1.19.0")
36-
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:2.10.0")
35+
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-aws")
36+
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:1.32.0-adot-lambda1")
3737
}
3838

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

java/build.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
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+
OTEL_VERSION="1.32.0"
8+
ADOT_VERSION="1.32.0"
9+
10+
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git
11+
pushd opentelemetry-java-instrumentation
12+
git checkout v${OTEL_VERSION} -b tag-v${OTEL_VERSION}
13+
patch -p1 < "$SOURCEDIR"/../patches/opentelemetry-java-instrumentation.patch
14+
git add -A
15+
git commit -m "Create patch version"
16+
./gradlew publishToMavenLocal
17+
popd
18+
19+
rm -rf opentelemetry-java-instrumentation
20+
21+
22+
git clone https://github.com/aws-observability/aws-otel-java-instrumentation.git
23+
24+
pushd aws-otel-java-instrumentation
25+
26+
git checkout v${ADOT_VERSION} -b tag-v${ADOT_VERSION}
27+
patch -p1 < "${SOURCEDIR}"/../patches/aws-otel-java-instrumentation.patch
28+
git add -A
29+
git commit -a -m "Create patch version"
30+
CI=false ./gradlew publishToMavenLocal -Prelease.version=${ADOT_VERSION}-adot-lambda1
31+
popd
32+
33+
rm -rf aws-otel-java-instrumentation
34+
535
# Build collector
636

737
pushd ../opentelemetry-lambda/collector || exit

java/scripts/otel-handler

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export OTEL_INSTRUMENTATION_AWS_SDK_EXPERIMENTAL_SPAN_ATTRIBUTES=true
44

5-
export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:xray-lambda,tracecontext,b3,b3multi}"
5+
export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:-xray,tracecontext,b3,b3multi}"
66

77
# Temporarily set OTEL_SERVICE_NAME variable to work around but in javaagent not handling
88
# OTEL_RESOURCE_ATTRIBUTES as set in otel-handler-upstream. It doesn't hurt to apply this

java/scripts/otel-proxy-handler

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
export OTEL_INSTRUMENTATION_AWS_SDK_EXPERIMENTAL_SPAN_ATTRIBUTES=true
44

5-
export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:xray-lambda,tracecontext,b3,b3multi}"
5+
export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:-xray,tracecontext,b3,b3multi}"
66

77
source /opt/otel-proxy-handler-upstream

java/scripts/otel-stream-handler

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
export OTEL_INSTRUMENTATION_AWS_SDK_EXPERIMENTAL_SPAN_ATTRIBUTES=true
44

5-
export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:xray-lambda,tracecontext,b3,b3multi}"
5+
export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:-xray,tracecontext,b3,b3multi}"
66

77
source /opt/otel-stream-handler-upstream

nodejs/build.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ mv ./packages/layer/build/workspace/otel-handler ./packages/layer/build/workspac
2222
cp "$SOURCEDIR"/scripts/otel-handler ./packages/layer/build/workspace/otel-handler
2323
# This assumes that generators and propagators does not have additional dependencies outside of normal OTel ones.
2424
# It's inconceivable for this to ever be incorrect.
25-
cp -r "$SOURCEDIR"/wrapper-adot/node_modules/@opentelemetry/id-generator-aws-xray ./packages/layer/build/workspace/nodejs/node_modules/@opentelemetry
26-
cp -r "$SOURCEDIR"/wrapper-adot/node_modules/@opentelemetry/propagator-aws-xray ./packages/layer/build/workspace/nodejs/node_modules/@opentelemetry
27-
cp -r "$SOURCEDIR"/wrapper-adot/node_modules/@opentelemetry/propagator-b3 ./packages/layer/build/workspace/nodejs/node_modules/@opentelemetry
25+
cp -r "$SOURCEDIR"/wrapper-adot/node_modules/@opentelemetry ./packages/layer/build/workspace/node_modules/
2826
cp "$SOURCEDIR"/wrapper-adot/build/src/adot-extension.* ./packages/layer/build/workspace/
2927

3028
cd ./packages/layer/build/workspace || exit

nodejs/scripts/otel-handler

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
export NODE_OPTIONS="--require /opt/adot-extension.js ${NODE_OPTIONS}"
44

5+
# If both OTEL_NODE_ENABLED_INSTRUMENTATIONS and OTEL_NODE_DISABLED_INSTRUMENTATIONS are not configured,
6+
# set OTEL_NODE_ENABLED_INSTRUMENTATIONS="aws-sdk,aws-lambda,http"
7+
if [ -z "${OTEL_NODE_ENABLED_INSTRUMENTATIONS}" ] && [ -z "${OTEL_NODE_DISABLED_INSTRUMENTATIONS}" ]; then
8+
export OTEL_NODE_ENABLED_INSTRUMENTATIONS="aws-sdk,aws-lambda,http"
9+
10+
# Else if OTEL_NODE_ENABLED_INSTRUMENTATIONS is configured and OTEL_NODE_DISABLED_INSTRUMENTATIONS is not,
11+
# append OTEL_NODE_ENABLED_INSTRUMENTATIONS with "aws-lambda,http"
12+
elif [ -n "${OTEL_NODE_ENABLED_INSTRUMENTATIONS}" ] && [ -z "${OTEL_NODE_DISABLED_INSTRUMENTATIONS}" ]; then
13+
export OTEL_NODE_ENABLED_INSTRUMENTATIONS="${OTEL_NODE_ENABLED_INSTRUMENTATIONS},aws-lambda,http"
14+
15+
# Else if both OTEL_NODE_ENABLED_INSTRUMENTATIONS and OTEL_NODE_DISABLED_INSTRUMENTATIONS are configured,
16+
# append OTEL_NODE_ENABLED_INSTRUMENTATIONS with "aws-lambda,http"
17+
elif [ -n "${OTEL_NODE_ENABLED_INSTRUMENTATIONS}" ] && [ -n "${OTEL_NODE_DISABLED_INSTRUMENTATIONS}" ]; then
18+
export OTEL_NODE_ENABLED_INSTRUMENTATIONS="${OTEL_NODE_ENABLED_INSTRUMENTATIONS},aws-lambda,http"
19+
20+
# Else do nothing
21+
fi
22+
523
if [[ -z "$OTEL_PROPAGATORS" ]]; then
624
export OTEL_PROPAGATORS="tracecontext,baggage,xray-lambda"
725
fi

nodejs/wrapper-adot/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
"typescript": "5.8.3"
3838
},
3939
"dependencies": {
40-
"@opentelemetry/core": "^2.0.0",
41-
"@opentelemetry/id-generator-aws-xray": "^2.0.0",
42-
"@opentelemetry/sdk-trace-node": "^2.0.0",
43-
"@opentelemetry/propagator-aws-xray": "^2.0.0",
44-
"@opentelemetry/propagator-b3": "^2.0.0",
45-
"@opentelemetry/sdk-trace-base": "^2.0.0"
40+
"@opentelemetry/core": "^1.30.0",
41+
"@opentelemetry/id-generator-aws-xray": "^1.2.3",
42+
"@opentelemetry/sdk-trace-node": "^1.30.0",
43+
"@opentelemetry/propagator-aws-xray": "^1.26.2",
44+
"@opentelemetry/propagator-b3": "^1.30.0",
45+
"@opentelemetry/sdk-trace-base": "^1.30.0"
4646
}
4747
}

0 commit comments

Comments
 (0)