Commit f604e22
authored
Onboarding ADOT Java to v2.x - with otel v2.10.0 (#975)
*Description of changes:*
Onboarding ADOT Java to v2.x, with the latest
`opentelemetry-java-instrumentation` dependency version `v2.10.0`.
Update the workflows, adot core implementation codes, contract tests and
smoke tests with following change:
**A. Workflows:**
1. Update `.github/patches/opentelemetry-java-instrumentation.patch`
file with the same code change as previous patch based on upstream
v2.10.0.
2. Upgrade contract testing build env with JDK 23.
**B. Core repo:**
1. Upgrade `com.github.johnrengelman.shadow` to `com.gradleup.shadow` as
it has been marked under maintenance mode:
https://github.com/GradleUp/shadow?tab=readme-ov-file#gradle-shadow
2. Upgrade to new ktlint version 1.4.0, and apply latest spotless
format.
3. Upgrade gradle to 8.10
4. Upgrade `com.diffplug.spotless` to newer version 6.25.0
5. Upgrade `com.google.cloud.tools.jib` to newer version 3.4.4
6. Update the unit test to check the migrated semantic conventions.
7. AWS Resource detector is [set as disabled by
default](open-telemetry/opentelemetry-java-instrumentation#10754),
enable it by setting environment variable
`"otel.resource.providers.aws.enabled"` to be `true`.
**C. Contract tests:**
1. Use the latest `kotlin("jvm")` version to be compatible if the new
Java class from upstream.
2. Add `OTEL_EXPORTER_OTLP_PROTOCOL` to `grpc` for instrumentation as in
[version
v2.0.0](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v2.0.0):
> The default OTLP protocol has been changed from grpc to http/protobuf
in orderto align with the specification.
3. Update tomcat contract test `TOMCAT_THREADS` metric threshold to
`-2`, as the value can be negative by [tomcat
design](https://github.com/apache/tomcat/blob/1afe41491f0e56ec0a776db5ff84607f87ce6640/java/org/apache/tomcat/util/net/AbstractEndpoint.java#L1204).
4. Update the test classes to migrate to the new semantic conventions to
match with [upstream latest
change](open-telemetry/opentelemetry-java-instrumentation@7cd705b):
a. All the change made in
#972:
`http.url` -> `url.full`
`http.method` -> `http.request.method`
`http.status_code` -> `http.response.status_code`
`net.peer.name` -> `server.address`
`net.peer.port` -> `server.port`
b. extra semantic conventions included in contract tests:
`http.scheme` -> `url.scheme`
`http.target` -> `url.query`
`http.url` -> `url.full`
`net.host.name` -> `server.address`
`net.host.port` -> `server.port`
`net.peer.name` -> `server.address`
`net.peer.port` -> `server.port`
`net.protocol.name` -> `network.protocol.name`
`net.protocol.version` -> `network.protocol.version`
`net.sock.host.addr` -> `network.local.address`
`net.sock.host.port` -> `network.local.port`
`net.sock.peer.addr` -> `network.peer.address`
`net.sock.peer.name` -> no replacement, removed
`messaging.kafka.destination.partition` ->
`messaging.destination.partition.id`
`messaging.message.payload_size_bytes` -> `messaging.message.body.size`
Remove `network.protocol.name` attribute check as it has marked as
Conditionally required if not http and network.protocol.version is set:
https://opentelemetry.io/blog/2023/http-conventions-declared-stable/#summary-of-changes.
Conditionally check `peer.service` for http client. Match with PR:
https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/12083/files
Remove local socket attributes from http server span check as it is not
extracted from HttpServerAttributesExtractor
[code](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/5ebb81b8a8ac0e5b3c9f2e175b847a3d0b12251f/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerAttributesExtractorBuilder.java#L141),
Remove `http.response.header.content_length` as it need an explicit
configuration:
https://opentelemetry.io/docs/specs/semconv/attributes-registry/http/#http-response-header
**D. Smoke tests**
Enable controller telemetry using env variable
`OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED`,
which is disabled by default.
https://opentelemetry.io/docs/zero-code/java/agent/disable/#suppressing-controller-andor-view-spans
**Testing:**
1. All contract tests and smoke tests passed.
2. All workflow passed.
3. Tested all E2E tests (This E2E test PR need to be merged after ADOT
Java v2.x released):
- EC2:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12378967612
- EKS:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12382416662
- K8S:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12378972156
- ECS:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12378968843
4. Audit all upstream v2.0.0 - v2.10.0 [change
logs](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
and manual did E2E test and compared the traces, logs, metrics for Java
v1.x vs Java v2.x:

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.1 parent 448d680 commit f604e22
File tree
63 files changed
+2229
-690
lines changed- .github
- patches
- workflows
- appsignals-tests
- contract-tests
- src/test/java/software/amazon/opentelemetry/appsignals/test
- awssdk/base
- base
- grpc
- client
- server
- httpclients/base
- httpservers
- base
- nettyserver
- springmvc
- tomcat
- jdbc
- kafka
- consumers
- producers
- utils
- images
- aws-sdk
- aws-sdk-v1
- aws-sdk-v2
- grpc
- grpc-client
- grpc-server
- http-clients
- apache-http-client
- native-http-client
- netty-http-client
- spring-mvc-client
- http-servers
- netty-server
- spring-mvc
- tomcat
- jdbc
- src/main/java/software/amazon/opentelemetry
- kafka
- kafka-consumers
- kafka-producers
- mock-collector
- awsagentprovider
- src
- main/java/software/amazon/opentelemetry/javaagent/providers
- test/java/software/amazon/opentelemetry/javaagent/providers
- dependencyManagement
- gradle/wrapper
- instrumentation
- jmx-metrics
- log4j-2.13.2
- logback-1.0
- lambda-layer
- otelagent
- sample-apps
- spark-awssdkv1
- spark
- springboot
- scripts/docker/corretto-slim
- smoke-tests
- fakebackend
- runner/src/test/java/io/awsobservability/instrumentation/smoketests/runner
- spring-boot
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
63 files changed
+2229
-690
lines changedLines changed: 1818 additions & 432 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
28 | 41 | | |
29 | 42 | | |
30 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
35 | 49 | | |
36 | 50 | | |
37 | 51 | | |
| |||
120 | 134 | | |
121 | 135 | | |
122 | 136 | | |
123 | | - | |
| 137 | + | |
124 | 138 | | |
125 | 139 | | |
126 | 140 | | |
| |||
136 | 150 | | |
137 | 151 | | |
138 | 152 | | |
139 | | - | |
| 153 | + | |
140 | 154 | | |
141 | 155 | | |
142 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
66 | 73 | | |
67 | 74 | | |
68 | 75 | | |
| |||
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
87 | | - | |
| 94 | + | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
92 | | - | |
| 99 | + | |
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
48 | | - | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments