Skip to content

Commit 5ef2fa1

Browse files
Copilottrask
andauthored
Rename JAX-WS 2.0 javaagent modules to spec-scoped names and hierarchical packages (#18184)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: trask <218610+trask@users.noreply.github.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
1 parent e642071 commit 5ef2fa1

41 files changed

Lines changed: 348 additions & 106 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.fossa.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,16 +564,16 @@ targets:
564564
target: ':instrumentation:jaxws:jaxws-2.0-axis2-1.6:javaagent'
565565
- type: gradle
566566
path: ./
567-
target: ':instrumentation:jaxws:jaxws-common:javaagent'
567+
target: ':instrumentation:jaxws:jaxws-2.0-cxf-3.0:javaagent'
568568
- type: gradle
569569
path: ./
570-
target: ':instrumentation:jaxws:jaxws-cxf-3.0:javaagent'
570+
target: ':instrumentation:jaxws:jaxws-2.0-metro-2.2:javaagent'
571571
- type: gradle
572572
path: ./
573-
target: ':instrumentation:jaxws:jaxws-jws-api-1.1:javaagent'
573+
target: ':instrumentation:jaxws:jaxws-common:javaagent'
574574
- type: gradle
575575
path: ./
576-
target: ':instrumentation:jaxws:jaxws-metro-2.2:javaagent'
576+
target: ':instrumentation:jaxws:jaxws-jws-api-1.1:javaagent'
577577
- type: gradle
578578
path: ./
579579
target: ':instrumentation:jboss-logmanager:jboss-logmanager-appender-1.1:javaagent'

.github/agents/knowledge/api-deprecation-policy.md

Lines changed: 125 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,23 @@
22

33
## Quick Reference
44

5-
- Use when: reviewing public API removals/renames, `@Deprecated` usage, stable-vs-alpha compatibility
6-
- Review focus: deprecate-then-remove timing, delegation direction, required Javadoc/CHANGELOG coverage
5+
- Use when: reviewing public API removals/renames, `@Deprecated` usage, stable-vs-alpha compatibility, or any module rename that touches user-facing config keys or emitted telemetry identity
6+
- Review focus: deprecate-then-remove timing, delegation direction, required Javadoc/CHANGELOG coverage, v3-preview gating for config keys and scope names
7+
8+
## What Counts as "Public API"
9+
10+
"API" here means **anything a user's code or configuration depends on by name**, including:
11+
12+
- Java symbols in published artifacts (classes, methods, fields in `:library`, `:testing`,
13+
`instrumentation-api*`).
14+
- User-facing configuration keys — `otel.instrumentation.<name>.enabled`, any
15+
`otel.instrumentation.*` property, and the equivalent declarative YAML keys.
16+
- Outgoing telemetry identity — anything users can match on in their backend, including
17+
`otel.scope.name`, span names, metric names, attribute keys, and attribute values. Users
18+
build dashboards, filters, and alerts on these values, so silently renaming them is a
19+
breaking change.
20+
21+
A rename of any of these surfaces is a breaking change even if no Java symbol moved.
722

823
## When Are Breaking Changes Allowed?
924

@@ -75,6 +90,107 @@ default void configure(IgnoredTypesBuilder builder, ConfigProperties config) {
7590
}
7691
```
7792

93+
## Module renames: config keys and emitted scope names
94+
95+
A module rename touches **two user-facing API surfaces** that must each be preserved by default
96+
and only change under `otel.instrumentation.common.v3-preview`. The mechanism differs because
97+
the surfaces are different: config keys can coexist as aliases, emitted scope names cannot.
98+
99+
### 1. `InstrumentationModule` names (controls `otel.instrumentation.<name>.enabled`)
100+
101+
The names passed to the `InstrumentationModule` constructor drive the
102+
`otel.instrumentation.<name>.enabled` config keys — any of them, not just the first. A rename
103+
silently breaks users who have the old key in their config.
104+
105+
Keep the pre-rename name by passing it inline alongside the current name using the
106+
{@code "<current>|deprecated:<old>"} marker recognized by the `InstrumentationModule`
107+
constructor:
108+
109+
```java
110+
public CxfInstrumentationModule() {
111+
super("cxf", "jaxws-2.0-cxf-3.0|deprecated:jaxws-cxf-3.0", "jaxws");
112+
}
113+
```
114+
115+
The framework (`DeprecatedInstrumentationNames.expand`) splits the marker and registers both
116+
names, so both `otel.instrumentation.jaxws-2.0-cxf-3.0.enabled` and
117+
`otel.instrumentation.jaxws-cxf-3.0.enabled` keep working (flat properties and YAML alike).
118+
Under `otel.instrumentation.common.v3-preview=true` the deprecated name is dropped; if the
119+
legacy key is explicitly set, a one-time WARNING is logged pointing at the new key.
120+
121+
No per-module `AgentCommonConfig` branching, `isV3Preview()` checks, or bespoke logging are
122+
needed — one string literal is the entire change.
123+
124+
### 2. Emitted instrumentation scope name (`INSTRUMENTATION_NAME` in `*Singletons`)
125+
126+
The `INSTRUMENTATION_NAME` string passed to `Instrumenter.builder(...)` becomes the
127+
`otel.scope.name` attribute on every emitted span / metric / log. A rename silently breaks
128+
dashboards and filters that match on the old scope.
129+
130+
Keep emitting the **pre-rename** scope name by default, and switch to the new one only under
131+
v3-preview:
132+
133+
```java
134+
public class CxfSingletons {
135+
private static final String INSTRUMENTATION_NAME =
136+
AgentCommonConfig.get().isV3Preview()
137+
? "io.opentelemetry.jaxws-2.0-cxf-3.0"
138+
// keep the pre-rename scope name so existing dashboards/filters on
139+
// otel.scope.name="io.opentelemetry.jaxws-cxf-3.0" continue to work
140+
: "io.opentelemetry.jaxws-cxf-3.0";
141+
...
142+
}
143+
```
144+
145+
Note the asymmetry with the config-key case: there the list carries **both** names at once
146+
(aliases); here only **one** scope name is emitted at a time, and the default is the **old**
147+
one. Do not log a deprecation warning here — users cannot switch the scope name without
148+
enabling v3-preview globally (which affects every module), so a warning would push them
149+
toward something they are not expected to enable generally.
150+
151+
Emitting the old scope name by default has one consequence: the version `.properties` file
152+
generated by `generateInstrumentationVersionFile` is named after the **new** module name
153+
(e.g. `io.opentelemetry.jaxws-2.0-cxf-3.0.properties`), and `Instrumenter.builder` looks the
154+
version up via `EmbeddedInstrumentationProperties.findVersion(instrumentationName)` keyed on
155+
the scope name passed in. With the old name as the default the lookup returns `null`, the
156+
emitted scope has no version, and `TelemetryDataUtil.assertScopeVersion` fails every test in
157+
CI with:
158+
159+
> Instrumentation version of module `io.opentelemetry.<old>` was empty; make sure that the
160+
> instrumentation name matches the gradle module name
161+
162+
Resolve this by looking up the version under the **new** module name and calling
163+
`setInstrumentationVersion` on the builder explicitly:
164+
165+
```java
166+
private static final String VERSION_LOOKUP_NAME = "io.opentelemetry.jaxws-2.0-cxf-3.0";
167+
168+
private static final String INSTRUMENTATION_NAME =
169+
AgentCommonConfig.get().isV3Preview() ? VERSION_LOOKUP_NAME : "io.opentelemetry.jaxws-cxf-3.0";
170+
171+
static {
172+
InstrumenterBuilder<CxfRequest, Void> builder =
173+
Instrumenter.<CxfRequest, Void>builder(
174+
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, CxfRequest::spanName)
175+
.setEnabled(...);
176+
String version = EmbeddedInstrumentationProperties.findVersion(VERSION_LOOKUP_NAME);
177+
if (version != null) {
178+
builder.setInstrumentationVersion(version);
179+
}
180+
instrumenter = builder.buildInstrumenter();
181+
}
182+
```
183+
184+
### CHANGELOG
185+
186+
The rename is **not** a breaking change or a deprecation in the current release: by default
187+
the old config keys and scope names continue to work unchanged, and the new names are only
188+
visible under `otel.instrumentation.common.v3-preview` — a preview flag that users are not
189+
generally encouraged to enable. Do not add a `⚠️ Breaking changes to non-stable APIs` or
190+
`🚫 Deprecations` entry for this kind of rename. If mentioned at all, it belongs in whatever
191+
section tracks v3-preview changes. The breaking change will be recorded when v3-preview
192+
becomes the default in 3.0.
193+
78194
## What to Flag in Review
79195

80196
- **Breaking change without a prior deprecation**: a method/class was removed or its signature
@@ -98,3 +214,10 @@ default void configure(IgnoredTypesBuilder builder, ConfigProperties config) {
98214

99215
- **Missing CHANGELOG entry**: a breaking change PR that does not add an
100216
`⚠️ Breaking changes to non-stable APIs` bullet in the `Unreleased` section of `CHANGELOG.md`.
217+
218+
- **Module rename without backcompat**: `InstrumentationModule` constructor uses only the new
219+
name, dropping the pre-rename name that drove the legacy
220+
`otel.instrumentation.<old>.enabled` config key (it should be appended to the new name with
221+
the {@code "|deprecated:<old>"} marker so `DeprecatedInstrumentationNames` can gate it on
222+
v3-preview); and/or `*Singletons#INSTRUMENTATION_NAME` was changed unconditionally instead
223+
of being gated on `AgentCommonConfig.get().isV3Preview()`.

.github/scripts/instrumentations.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ readonly INSTRUMENTATIONS=(
140140
"jaxrs:jaxrs-3.0:jaxrs-3.0-resteasy-6.0:javaagent:testExperimental"
141141
"jaxws:jaxws-2.0:javaagent:test"
142142
"jaxws:jaxws-2.0-axis2-1.6:javaagent:test"
143-
"jaxws:jaxws-cxf-3.0:javaagent:test"
143+
"jaxws:jaxws-2.0-cxf-3.0:javaagent:test"
144144
"jaxws:jaxws-jws-api-1.1:javaagent:test"
145-
"jaxws:jaxws-metro-2.2:javaagent:test"
145+
"jaxws:jaxws-2.0-metro-2.2:javaagent:test"
146146
"jdbc:javaagent:test"
147147
"jdbc:javaagent:testStableSemconv"
148148
"jedis:jedis-1.4:javaagent:test"

docs/instrumentation-list.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6801,17 +6801,17 @@ libraries:
68016801
spans:
68026802
- span_kind: INTERNAL
68036803
attributes: []
6804-
- name: jaxws-cxf-3.0
6804+
- name: jaxws-2.0-cxf-3.0
68056805
display_name: Apache CXF 3.x JAX-WS
68066806
description: |
68076807
This instrumentation enriches HTTP server spans with route information, and enables controller spans for Apache CXF JAX-WS web services (controller spans are disabled by default).
68086808
library_link: https://cxf.apache.org/
68096809
features:
68106810
- HTTP_ROUTE
68116811
- CONTROLLER_SPANS
6812-
source_path: instrumentation/jaxws/jaxws-cxf-3.0
6812+
source_path: instrumentation/jaxws/jaxws-2.0-cxf-3.0
68136813
scope:
6814-
name: io.opentelemetry.jaxws-cxf-3.0
6814+
name: io.opentelemetry.jaxws-2.0-cxf-3.0
68156815
has_javaagent: true
68166816
javaagent_target_versions:
68176817
- org.apache.cxf:cxf-rt-frontend-jaxws:[3.0.0,)
@@ -6855,17 +6855,17 @@ libraries:
68556855
type: STRING
68566856
- name: code.namespace
68576857
type: STRING
6858-
- name: jaxws-metro-2.2
6858+
- name: jaxws-2.0-metro-2.2
68596859
display_name: Metro JAX-WS
68606860
description: |
68616861
This instrumentation enriches HTTP server spans with route information, and enables controller spans for Metro JAX-WS web services (controller spans are disabled by default).
68626862
library_link: https://javaee.github.io/metro/
68636863
features:
68646864
- HTTP_ROUTE
68656865
- CONTROLLER_SPANS
6866-
source_path: instrumentation/jaxws/jaxws-metro-2.2
6866+
source_path: instrumentation/jaxws/jaxws-2.0-metro-2.2
68676867
scope:
6868-
name: io.opentelemetry.jaxws-metro-2.2
6868+
name: io.opentelemetry.jaxws-2.0-metro-2.2
68696869
has_javaagent: true
68706870
javaagent_target_versions:
68716871
- com.sun.xml.ws:jaxws-rt:[2.2,)

instrumentation/jaxws/jaxws-cxf-3.0/javaagent-unit-tests/build.gradle.kts renamed to instrumentation/jaxws/jaxws-2.0-cxf-3.0/javaagent-unit-tests/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
dependencies {
6-
testImplementation(project(":instrumentation:jaxws:jaxws-cxf-3.0:javaagent"))
6+
testImplementation(project(":instrumentation:jaxws:jaxws-2.0-cxf-3.0:javaagent"))
77

88
testImplementation("org.apache.cxf:cxf-rt-frontend-jaxws:3.0.0")
99
}

instrumentation/jaxws/jaxws-cxf-3.0/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/cxf/TracingStartInInterceptorTest.java renamed to instrumentation/jaxws/jaxws-2.0-cxf-3.0/javaagent-unit-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/jaxws/v2_0/cxf/v3_0/TracingStartInInterceptorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
package io.opentelemetry.javaagent.instrumentation.cxf;
6+
package io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.cxf.v3_0;
77

88
import static org.assertj.core.api.Assertions.assertThat;
99

instrumentation/jaxws/jaxws-cxf-3.0/javaagent/build.gradle.kts renamed to instrumentation/jaxws/jaxws-2.0-cxf-3.0/javaagent/build.gradle.kts

File renamed without changes.

instrumentation/jaxws/jaxws-cxf-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfHelper.java renamed to instrumentation/jaxws/jaxws-2.0-cxf-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/v2_0/cxf/v3_0/CxfHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
package io.opentelemetry.javaagent.instrumentation.cxf;
6+
package io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.cxf.v3_0;
77

8-
import static io.opentelemetry.javaagent.instrumentation.cxf.CxfSingletons.instrumenter;
8+
import static io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.cxf.v3_0.CxfSingletons.instrumenter;
99

1010
import io.opentelemetry.context.Context;
1111
import io.opentelemetry.context.Scope;

instrumentation/jaxws/jaxws-cxf-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfInstrumentationModule.java renamed to instrumentation/jaxws/jaxws-2.0-cxf-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/v2_0/cxf/v3_0/CxfInstrumentationModule.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
package io.opentelemetry.javaagent.instrumentation.cxf;
6+
package io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.cxf.v3_0;
77

8+
import static io.opentelemetry.javaagent.extension.instrumentation.internal.DeprecatedInstrumentationNames.expandDeprecatedNames;
89
import static java.util.Collections.singletonList;
910

1011
import com.google.auto.service.AutoService;
@@ -15,7 +16,7 @@
1516
@AutoService(InstrumentationModule.class)
1617
public class CxfInstrumentationModule extends InstrumentationModule {
1718
public CxfInstrumentationModule() {
18-
super("cxf", "cxf-3.0", "jaxws");
19+
super("cxf", expandDeprecatedNames("jaxws-2.0-cxf-3.0|deprecated:jaxws-cxf-3.0", "jaxws"));
1920
}
2021

2122
@Override

instrumentation/jaxws/jaxws-cxf-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfRequest.java renamed to instrumentation/jaxws/jaxws-2.0-cxf-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/v2_0/cxf/v3_0/CxfRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
package io.opentelemetry.javaagent.instrumentation.cxf;
6+
package io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.cxf.v3_0;
77

88
import org.apache.cxf.message.Exchange;
99
import org.apache.cxf.message.Message;

0 commit comments

Comments
 (0)