Skip to content

Commit caf14e4

Browse files
committed
Plan Java package cleanup
1 parent 9eb3e25 commit caf14e4

2 files changed

Lines changed: 152 additions & 13 deletions

File tree

.github/scripts/check-package-names.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ check_source_set() {
2828
module_path=${dir%%/$source_set/src/main/java*}
2929
module_name=${module_path##*/}
3030

31-
if [[ "$module_name" =~ ^java- ]]; then
32-
continue
33-
fi
3431
if [[ "$module_name" == "jmx-metrics" ]]; then
3532
continue
3633
fi
@@ -51,6 +48,12 @@ check_source_set() {
5148
if [[ "$dir" == "instrumentation/servlet/servlet-common/library/src/main/java/io/opentelemetry/instrumentation/servlet/internal" ]]; then
5249
continue
5350
fi
51+
if [[ "$dir" == instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/javahttpclient* ]]; then
52+
continue
53+
fi
54+
if [[ "$dir" == instrumentation/java-http-server/library/src/main/java/io/opentelemetry/instrumentation/javahttpserver* ]]; then
55+
continue
56+
fi
5457
fi
5558

5659
if [[ "$source_set" == "javaagent" ]]; then
@@ -60,6 +63,7 @@ check_source_set() {
6063
instrumentation/finagle-http-23.11/javaagent/src/main/java/com/twitter/finagle*) continue ;;
6164
instrumentation/finagle-http-23.11/javaagent/src/main/java/io/netty/channel*) continue ;;
6265
instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/reactor/netty/http/client*) continue ;;
66+
instrumentation/spring/spring-boot-resources/javaagent/src/main/java/io/opentelemetry/instrumentation/spring/resources) continue ;;
6367
instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/src/main/java/org/springframework/web/servlet/v3_1*) continue ;;
6468
instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/src/main/java/org/springframework/web/servlet/v6_0*) continue ;;
6569
instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/vertx/redis/client/impl*) continue ;;
@@ -71,6 +75,9 @@ check_source_set() {
7175
instrumentation/akka/akka-actor-fork-join-2.5/javaagent/*) continue ;;
7276
instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11) continue ;;
7377
instrumentation/aws-sdk/aws-sdk-2.2/javaagent/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/internal) continue ;;
78+
instrumentation/java-http-client/javaagent/*) continue ;;
79+
instrumentation/java-http-server/javaagent/*) continue ;;
80+
instrumentation/java-util-logging/javaagent/*) continue ;;
7481
instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-annotations/javaagent/*) continue ;;
7582
instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/javaagent/*) continue ;;
7683
instrumentation/jaxrs/jaxrs-3.0/jaxrs-3.0-annotations/javaagent/*) continue ;;
@@ -106,11 +113,9 @@ check_source_set() {
106113
javaagent:internal-url-class-loader) ;;
107114
javaagent:jaxrs-common) ;;
108115
javaagent:jdbc) ;;
109-
javaagent:jetty-common) ;;
110116
javaagent:jsf-common-jakarta) ;;
111117
javaagent:jsf-common-javax) ;;
112118
javaagent:methods) ;;
113-
javaagent:opensearch-rest-common) ;;
114119
javaagent:opentelemetry-instrumentation-api) ;;
115120
javaagent:oshi) ;;
116121
javaagent:payara) ;;
@@ -121,7 +126,6 @@ check_source_set() {
121126
javaagent:spring-boot-resources) ;;
122127
javaagent:spring-cloud-gateway-common) ;;
123128
javaagent:spring-webmvc-common) ;;
124-
javaagent:tomcat-common) ;;
125129
javaagent:tomcat-jdbc) ;;
126130
*)
127131
echo "module name doesn't have a base version: $dir"
@@ -132,12 +136,15 @@ check_source_set() {
132136

133137
# build expected package name by walking the module name's dash-separated tokens:
134138
# a version token (e.g. "3.0") becomes "/v3_0", any other token becomes "/<token>";
135-
# the literal token "java" is elided (e.g. graphql-java-20.0 -> graphql/v20_0).
139+
# the literal token "java" is elided except when it is the leading token in java-* modules
140+
# where it identifies a JDK instrumentation (e.g. graphql-java-20.0 -> graphql/v20_0,
141+
# but java-http-client -> java/http/client).
136142
# this also handles multi-version modules like jaxrs-2.0-resteasy-3.1 -> jaxrs/v2_0/resteasy/v3_1.
137143
expected_package_name="$expected_prefix"
138144
IFS='-' read -ra module_parts <<< "$module_name"
139-
for part in "${module_parts[@]}"; do
140-
if [[ "$part" == "java" ]]; then
145+
for i in "${!module_parts[@]}"; do
146+
part=${module_parts[$i]}
147+
if [[ "$part" == "java" && "$i" != 0 ]]; then
141148
continue
142149
fi
143150
if [[ "$part" =~ ^[0-9][0-9.]*$ ]]; then

package-name-exceptions-plan.md

Lines changed: 136 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Updated again on 2026-05-14 to plan faster batches: up to 20 changed files per P
88
Updated again on 2026-05-14 to bump the target to up to 40 changed files per PR and plan all remaining historical package renames.
99
Updated on 2026-05-17 after PRs 15-16 merged, and after deciding to handle Akka/Scala forkjoin as a module-name cleanup instead of a package-only cleanup.
1010
Updated on 2026-05-18 after PRs 13, 18, 20, and 21 merged and their historical package exceptions were removed from the checker.
11+
Updated again on 2026-05-18 after deciding that leading `java` is meaningful for JDK instrumentation packages.
12+
Updated again on 2026-05-18 after applying #16090's `*-common` module naming convention and planning PRs 23-26.
13+
Updated on 2026-05-19 after PRs 23-24 merged and their unversioned common-module allowances were removed from the checker.
14+
Updated again on 2026-05-19 after deciding app-server/framework module names for Payara, Quarkus RESTEasy Reactive, and Tomcat JDBC.
15+
Updated on 2026-05-22 after documenting how patch-level base versions map to module names.
1116

1217
## Goal
1318

@@ -19,7 +24,7 @@ The remaining exceptions fall into four buckets:
1924

2025
| Bucket | Current signal | Recommendation |
2126
| --- | --- | --- |
22-
| Module-wide skips | `java-*` has 39 files, `jmx-metrics` has 43 files | Do not start here; these need broader naming decisions. |
27+
| Module-wide skips | `jmx-metrics` has 43 files | Do not start here; this needs a broader naming decision. |
2328
| Library packages under third-party namespaces | `grpc`, `lettuce`, `nats`, `rxjava` each have 1 file | Leave for later; these are likely compatibility/shim packages. |
2429
| Javaagent advice under instrumented library namespaces | mostly 1 file each | Leave for later; the script already says these must live in the instrumented library namespace. |
2530
| Historical javaagent packages | many one-dir modules remain, usually with one source directory | Best place to keep chipping away. |
@@ -44,6 +49,8 @@ These PRs have merged, and their historical javaagent package-name exceptions ha
4449
- PR 18: `jaxrs-common`.
4550
- PR 20: `servlet-common` snippet package.
4651
- PR 21: `servlet-common` root helper package.
52+
- PR 23: `jetty-common` -> `jetty-common-8.0` and `tomcat-common` -> `tomcat-common-7.0`.
53+
- PR 24: `opensearch-rest-common` -> `opensearch-rest-common-1.0`.
4754

4855
PRs 5-8 merged upstream as:
4956

@@ -71,7 +78,13 @@ PRs 13, 18, 20, and 21 merged upstream as:
7178
- #18777: `servlet-common` snippet package.
7279
- #18778: `servlet-common` root helper package.
7380

81+
PRs 23-24 merged upstream as:
82+
83+
- #18786: `jetty-common` -> `jetty-common-8.0` and `tomcat-common` -> `tomcat-common-7.0`.
84+
- #18787: `opensearch-rest-common` -> `opensearch-rest-common-1.0`.
85+
7486
`external-annotations` still remains in the unversioned-module allowlist as `javaagent:external-annotations`; that is a separate module-name exception, not a historical package exception.
87+
`spring-boot-resources` keeps a narrow deprecated compatibility-package exception for `io.opentelemetry.instrumentation.spring.resources`; the replacement javaagent package is already present under `io.opentelemetry.javaagent.instrumentation.spring.boot.resources`.
7588

7689
## PR Creation Notes
7790

@@ -111,7 +124,18 @@ For common-module package moves, search for downstream versioned modules importi
111124

112125
## Open Cleanup PRs
113126

114-
PR 14 is open as #18747 and PR 17 is open as #18772. Keep `.github/scripts/check-package-names.sh` and checker exception removals on `next` until cleanup PRs merge.
127+
PR 14 is open as #18747, PR 17 is open as #18772, PR 22 is open as #18784, and PR 25 is open as #18788. Keep `.github/scripts/check-package-names.sh` and checker exception removals on `next` until cleanup PRs merge.
128+
129+
For JDK instrumentation modules, keep the leading `java` token in package paths. For example,
130+
`java-util-logging` maps to `io.opentelemetry.javaagent.instrumentation.java.util.logging`, while
131+
embedded `java` tokens in third-party library names are still elided, e.g. `graphql-java-20.0` maps
132+
to `graphql.v20_0`.
133+
134+
When the actual minimum supported library version is a patch release, use the containing minor
135+
version in the module and package name instead of including the patch. For example,
136+
`payara-embedded-web:5.2020.2` maps to `payara-5.2020` and package suffix `v5_2020`, not
137+
`payara-5.2020.2` / `v5_2020_2`. Users should be on the latest patch for a given minor line, and
138+
patch-level suffixes would create noisy module names without a meaningful compatibility boundary.
115139

116140
### PR 14: OpenTelemetry annotation and instrumentation API modules (open #18747)
117141

@@ -189,16 +213,124 @@ Suggested verification:
189213
./gradlew :instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent:test
190214
```
191215

216+
### PR 22: Java util logging package
217+
218+
Module:
219+
220+
- `java-util-logging`
221+
222+
Expected package change:
223+
224+
- `io.opentelemetry.javaagent.instrumentation.jul` -> `io.opentelemetry.javaagent.instrumentation.java.util.logging`
225+
226+
Notes:
227+
228+
- Javaagent-only package move.
229+
- Keep the module name and instrumentation name `java-util-logging`.
230+
231+
Suggested verification:
232+
233+
```bash
234+
.github/scripts/check-package-names.sh
235+
./gradlew :instrumentation:java-util-logging:javaagent:test
236+
```
237+
238+
### PR 25: Spring WebMVC common module name
239+
240+
Module:
241+
242+
- `spring-webmvc-common` -> `spring-webmvc-common-3.1`
243+
244+
Expected package change:
245+
246+
- `io.opentelemetry.javaagent.instrumentation.spring.webmvc.common` -> `io.opentelemetry.javaagent.instrumentation.spring.webmvc.common.v3_1`
247+
248+
Notes:
249+
250+
- This is a #16090 common-module convention cleanup. The common javaagent module compiles against `org.springframework:spring-webmvc:3.1.0.RELEASE` and is shared by `spring-webmvc-3.1` and `spring-webmvc-6.0`.
251+
- Estimated changed files: about 27 in the PR branch, excluding the later checker update on `next`.
252+
- Update `settings.gradle.kts`, dependent Gradle project references, package declarations, and imports.
253+
- Keep the `testing` project path with the module rename, but treat testing package changes under `spring.webmvc.boot` and `spring.webmvc.filter` as a separate public testing API decision unless the audit shows they are private-only.
254+
255+
Suggested verification:
256+
257+
```bash
258+
.github/scripts/check-package-names.sh
259+
./gradlew :instrumentation:spring:spring-webmvc:spring-webmvc-common-3.1:javaagent:test :instrumentation:spring:spring-webmvc:spring-webmvc-3.1:javaagent:test :instrumentation:spring:spring-webmvc:spring-webmvc-6.0:javaagent:test
260+
```
261+
262+
### PR 26: Spring Cloud Gateway common testing package decision
263+
264+
Module:
265+
266+
- `spring-cloud-gateway-common`
267+
268+
Expected package decision:
269+
270+
- Keep `spring-cloud-gateway-common` unversioned for the javaagent helper unless a deeper audit finds a direct Spring Cloud Gateway API dependency.
271+
- Decide whether testing packages should move from `io.opentelemetry.instrumentation.spring.gateway.common` to `io.opentelemetry.instrumentation.spring.cloud.gateway.common`.
272+
273+
Notes:
274+
275+
- The javaagent helper has no direct Spring Cloud Gateway compile dependency and is shared by WebFlux/WebMVC instrumentations, so #16090 does not obviously require a versioned module name.
276+
- Estimated changed files: about 7 if this is only the testing package rename; more if the audit expands scope beyond testing packages.
277+
- The likely cleanup is only the testing package name, and this may be public testing API. Keep it separate from the module-name PRs above.
278+
279+
Suggested verification:
280+
281+
```bash
282+
.github/scripts/check-package-names.sh
283+
./gradlew :instrumentation:spring:spring-cloud-gateway:spring-cloud-gateway-common:javaagent:test :instrumentation:spring:spring-cloud-gateway:spring-cloud-gateway-2.0:javaagent:test :instrumentation:spring:spring-cloud-gateway:spring-cloud-gateway-webmvc-4.3:javaagent:test
284+
```
285+
286+
### PR 27: App-server and framework module names
287+
288+
Modules:
289+
290+
- `payara` -> `payara-5.2020`
291+
- `quarkus-resteasy-reactive` -> `quarkus-resteasy-reactive-1.11`
292+
- `tomcat-jdbc` -> `tomcat-jdbc-8.5`
293+
294+
Expected package changes:
295+
296+
- `io.opentelemetry.javaagent.instrumentation.payara` -> `io.opentelemetry.javaagent.instrumentation.payara.v5_2020`
297+
- `io.opentelemetry.javaagent.instrumentation.quarkus.resteasy.reactive` -> `io.opentelemetry.javaagent.instrumentation.quarkus.resteasy.reactive.v1_11`
298+
- `io.opentelemetry.javaagent.instrumentation.tomcat.jdbc` -> `io.opentelemetry.javaagent.instrumentation.tomcat.jdbc.v8_5`
299+
300+
Notes:
301+
302+
- These are module-name cleanups, not just package moves. Update `settings.gradle.kts`, instrumentation inventory/docs, FOSSA config, Gradle project references, package declarations, imports, and checker allowlist entries after merge.
303+
- Keep existing instrumentation names as compatibility aliases. For Quarkus RESTEasy Reactive, keep the muzzle split across `io.quarkus:quarkus-resteasy-reactive:(,3.9.0)` and `io.quarkus:quarkus-rest:[3.9.0,)`; `3.9` is the artifact rename boundary, not the module's minimum supported version.
304+
- Use `quarkus-resteasy-reactive-1.11` because the artifact starts at `1.11.0` prereleases, the first final is `1.11.0.Final`, the javaagent compiles against `1.11.0.Final`, and the original muzzle range covered all versions of the old artifact.
305+
- Use `payara-5.2020` because `5.2020.2` is the earliest `5.2020.x` release, the javaagent builds against it, and it contains both `fish.payara.opentracing.OpenTracingService` and `org.apache.catalina.core.StandardWrapper`. Per the patch-floor rule above, use the minor line in the module/package name instead of `payara-5.2020.2`.
306+
- Use `tomcat-jdbc-8.5` because the javaagent compiles/tests against `org.apache.tomcat:tomcat-jdbc:8.5.0` and docs list support from `[8.5.0,)`.
307+
308+
Suggested verification:
309+
310+
```bash
311+
.github/scripts/check-package-names.sh
312+
./gradlew :instrumentation:payara-5.2020:javaagent:test :instrumentation:quarkus-resteasy-reactive-1.11:javaagent:test :instrumentation:tomcat:tomcat-jdbc-8.5:javaagent:test
313+
```
314+
192315
## Do Later
193316

194317
These are probably not the next easiest wins:
195318

196-
- `java-*` module skip: the current packages use names like `javahttpclient`, while the checker would expect `http.client` after eliding `java`. This touches 39 files and needs a naming decision.
319+
- `java-http-client` and `java-http-server`: these have published library/testing packages, so package renames need a dedicated public API decision instead of a package-only javaagent cleanup.
197320
- `jmx-metrics`: current packages are under `jmx`, while the module says `jmx-metrics`. This touches 43 files and may be user-facing enough to deserve a dedicated PR.
198321
- Library-specific third-party packages: `io.grpc.override`, `io.lettuce.core.protocol`, `io.nats.client.impl`, and `rx` are likely intentional shims or package-private access points.
199322
- Advice-native package exceptions: packages under `com.clickhouse`, `com.twitter`, `io.netty`, `reactor.netty`, `org.springframework`, and `io.vertx` should stay until each one is proven not to need native package placement.
200323
- OpenTelemetry API and Akka/Scala forkjoin package/module renames are planned above; AWS SDK remains deferred.
201-
- Other unversioned module allowlist entries: these need package/module naming decisions beyond a package-only cleanup.
324+
- Remaining unversioned module allowlist entries split into policy buckets:
325+
- JDK/platform modules such as `executors`, `http-url-connection`, `jdbc`, `methods`, `rmi`, and `runtime-telemetry` probably deserve explicit checker allowances instead of version suffixes.
326+
- `internal-*` modules such as `internal-class-loader`, `internal-lambda`, `internal-reflection`, and `internal-url-class-loader` probably deserve explicit checker allowances; version suffixes would be misleading.
327+
- `*-common` modules need case-by-case module naming review:
328+
- Apply #16090's convention: `<library>-common` is for pure utility/abstraction code with no direct library version dependency, `<library>-common-<major.minor>` is for shared code that requires a minimum library version, and `<library>-common-<variant>` is for variants such as `javax`.
329+
- `spring-webmvc-common` and the `spring-cloud-gateway-common` testing package decision are planned above as PRs 25-26. `jetty-common`, `tomcat-common`, and `opensearch-rest-common` were completed in PRs 23-24.
330+
- `jaxrs-common`: keep unversioned. The javaagent module has no direct JAX-RS API dependency and acts as cross-generation helper/bootstrap code used by JAX-RS 1.0, 2.0, 3.0, and Quarkus RESTEasy Reactive. Keep it separate from the already version-scoped `jaxrs-2.0-common`, `jaxrs-3.0-common`, `jaxrs-common-2.0`, and `jaxrs-common-3.0` modules.
331+
- `servlet-common`: keep unversioned. This matches #16090's pure abstraction/variant shape: shared code for both `javax.servlet` and `jakarta.servlet`, with `servlet-common-javax` as the variant-specific module. Because it includes published `library` packages, treat any future package changes as public API policy, not package-only cleanup.
332+
- App-server/framework module-name cleanups for `payara`, `quarkus-resteasy-reactive`, and `tomcat-jdbc` are planned above as PR 27.
333+
- Treat this as a checker-policy cleanup first: document legitimate unversioned javaagent module shapes, then only rename leftovers that are true module-name debt.
202334

203335
## Re-Audit Command
204336

0 commit comments

Comments
 (0)