Skip to content

Commit 6c7c433

Browse files
committed
Merge remote-tracking branch 'upstream/main' into remove-more-deprecated-props
# Conflicts: # instrumentation/vertx/vertx-http-client/vertx-http-client-3.0/metadata.yaml # instrumentation/vertx/vertx-http-client/vertx-http-client-4.0/metadata.yaml # instrumentation/vertx/vertx-http-client/vertx-http-client-5.0/metadata.yaml
2 parents 77ccfa9 + 3ceb290 commit 6c7c433

209 files changed

Lines changed: 1085 additions & 642 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.

.github/agents/knowledge/general-rules.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ Do not flag the following patterns (common false positives):
7676

7777
- FQCN is acceptable when class-name collision makes import impossible.
7878
- Do not claim that a Java non-capturing lambda or method reference allocates per
79-
call. On HotSpot / OpenJDK 8+, these are cached at the call site.
79+
call. On HotSpot / OpenJDK 8+, these are cached at the `invokedynamic` call site.
80+
Do not suggest hoisting such a lambda into a `private static final` field for
81+
allocation/performance reasons — it is pure noise. If a PR makes that hoist,
82+
flag it and recommend reverting to the in-line lambda.
8083

8184
## [Style] Visibility modifiers
8285

@@ -86,9 +89,17 @@ still allows the code to function correctly.
8689
**Exception — Single public class**: If a module has only one public class then don't change it to
8790
package-private. Javadoc task fails when module has no public classes.**
8891

89-
**Exception — Used from advice**: All classes and methods used from methods annotated with
90-
`@Advice.OnMethodEnter` or `@Advice.OnMethodExit` must be public. These methods are inlined into
91-
transformed classes and must be accessible from those classes, which may be in different packages.
92+
**Exception — Directly referenced from advice**: Classes and methods that are _directly_
93+
referenced from methods annotated with `@Advice.OnMethodEnter` or `@Advice.OnMethodExit` must be
94+
public, since the advice may be applied to classes in other packages.
95+
96+
This applies only to **direct** references in the advice methods, not transitive ones. Helpers
97+
reached only from inside another helper called by the advice (for example, a same-package
98+
`*Singletons` accessor invoked from inside `AdviceScope.start()`) can keep package-private
99+
visibility. A source-level `inline = false` on the advice annotation is not a reason to widen
100+
visibility — the agent forcibly overrides the `inline` attribute at runtime based on the
101+
configured indy mode, so the source value does not determine how the advice is dispatched.
102+
Reason about visibility from "what does the advice method directly reference?".
92103

93104
## [Style] `@SuppressWarnings` Usage
94105

instrumentation/rocketmq/rocketmq-client-5.0/javaagent/src/test/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientSuppressReceiveSpanTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import io.opentelemetry.sdk.trace.data.StatusData;
2828
import java.time.Duration;
2929
import org.apache.rocketmq.client.apis.ClientConfiguration;
30+
import org.apache.rocketmq.client.apis.ClientException;
3031
import org.apache.rocketmq.client.apis.ClientServiceProvider;
3132
import org.apache.rocketmq.client.apis.consumer.ConsumeResult;
3233
import org.apache.rocketmq.client.apis.consumer.FilterExpression;
@@ -58,7 +59,7 @@ static void tearDown() {
5859
}
5960

6061
@Test
61-
void testSendAndConsumeMessage() throws Throwable {
62+
void testSendAndConsumeMessage() throws ClientException {
6263
ClientConfiguration clientConfiguration =
6364
ClientConfiguration.newBuilder()
6465
.setEndpoints(CONTAINER.endpoints)
@@ -104,7 +105,8 @@ void testSendAndConsumeMessage() throws Throwable {
104105
SendReceipt sendReceipt =
105106
testing()
106107
.runWithSpan(
107-
"parent", (ThrowingSupplier<SendReceipt, Throwable>) () -> producer.send(message));
108+
"parent",
109+
(ThrowingSupplier<SendReceipt, ClientException>) () -> producer.send(message));
108110
testing()
109111
.waitAndAssertTraces(
110112
trace ->

instrumentation/rocketmq/rocketmq-client-5.0/javaagent/src/test/java/io/opentelemetry/instrumentation/rocketmqclient/v5_0/AbstractRocketMqClientTest.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void tearDown() throws IOException {
123123
}
124124

125125
@Test
126-
void testSendAndConsumeNormalMessage() throws Throwable {
126+
void testSendAndConsumeNormalMessage() throws ClientException {
127127
String[] keys = new String[] {"yourMessageKey-0", "yourMessageKey-1"};
128128
byte[] body = "foobar".getBytes(UTF_8);
129129
Message message =
@@ -138,7 +138,8 @@ void testSendAndConsumeNormalMessage() throws Throwable {
138138
SendReceipt sendReceipt =
139139
testing()
140140
.runWithSpan(
141-
"parent", (ThrowingSupplier<SendReceipt, Throwable>) () -> producer.send(message));
141+
"parent",
142+
(ThrowingSupplier<SendReceipt, ClientException>) () -> producer.send(message));
142143
AtomicReference<SpanData> sendSpanData = new AtomicReference<>();
143144
testing()
144145
.waitAndAssertSortedTraces(
@@ -173,7 +174,7 @@ void testSendAndConsumeNormalMessage() throws Throwable {
173174
}
174175

175176
@Test
176-
void testSendAsyncMessage() throws Exception {
177+
void testSendAsyncMessage() {
177178
String[] keys = new String[] {"yourMessageKey-0", "yourMessageKey-1"};
178179
byte[] body = "foobar".getBytes(UTF_8);
179180
Message message =
@@ -196,7 +197,7 @@ void testSendAsyncMessage() throws Exception {
196197
(result, throwable) -> {
197198
testing().runWithSpan("child", () -> {});
198199
})
199-
.get());
200+
.join());
200201
AtomicReference<SpanData> sendSpanData = new AtomicReference<>();
201202
testing()
202203
.waitAndAssertSortedTraces(
@@ -232,7 +233,7 @@ void testSendAsyncMessage() throws Exception {
232233
}
233234

234235
@Test
235-
void testSendAndConsumeFifoMessage() throws Throwable {
236+
void testSendAndConsumeFifoMessage() throws ClientException {
236237
String[] keys = new String[] {"yourMessageKey-0", "yourMessageKey-1"};
237238
byte[] body = "foobar".getBytes(UTF_8);
238239
String messageGroup = "yourMessageGroup";
@@ -249,7 +250,8 @@ void testSendAndConsumeFifoMessage() throws Throwable {
249250
SendReceipt sendReceipt =
250251
testing()
251252
.runWithSpan(
252-
"parent", (ThrowingSupplier<SendReceipt, Throwable>) () -> producer.send(message));
253+
"parent",
254+
(ThrowingSupplier<SendReceipt, ClientException>) () -> producer.send(message));
253255
AtomicReference<SpanData> sendSpanData = new AtomicReference<>();
254256
testing()
255257
.waitAndAssertSortedTraces(
@@ -286,7 +288,7 @@ void testSendAndConsumeFifoMessage() throws Throwable {
286288
}
287289

288290
@Test
289-
void testSendAndConsumeDelayMessage() throws Throwable {
291+
void testSendAndConsumeDelayMessage() throws ClientException {
290292
String[] keys = new String[] {"yourMessageKey-0", "yourMessageKey-1"};
291293
byte[] body = "foobar".getBytes(UTF_8);
292294
long deliveryTimestamp = System.currentTimeMillis();
@@ -303,7 +305,8 @@ void testSendAndConsumeDelayMessage() throws Throwable {
303305
SendReceipt sendReceipt =
304306
testing()
305307
.runWithSpan(
306-
"parent", (ThrowingSupplier<SendReceipt, Throwable>) () -> producer.send(message));
308+
"parent",
309+
(ThrowingSupplier<SendReceipt, ClientException>) () -> producer.send(message));
307310
AtomicReference<SpanData> sendSpanData = new AtomicReference<>();
308311
testing()
309312
.waitAndAssertSortedTraces(
@@ -340,7 +343,7 @@ void testSendAndConsumeDelayMessage() throws Throwable {
340343
}
341344

342345
@Test
343-
void testCapturedMessageHeaders() throws Throwable {
346+
void testCapturedMessageHeaders() throws ClientException {
344347
String[] keys = new String[] {"yourMessageKey-0", "yourMessageKey-1"};
345348
byte[] body = "foobar".getBytes(UTF_8);
346349
Message message =
@@ -356,7 +359,8 @@ void testCapturedMessageHeaders() throws Throwable {
356359
SendReceipt sendReceipt =
357360
testing()
358361
.runWithSpan(
359-
"parent", (ThrowingSupplier<SendReceipt, Throwable>) () -> producer.send(message));
362+
"parent",
363+
(ThrowingSupplier<SendReceipt, ClientException>) () -> producer.send(message));
360364
AtomicReference<SpanData> sendSpanData = new AtomicReference<>();
361365
testing()
362366
.waitAndAssertSortedTraces(

instrumentation/rocketmq/rocketmq-client-5.0/metadata.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ semantic_conventions:
77
library_link: https://rocketmq.apache.org/
88
configurations:
99
- name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled
10+
declarative_name: java.common.messaging.receive_telemetry/development.enabled
1011
description: >
1112
Enables experimental receive telemetry, which will cause consumers to start a new trace, with
1213
only a span link connecting it to the producer trace.
1314
type: boolean
1415
default: false
1516
- name: otel.instrumentation.messaging.experimental.capture-headers
17+
declarative_name: java.common.messaging.capture_headers/development
1618
description: >
1719
Enables capturing messaging headers as span attributes. Provide a comma-separated list of
1820
header names to capture.

instrumentation/runtime-telemetry/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/runtimetelemetry/JarDetails.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ String packageDescription() {
161161

162162
Attributes mainAttributes = manifest.getMainAttributes();
163163
String name = mainAttributes.getValue(Attributes.Name.IMPLEMENTATION_TITLE);
164-
String description = mainAttributes.getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
164+
String vendor = mainAttributes.getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
165165

166-
String packageDescription = name;
167-
if (description != null && !description.isEmpty()) {
168-
packageDescription += " by " + description;
166+
if (name == null || name.isEmpty()) {
167+
return vendor == null || vendor.isEmpty() ? null : vendor;
169168
}
170-
return packageDescription;
169+
if (vendor == null || vendor.isEmpty()) {
170+
return name;
171+
}
172+
return name + " by " + vendor;
171173
}
172174

173175
/** Returns the SHA1 hash of this file, e.g. {@code 30d16ec2aef6d8094c5e2dce1d95034ca8b6cb42}. */
@@ -181,7 +183,7 @@ private String computeDigest(MessageDigest md) throws IOException {
181183
byte[] buffer = new byte[8192];
182184
while (dis.read(buffer) != -1) {}
183185
byte[] digest = md.digest();
184-
return new BigInteger(1, digest).toString(16);
186+
return String.format(Locale.ROOT, "%040x", new BigInteger(1, digest));
185187
}
186188
}
187189

instrumentation/runtime-telemetry/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/runtimetelemetry/JarAnalyzerInstallerTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ void jarAnalyzerEnabled() {
4848
.containsEntry("package.type", "jar")
4949
.containsEntry("package.checksum_algorithm", "SHA1")
5050
.hasEntrySatisfying(
51-
stringKey("package.checksum"), value -> assertThat(value).isNotNull())
51+
stringKey("package.checksum"),
52+
value -> assertThat(value).matches("[0-9a-f]{40}"))
5253
.hasEntrySatisfying(
5354
stringKey("package.path"), value -> assertThat(value).isNotNull())
5455
.satisfies(

instrumentation/runtime-telemetry/testing/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ dependencies {
1111

1212
// Bring in various archives to test introspection logic
1313
testImplementation("io.opentelemetry:opentelemetry-api")
14-
testImplementation("io.opentelemetry:opentelemetry-api-incubator")
1514
testImplementation("org.springframework:spring-webmvc:3.1.0.RELEASE")
1615
testImplementation("com.google.guava:guava")
1716
}

instrumentation/rxjava/rxjava-2.0/library/src/main/java/io/opentelemetry/instrumentation/rxjava/v2_0/TracingObserver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private static Field getQueueDisposableField() {
111111
return queueDisposableField;
112112
}
113113

114-
public static boolean canEnable() {
114+
static boolean canEnable() {
115115
return queueDisposableField != null;
116116
}
117117
}

instrumentation/rxjava/rxjava-2.0/library/src/test/java/io/opentelemetry/instrumentation/rxjava/v2_0/RxJava2AsyncOperationEndStrategyTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
class RxJava2AsyncOperationEndStrategyTest {
4646
private static final AttributeKey<Boolean> CANCELED_ATTRIBUTE_KEY =
4747
AttributeKey.booleanKey("rxjava.canceled");
48-
@Mock Instrumenter<String, String> instrumenter;
49-
@Mock Span span;
48+
@Mock private Instrumenter<String, String> instrumenter;
49+
@Mock private Span span;
5050
private final AsyncOperationEndStrategy underTest = RxJava2AsyncOperationEndStrategy.create();
5151
private final RxJava2AsyncOperationEndStrategy underTestWithExperimentalAttributes =
5252
RxJava2AsyncOperationEndStrategy.builder().setCaptureExperimentalSpanAttributes(true).build();

instrumentation/rxjava/rxjava-2.0/library/src/test/java/io/opentelemetry/instrumentation/rxjava/v2_0/RxJava2SubscriptionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
class RxJava2SubscriptionTest extends AbstractRxJava2SubscriptionTest {
1414
@RegisterExtension
15-
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();
15+
private static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();
1616

17-
static final TracingAssembly tracingAssembly = TracingAssembly.create();
17+
private static final TracingAssembly tracingAssembly = TracingAssembly.create();
1818

1919
@Override
2020
protected InstrumentationExtension testing() {

0 commit comments

Comments
 (0)