Skip to content

Commit

Permalink
Upgrade to utilize latest otel V1.33.6 (#960)
Browse files Browse the repository at this point in the history
*Description of changes:*
1. Update the
[opentelemetry-java-instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation)
version to the most latest otel v1.x -> v1.33.6, Which support JDK 21.
2. Update the
[opentelemetry-java-contrib](https://github.com/open-telemetry/opentelemetry-java-contrib)
version to 1.39.0, which is the latest version support JDK 21.
3. Update contract tests environment to JDK 21 for test.

Testing:
Audited the upstream changelog, there is no breaking change from v1.33.0
to 1.33.6, only bug fix and version upgrades.
All contract tests and smoke tests passed as expected.
Running E2E test locally with the updated agent, making sure a service
attributes and map shows as expected.


By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
zzhlogin authored Dec 11, 2024
1 parent f3c87ee commit 12f770e
Show file tree
Hide file tree
Showing 24 changed files with 141 additions and 118 deletions.
188 changes: 98 additions & 90 deletions .github/patches/opentelemetry-java-instrumentation.patch

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/patches/versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OTEL_JAVA_INSTRUMENTATION_VERSION=v1.32.1
OTEL_JAVA_INSTRUMENTATION_VERSION=v1.33.6
4 changes: 2 additions & 2 deletions .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v1

Expand All @@ -219,7 +219,7 @@ jobs:
key: ${{ runner.os }}-maven-local-${{ hashFiles('.github/patches/opentelemetry-java*.patch') }}

- name: Pull base image of Contract Tests Sample Apps
run: docker pull public.ecr.aws/docker/library/amazoncorretto:17-alpine
run: docker pull public.ecr.aws/docker/library/amazoncorretto:21-alpine

- name: Build snapshot with Gradle
uses: gradle/gradle-build-action@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly-upstream-snapshot-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v1

Expand All @@ -136,7 +136,7 @@ jobs:
registry: public.ecr.aws

- name: Pull base image of Contract Tests Sample Apps
run: docker pull public.ecr.aws/docker/library/amazoncorretto:17-alpine
run: docker pull public.ecr.aws/docker/library/amazoncorretto:21-alpine

- name: Build snapshot with Gradle
uses: gradle/gradle-build-action@v3
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,28 @@ jobs:
with:
arguments: build integrationTests --stacktrace -PenableCoverage=true -PlocalDocker=true

- name: Set up Java version for tests
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin

- name: Pull base image of Contract Tests Sample Apps
if: ${{ matrix.os == 'ubuntu-latest' }}
run: docker pull public.ecr.aws/docker/library/amazoncorretto:17-alpine
run: docker pull public.ecr.aws/docker/library/amazoncorretto:21-alpine

- name: Run contract tests
uses: gradle/gradle-build-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
arguments: contractTests -PlocalDocker=true -i

- name: Set up Java version for image build
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin

- name: Get current version
if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-aws-sdk-v1",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-aws-sdk-v2",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
2 changes: 1 addition & 1 deletion appsignals-tests/images/grpc/grpc-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"grpc-client",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
2 changes: 1 addition & 1 deletion appsignals-tests/images/grpc/grpc-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"grpc-server",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-apache-http-client-app",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-native-http-client-app",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-netty-http-client-app",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-spring-mvc-client-app",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-http-server-netty-server",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-http-server-spring-mvc",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-http-server-tomcat",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
2 changes: 1 addition & 1 deletion appsignals-tests/images/jdbc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-jdbc-app",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-kafka-kafka-consumers",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-tests-kafka-kafka-producers",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
2 changes: 1 addition & 1 deletion appsignals-tests/images/mock-collector/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tasks {
}
jib {
configureImages(
"public.ecr.aws/docker/library/amazoncorretto:17-alpine",
"public.ecr.aws/docker/library/amazoncorretto:21-alpine",
"aws-appsignals-mock-collector",
localDocker = rootProject.property("localDocker")!! == "true",
multiPlatform = false,
Expand Down
4 changes: 2 additions & 2 deletions awsagentprovider/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ dependencies {
testRuntimeOnly("io.opentelemetry:opentelemetry-exporter-otlp-common")

compileOnly("com.google.code.findbugs:jsr305:3.0.2")
testImplementation("org.mockito:mockito-core:5.3.1")
testImplementation("org.mockito:mockito-junit-jupiter:5.8.0")
testImplementation("org.mockito:mockito-core:5.14.2")
testImplementation("org.mockito:mockito-junit-jupiter:5.14.2")
}

tasks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ private SpanData buildSpanDataMock() {
when(mockSpanData.getParentSpanContext()).thenReturn(parentSpanContextMock);

SpanContext spanContextMock = mock(SpanContext.class);
TraceFlags spanContextTraceFlagsMock = mock(TraceFlags.class);
when(spanContextMock.isValid()).thenReturn(true);
when(spanContextMock.getTraceFlags()).thenReturn(spanContextTraceFlagsMock);
when(mockSpanData.getSpanContext()).thenReturn(spanContextMock);

TraceState traceState = TraceState.builder().build();
Expand Down
9 changes: 5 additions & 4 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ data class DependencySet(val group: String, val version: String, val modules: Li
val TEST_SNAPSHOTS = rootProject.findProperty("testUpstreamSnapshots") == "true"

// This is the version of the upstream instrumentation BOM
val otelVersion = "1.32.1-adot2"
val otelSnapshotVersion = "1.33.0"
val otelVersion = "1.33.6-adot1"
val otelSnapshotVersion = "1.33.6"
val otelAlphaVersion = if (!TEST_SNAPSHOTS) "$otelVersion-alpha" else "$otelSnapshotVersion-alpha-SNAPSHOT"
val otelJavaAgentVersion = if (!TEST_SNAPSHOTS) otelVersion else "$otelSnapshotVersion-SNAPSHOT"
// All versions below are only used in testing and do not affect the released artifact.
Expand Down Expand Up @@ -73,10 +73,11 @@ val DEPENDENCIES = listOf(
"commons-logging:commons-logging:1.2",
"com.sparkjava:spark-core:2.9.4",
"com.squareup.okhttp3:okhttp:4.12.0",
"io.opentelemetry.contrib:opentelemetry-aws-xray:1.32.0",
"io.opentelemetry.contrib:opentelemetry-aws-resources:1.32.0-alpha",
"io.opentelemetry.contrib:opentelemetry-aws-xray:1.39.0",
"io.opentelemetry.contrib:opentelemetry-aws-resources:1.39.0-alpha",
"io.opentelemetry.proto:opentelemetry-proto:1.0.0-alpha",
"io.opentelemetry.javaagent:opentelemetry-javaagent:$otelJavaAgentVersion",
"io.opentelemetry:opentelemetry-extension-aws:1.20.1",
"net.bytebuddy:byte-buddy:1.14.10",
)

Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/corretto-slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/docker/library/amazoncorretto:17-alpine-jdk
FROM public.ecr.aws/docker/library/amazoncorretto:21-alpine-jdk

# Copied from https://github.com/corretto/corretto-docker/blob/master/11/jre/alpine/Dockerfile
RUN apk update && apk add binutils && jlink --endian little --release-info $JAVA_HOME/release \
Expand Down

0 comments on commit 12f770e

Please sign in to comment.