Skip to content

Commit 451258d

Browse files
authored
Merge branch 'main' into delete-flaky-test-reporter
2 parents de04fbf + d780054 commit 451258d

9 files changed

Lines changed: 32 additions & 35 deletions

File tree

instrumentation/hikaricp-3.0/testing/src/main/java/io/opentelemetry/instrumentation/hikaricp/AbstractHikariInstrumentationTest.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@
3434
@ExtendWith(MockitoExtension.class)
3535
public abstract class AbstractHikariInstrumentationTest {
3636

37-
@RegisterExtension static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
37+
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.hikaricp-3.0";
3838

39-
@Mock DataSource dataSourceMock;
40-
@Mock Connection connectionMock;
41-
@Mock IMetricsTracker userMetricsMock;
39+
@RegisterExtension
40+
private static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
41+
42+
@Mock private DataSource dataSourceMock;
43+
@Mock private Connection connectionMock;
44+
@Mock private IMetricsTracker userMetricsMock;
4245

4346
protected abstract InstrumentationExtension testing();
4447

@@ -60,7 +63,7 @@ void shouldReportMetrics() throws SQLException, InterruptedException {
6063
hikariConnection.close();
6164

6265
// then
63-
DbConnectionPoolMetricsAssertions.create(testing(), "io.opentelemetry.hikaricp-3.0", "testPool")
66+
DbConnectionPoolMetricsAssertions.create(testing(), INSTRUMENTATION_NAME, "testPool")
6467
.disableMaxIdleConnections()
6568
// no timeouts happen during this test
6669
.disableConnectionTimeouts()
@@ -77,24 +80,22 @@ void shouldReportMetrics() throws SQLException, InterruptedException {
7780
// then
7881
testing()
7982
.waitAndAssertMetrics(
80-
"io.opentelemetry.hikaricp-3.0",
83+
INSTRUMENTATION_NAME,
8184
emitStableDatabaseSemconv()
8285
? "db.client.connection.count"
8386
: "db.client.connections.usage",
8487
AbstractIterableAssert::isEmpty);
8588
testing()
8689
.waitAndAssertMetrics(
87-
"io.opentelemetry.hikaricp-3.0",
90+
INSTRUMENTATION_NAME,
8891
"db.client.connections.idle.min",
8992
AbstractIterableAssert::isEmpty);
9093
testing()
9194
.waitAndAssertMetrics(
92-
"io.opentelemetry.hikaricp-3.0",
93-
"db.client.connections.max",
94-
AbstractIterableAssert::isEmpty);
95+
INSTRUMENTATION_NAME, "db.client.connections.max", AbstractIterableAssert::isEmpty);
9596
testing()
9697
.waitAndAssertMetrics(
97-
"io.opentelemetry.hikaricp-3.0",
98+
INSTRUMENTATION_NAME,
9899
"db.client.connections.pending_requests",
99100
AbstractIterableAssert::isEmpty);
100101
}
@@ -118,8 +119,7 @@ void shouldNotBreakCustomUserMetrics() throws SQLException, InterruptedException
118119
hikariConnection.close();
119120

120121
// then
121-
DbConnectionPoolMetricsAssertions.create(
122-
testing(), "io.opentelemetry.hikaricp-3.0", "anotherTestPool")
122+
DbConnectionPoolMetricsAssertions.create(testing(), INSTRUMENTATION_NAME, "anotherTestPool")
123123
.disableMaxIdleConnections()
124124
// no timeouts happen during this test
125125
.disableConnectionTimeouts()
@@ -156,8 +156,7 @@ void shouldReportTimeouts() throws SQLException {
156156
// then
157157
assertThat(thrown).isNotNull();
158158

159-
DbConnectionPoolMetricsAssertions.create(
160-
testing(), "io.opentelemetry.hikaricp-3.0", "timingOutPool")
159+
DbConnectionPoolMetricsAssertions.create(testing(), INSTRUMENTATION_NAME, "timingOutPool")
161160
.disableMaxIdleConnections()
162161
// the connection is not even acquired
163162
.disableUseTime()

instrumentation/hystrix-1.4/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: This instrumentation enables spans for Hystrix command executions a
33
library_link: https://github.com/Netflix/Hystrix
44
configurations:
55
- name: otel.instrumentation.hystrix.experimental-span-attributes
6+
declarative_name: java.hystrix.experimental_span_attributes/development
67
description: Enables capturing the experimental `hystrix.command`, `hystrix.circuit_open` and `hystrix.group` span attributes.
78
type: boolean
89
default: false
9-

instrumentation/iceberg-1.8/library/src/main/java/io/opentelemetry/instrumentation/iceberg/v1_8/IcebergMetricsReporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void report(MetricsReport report) {
8585
}
8686
}
8787

88-
void reportScanMetrics(ScanReport scanReport) {
88+
private void reportScanMetrics(ScanReport scanReport) {
8989
Attributes scanAttributes =
9090
Attributes.of(
9191
SCHEMA_ID,

instrumentation/iceberg-1.8/testing/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ plugins {
44

55
dependencies {
66
implementation("org.apache.iceberg:iceberg-core:1.8.1")
7-
// The following dependency allows us to use the following Iceberg test classes TestTables and TestTable
8-
// which are not published by default
7+
// The following dependency allows use of Iceberg test classes such as TestTables,
8+
// which are not published by default.
99
implementation("org.apache.iceberg:iceberg-core:1.8.1") {
1010
artifact {
1111
classifier = "tests"

instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbImplInstrumentation.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import io.opentelemetry.javaagent.bootstrap.CallDepth;
1818
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
1919
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
20+
import javax.annotation.Nullable;
2021
import net.bytebuddy.asm.Advice;
2122
import net.bytebuddy.description.type.TypeDescription;
2223
import net.bytebuddy.implementation.bytecode.assign.Assigner;
@@ -102,7 +103,7 @@ public static Object[] onEnter(
102103

103104
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false)
104105
public static void onExit(
105-
@Advice.Thrown Throwable throwable, @Advice.Enter Object[] enterArgs) {
106+
@Advice.Thrown @Nullable Throwable throwable, @Advice.Enter @Nullable Object[] enterArgs) {
106107
CallDepth callDepth = CallDepth.forClass(InfluxDBImpl.class);
107108
if (callDepth.decrementAndGet() > 0 || enterArgs == null) {
108109
return;
@@ -159,7 +160,7 @@ public static InfluxDbScope onEnter(
159160

160161
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false)
161162
public static void onExit(
162-
@Advice.Thrown Throwable throwable, @Advice.Enter InfluxDbScope scope) {
163+
@Advice.Thrown @Nullable Throwable throwable, @Advice.Enter @Nullable InfluxDbScope scope) {
163164
CallDepth callDepth = CallDepth.forClass(InfluxDBImpl.class);
164165
if (callDepth.decrementAndGet() > 0 || scope == null) {
165166
return;

instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbScope.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import io.opentelemetry.context.Context;
1111
import io.opentelemetry.context.Scope;
12+
import javax.annotation.Nullable;
1213

1314
/** Container used to carry state between enter and exit advices */
1415
public class InfluxDbScope {
@@ -27,7 +28,7 @@ public static InfluxDbScope start(Context parentContext, InfluxDbRequest influxD
2728
return new InfluxDbScope(influxDbRequest, context, context.makeCurrent());
2829
}
2930

30-
public void end(Throwable throwable) {
31+
public void end(@Nullable Throwable throwable) {
3132
scope.close();
3233

3334
instrumenter().end(context, influxDbRequest, null, throwable);

instrumentation/influxdb-2.4/metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ semantic_conventions:
66
library_link: https://github.com/influxdata/influxdb-java
77
configurations:
88
- name: otel.instrumentation.common.db.query-sanitization.enabled
9+
declarative_name: java.common.db.query_sanitization.enabled
910
description: Enables or disables query sanitization for database queries.
1011
type: boolean
1112
default: true

instrumentation/internal/internal-class-loader/javaagent-integration-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/internal/classloader/ResourceInjectionTest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.util.Collections;
2020
import java.util.Enumeration;
2121
import java.util.List;
22-
import java.util.concurrent.atomic.AtomicReference;
2322
import org.apache.commons.lang3.SystemUtils;
2423
import org.junit.jupiter.api.Test;
2524
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -30,23 +29,21 @@ class ResourceInjectionTest {
3029
private static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
3130

3231
@Test
33-
@SuppressWarnings("UnnecessaryAsync")
3432
void resourcesInjectedToNonDelegatingClassLoader() throws Exception {
3533
String resourceName = "test-resources/test-resource.txt";
3634
URL[] urls = {SystemUtils.class.getProtectionDomain().getCodeSource().getLocation()};
37-
AtomicReference<URLClassLoader> emptyLoader =
38-
new AtomicReference<>(new URLClassLoader(urls, null));
35+
URLClassLoader emptyLoader = new URLClassLoader(urls, null);
3936

40-
Enumeration<URL> resourceUrls = emptyLoader.get().getResources(resourceName);
37+
Enumeration<URL> resourceUrls = emptyLoader.getResources(resourceName);
4138
assertThat(resourceUrls.hasMoreElements()).isFalse();
4239
resourceUrls = null;
4340

4441
URLClassLoader notInjectedLoader = new URLClassLoader(urls, null);
4542
cleanup.deferCleanup(notInjectedLoader);
4643
// this triggers resource injection
47-
emptyLoader.get().loadClass(SystemUtils.class.getName());
44+
emptyLoader.loadClass(SystemUtils.class.getName());
4845

49-
List<URL> resourceList = Collections.list(emptyLoader.get().getResources(resourceName));
46+
List<URL> resourceList = Collections.list(emptyLoader.getResources(resourceName));
5047

5148
assertThat(resourceList).hasSize(2);
5249
assertThat(readLine(resourceList.get(0))).isEqualTo("Hello world!");
@@ -55,9 +52,9 @@ void resourcesInjectedToNonDelegatingClassLoader() throws Exception {
5552
assertThat(notInjectedLoader.getResources(resourceName).hasMoreElements()).isFalse();
5653

5754
// references to emptyloader are gone
58-
emptyLoader.get().close(); // cleanup
59-
WeakReference<URLClassLoader> ref = new WeakReference<>(emptyLoader.get());
60-
emptyLoader.set(null);
55+
emptyLoader.close(); // cleanup
56+
WeakReference<URLClassLoader> ref = new WeakReference<>(emptyLoader);
57+
emptyLoader = null;
6158

6259
awaitGc(ref, Duration.ofSeconds(10));
6360

instrumentation/internal/internal-class-loader/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/internal/classloader/JbossClassloadingTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.jboss.modules.ModuleClassLoader;
1414
import org.jboss.modules.ModuleFinder;
1515
import org.jboss.modules.ModuleIdentifier;
16-
import org.jboss.modules.ModuleLoadException;
1716
import org.jboss.modules.ModuleLoader;
1817
import org.jboss.modules.ModuleSpec;
1918
import org.junit.jupiter.api.Test;
@@ -25,8 +24,7 @@ class JbossClassloadingTest {
2524
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
2625

2726
@Test
28-
void testDelegatesToBootstrapClassLoaderForAgentClasses()
29-
throws ModuleLoadException, ClassNotFoundException {
27+
void testDelegatesToBootstrapClassLoaderForAgentClasses() throws Exception {
3028
ModuleFinder[] moduleFinders = new ModuleFinder[1];
3129
moduleFinders[0] = (identifier, delegateLoader) -> ModuleSpec.build(identifier).create();
3230

0 commit comments

Comments
 (0)