Skip to content

Commit 420b420

Browse files
committed
Activate messaging v1.43 in v3 preview
1 parent bfef90a commit 420b420

23 files changed

Lines changed: 106 additions & 51 deletions

File tree

CHANGELOG.md

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

33
## Unreleased
44

5+
### 🚫 Deprecations
6+
7+
- Deprecate `MessageOperation` in favor of `MessagingOperationType`.
8+
([#19276](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/19276))
9+
510
## Version 2.30.0 (2026-07-21)
611

712
This release targets the OpenTelemetry SDK 1.64.0.

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessageOperation.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55

66
package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;
77

8-
/** Represents an operation that may be used in a messaging system. */
8+
/**
9+
* Represents an operation that may be used in a messaging system.
10+
*
11+
* @deprecated Use {@link MessagingOperationType}. Will be removed in 3.0.
12+
*/
13+
@Deprecated // to be removed in 3.0
914
public enum MessageOperation {
1015
PUBLISH(MessagingOperationType.SEND),
1116
RECEIVE(MessagingOperationType.RECEIVE),

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingAttributesExtractor.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> createF
7272
return builderForOperationType(getter, operationType).build();
7373
}
7474

75-
/** Creates the messaging attributes extractor for the given operation. */
75+
/**
76+
* @deprecated Use {@link #createForOperationType(MessagingAttributesGetter,
77+
* MessagingOperationType)}. Will be removed in 3.0.
78+
*/
79+
@Deprecated // to be removed in 3.0
7680
public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> create(
7781
MessagingAttributesGetter<REQUEST, RESPONSE> getter, @Nullable MessageOperation operation) {
7882
return builder(getter, operation).build();
@@ -89,7 +93,11 @@ MessagingAttributesExtractorBuilder<REQUEST, RESPONSE> builderForOperationType(
8993
return new MessagingAttributesExtractorBuilder<>(getter, operationType, true);
9094
}
9195

92-
/** Returns a new messaging attributes extractor builder for the given operation. */
96+
/**
97+
* @deprecated Use {@link #builderForOperationType(MessagingAttributesGetter,
98+
* MessagingOperationType)}. Will be removed in 3.0.
99+
*/
100+
@Deprecated // to be removed in 3.0
93101
public static <REQUEST, RESPONSE> MessagingAttributesExtractorBuilder<REQUEST, RESPONSE> builder(
94102
MessagingAttributesGetter<REQUEST, RESPONSE> getter, @Nullable MessageOperation operation) {
95103
return new MessagingAttributesExtractorBuilder<>(

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingSpanKindExtractor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ public static <REQUEST> SpanKindExtractor<REQUEST> create(
5959
return request -> result;
6060
}
6161

62-
/** Returns a span kind extractor for the given operation. */
62+
/**
63+
* @deprecated Use {@link #create(MessagingOperationType)}. Will be removed in 3.0.
64+
*/
65+
@Deprecated // to be removed in 3.0
6366
public static <REQUEST> SpanKindExtractor<REQUEST> create(MessageOperation operation) {
6467
SpanKind spanKind;
6568
switch (operation) {

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingSpanNameExtractor.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ public final class MessagingSpanNameExtractor<REQUEST> implements SpanNameExtrac
2020
* name>}.
2121
* @see MessagingOperationType used to extract {@code <operation name>}.
2222
*/
23-
public static <REQUEST> SpanNameExtractor<REQUEST> create(
23+
public static <REQUEST> SpanNameExtractor<REQUEST> createForOperationType(
2424
MessagingAttributesGetter<REQUEST, ?> getter, MessagingOperationType operationType) {
25-
return builder(getter, operationType).build();
25+
return builderForOperationType(getter, operationType).build();
2626
}
2727

28-
/** Returns a messaging span name extractor for the given operation. */
28+
/**
29+
* @deprecated Use {@link #createForOperationType(MessagingAttributesGetter,
30+
* MessagingOperationType)}. Will be removed in 3.0.
31+
*/
32+
@Deprecated // to be removed in 3.0
2933
public static <REQUEST> SpanNameExtractor<REQUEST> create(
3034
MessagingAttributesGetter<REQUEST, ?> getter, MessageOperation operation) {
3135
return builder(getter, operation).build();
@@ -35,12 +39,16 @@ public static <REQUEST> SpanNameExtractor<REQUEST> create(
3539
* Returns a new {@link MessagingSpanNameExtractorBuilder} that can be used to configure the
3640
* messaging span name extractor.
3741
*/
38-
public static <REQUEST> MessagingSpanNameExtractorBuilder<REQUEST> builder(
42+
public static <REQUEST> MessagingSpanNameExtractorBuilder<REQUEST> builderForOperationType(
3943
MessagingAttributesGetter<REQUEST, ?> getter, MessagingOperationType operationType) {
4044
return new MessagingSpanNameExtractorBuilder<>(getter, operationType, true);
4145
}
4246

43-
/** Returns a messaging span name extractor builder for the given operation. */
47+
/**
48+
* @deprecated Use {@link #builderForOperationType(MessagingAttributesGetter,
49+
* MessagingOperationType)}. Will be removed in 3.0.
50+
*/
51+
@Deprecated // to be removed in 3.0
4452
public static <REQUEST> MessagingSpanNameExtractorBuilder<REQUEST> builder(
4553
MessagingAttributesGetter<REQUEST, ?> getter, MessageOperation operation) {
4654
return new MessagingSpanNameExtractorBuilder<>(getter, operation.type(), false);

instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingAttributesExtractorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ void shouldExtractErrorTypeFromResponse() {
263263
assertThat(attributes.build()).isEqualTo(expected);
264264
}
265265

266+
@SuppressWarnings("OtelDeprecatedApiUsage")
266267
@Test
267268
void shouldExtractNoAttributesIfNoneAreAvailable() {
268269
// given

instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingSpanKindExtractorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void sendDefaultsToPropagatedSpanContext() {
4040
assertThat(spanKind).isEqualTo(SpanKind.PRODUCER);
4141
}
4242

43+
@SuppressWarnings("OtelDeprecatedApiUsage")
4344
@Test
4445
void messageOperationUsesLegacySpanKind() {
4546
SpanKind receiveKind =

instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingSpanNameExtractorTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class MessagingSpanNameExtractorTest {
2828

2929
@Mock MessagingAttributesGetter<Message, Void> getter;
3030

31+
@SuppressWarnings("OtelDeprecatedApiUsage")
3132
@Test
3233
void shouldKeepLegacyNameForMessageOperation() {
3334
Message message = new Message();
@@ -40,6 +41,7 @@ void shouldKeepLegacyNameForMessageOperation() {
4041
assertThat(underTest.extract(message)).isEqualTo("destination publish");
4142
}
4243

44+
@SuppressWarnings("OtelDeprecatedApiUsage")
4345
@Test
4446
void shouldRejectOperationNameForMessageOperation() {
4547
assertThatThrownBy(
@@ -50,6 +52,15 @@ void shouldRejectOperationNameForMessageOperation() {
5052
.hasMessage("Operation name is not configurable for legacy builders");
5153
}
5254

55+
@SuppressWarnings("OtelDeprecatedApiUsage")
56+
@Test
57+
void shouldKeepNullLiteralCallsSourceCompatible() {
58+
assertThatThrownBy(() -> MessagingSpanNameExtractor.create(getter, null))
59+
.isInstanceOf(NullPointerException.class);
60+
assertThatThrownBy(() -> MessagingSpanNameExtractor.builder(getter, null))
61+
.isInstanceOf(NullPointerException.class);
62+
}
63+
5364
@ParameterizedTest
5465
@MethodSource("spanNameParams")
5566
void shouldExtractSpanName(
@@ -83,7 +94,7 @@ void shouldExtractSpanName(
8394
}
8495

8596
SpanNameExtractor<Message> underTest =
86-
MessagingSpanNameExtractor.builder(getter, operationType)
97+
MessagingSpanNameExtractor.builderForOperationType(getter, operationType)
8798
.setOperationName(operationName)
8899
.build();
89100

instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/SemconvSelectionResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ SemconvMode rpc() {
8989
}
9090

9191
SemconvMode messaging() {
92-
return resolveSemconvSelection(
92+
SemconvDomain.Builder domain =
9393
SemconvDomain.builder("messaging")
94-
.defaultMode(SemconvMode.V0_STABLE)
9594
.otherSupportedModes(
96-
SemconvMode.V1_EXPERIMENTAL, SemconvMode.V1_EXPERIMENTAL.withDualEmit())
97-
.build());
95+
SemconvMode.V1_EXPERIMENTAL, SemconvMode.V1_EXPERIMENTAL.withDualEmit());
96+
domain.defaultMode(v3Preview ? SemconvMode.V1_EXPERIMENTAL : SemconvMode.V0_STABLE);
97+
return resolveSemconvSelection(domain.build());
9898
}
9999

100100
SemconvMode servicePeer() {

instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/internal/SemconvStabilityTest.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void v3PreviewIgnoresStableOptInForPreviewDomains() {
356356

357357
assertThat(rpc).isEqualTo(SemconvMode.V0_STABLE);
358358
assertThat(servicePeer).isEqualTo(SemconvMode.V0_STABLE);
359-
assertThat(messaging).isEqualTo(SemconvMode.V0_STABLE);
359+
assertThat(messaging).isEqualTo(SemconvMode.V1_EXPERIMENTAL);
360360
}
361361

362362
@ParameterizedTest
@@ -420,29 +420,35 @@ private static List<Arguments> messagingSelectionModes() {
420420
preview("messaging/dup"),
421421
SemconvMode.V1_EXPERIMENTAL.withDualEmit()),
422422
argumentSet(
423-
"v3 activation remains staged",
423+
"v3 activates messaging preview",
424424
true,
425425
noStableOptIn(),
426426
noPreview(),
427-
SemconvMode.V0_STABLE),
427+
SemconvMode.V1_EXPERIMENTAL),
428428
argumentSet(
429429
"v3 ignores legacy opt-in property",
430430
true,
431431
stableOptIn("messaging"),
432432
noPreview(),
433-
SemconvMode.V0_STABLE),
433+
SemconvMode.V1_EXPERIMENTAL),
434434
argumentSet(
435435
"v3 ignores legacy opt-in dual emit",
436436
true,
437437
stableOptIn("messaging/dup"),
438438
noPreview(),
439-
SemconvMode.V0_STABLE),
439+
SemconvMode.V1_EXPERIMENTAL),
440440
argumentSet(
441441
"v3 with explicit preview",
442442
true,
443443
noStableOptIn(),
444444
preview("messaging"),
445-
SemconvMode.V1_EXPERIMENTAL));
445+
SemconvMode.V1_EXPERIMENTAL),
446+
argumentSet(
447+
"v3 with explicit preview dual emit",
448+
true,
449+
noStableOptIn(),
450+
preview("messaging/dup"),
451+
SemconvMode.V1_EXPERIMENTAL.withDualEmit()));
446452
}
447453

448454
@SafeVarargs

0 commit comments

Comments
 (0)