Skip to content

Commit de98f9f

Browse files
otelbot[bot]trask
andauthored
Code review sweep (run 24912525812) (open-telemetry#18274)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
1 parent 8f43c1c commit de98f9f

8 files changed

Lines changed: 19 additions & 19 deletions

File tree

instrumentation/spring/spring-integration-4.1/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/v4_1/AbstractSpringCloudStreamProducerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public abstract class AbstractSpringCloudStreamProducerTest {
1717
private static final boolean HAS_PRODUCER_SPAN =
1818
Boolean.getBoolean("otel.instrumentation.spring-integration.producer.enabled");
1919

20-
@RegisterExtension final RabbitExtension rabbit;
20+
@RegisterExtension private final RabbitExtension rabbit;
2121

2222
protected final InstrumentationExtension testing;
2323

instrumentation/spring/spring-integration-4.1/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/v4_1/AbstractSpringCloudStreamRabbitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
public abstract class AbstractSpringCloudStreamRabbitTest {
1414

15-
@RegisterExtension final RabbitExtension rabbit;
15+
@RegisterExtension private final RabbitExtension rabbit;
1616

1717
protected final InstrumentationExtension testing;
1818

instrumentation/spring/spring-integration-4.1/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/v4_1/RabbitExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private static Class<?>[] getContextClasses(Class<?> mainContext, Class<?> addit
106106
@EnableAutoConfiguration
107107
@EnableBinding(Source.class)
108108
static class ProducerConfig {
109-
@Autowired Source source;
109+
@Autowired private Source source;
110110

111111
@Bean
112112
Runnable producer() {

instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/jms/v2_0/SpringTemplateTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import static org.assertj.core.api.Assertions.assertThat;
1414

1515
import io.opentelemetry.instrumentation.spring.jms.v2_0.AbstractJmsTest;
16+
import io.opentelemetry.instrumentation.testing.internal.AutoCleanupExtension;
1617
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
1718
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
1819
import io.opentelemetry.sdk.trace.data.SpanData;
@@ -41,7 +42,6 @@
4142
import org.hornetq.core.server.HornetQServers;
4243
import org.hornetq.jms.client.HornetQConnectionFactory;
4344
import org.jetbrains.annotations.NotNull;
44-
import org.junit.jupiter.api.AfterAll;
4545
import org.junit.jupiter.api.BeforeAll;
4646
import org.junit.jupiter.api.Test;
4747
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -53,6 +53,9 @@ class SpringTemplateTest extends AbstractJmsTest {
5353
@RegisterExtension
5454
private static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
5555

56+
@RegisterExtension
57+
private static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
58+
5659
private static HornetQServer server;
5760
private static final String messageText = "a message";
5861
private static JmsTemplate template;
@@ -78,6 +81,7 @@ static void setup() throws Exception {
7881

7982
server = HornetQServers.newHornetQServer(config);
8083
server.start();
84+
cleanup.deferAfterAll(server::stop);
8185

8286
ServerLocator serverLocator =
8387
HornetQClient.createServerLocatorWithoutHA(
@@ -92,23 +96,19 @@ static void setup() throws Exception {
9296
HornetQConnectionFactory connectionFactory =
9397
HornetQJMSClient.createConnectionFactoryWithoutHA(
9498
JMSFactoryType.CF, new TransportConfiguration(InVMConnectorFactory.class.getName()));
99+
cleanup.deferAfterAll(connectionFactory::close);
95100

96101
connection = connectionFactory.createConnection();
97102
connection.start();
98103
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
99104
session.run();
105+
cleanup.deferAfterAll(connection);
106+
cleanup.deferAfterAll(session);
100107

101108
template = new JmsTemplate(connectionFactory);
102109
template.setReceiveTimeout(SECONDS.toMillis(10));
103110
}
104111

105-
@AfterAll
106-
static void cleanup() throws Exception {
107-
session.close();
108-
connection.close();
109-
server.stop();
110-
}
111-
112112
@Test
113113
void sendingMessageToDestinationNameGeneratesSpans() throws JMSException {
114114
Queue queue = session.createQueue("SpringTemplateJms2");

instrumentation/spring/spring-jms/spring-jms-2.0/metadata.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ semantic_conventions:
55
library_link: https://docs.spring.io/spring-framework/reference/integration/jms.html
66
configurations:
77
- name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled
8+
declarative_name: java.common.messaging.receive_telemetry/development.enabled
89
description: >
910
Enables experimental receive telemetry, which will cause consumers to start a new trace, with
1011
only a span link connecting it to the producer trace.
1112
type: boolean
1213
default: false
1314
- name: otel.instrumentation.messaging.experimental.capture-headers
15+
declarative_name: java.common.messaging.capture_headers/development
1416
description: A comma-separated list of header names to capture as span attributes.
1517
type: list
1618
default: ''

instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/jms/v6_0/AbstractSpringJmsListenerTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.util.concurrent.CompletableFuture;
1919
import java.util.concurrent.ExecutionException;
2020
import java.util.concurrent.TimeoutException;
21-
import org.junit.jupiter.api.AfterAll;
2221
import org.junit.jupiter.api.BeforeAll;
2322
import org.junit.jupiter.api.extension.RegisterExtension;
2423
import org.junit.jupiter.params.ParameterizedTest;
@@ -54,13 +53,7 @@ static void setUp() {
5453
.withStartupTimeout(Duration.ofMinutes(2))
5554
.withLogConsumer(new Slf4jLogConsumer(logger));
5655
broker.start();
57-
}
58-
59-
@AfterAll
60-
static void tearDown() {
61-
if (broker != null) {
62-
broker.close();
63-
}
56+
cleanup.deferAfterAll(broker);
6457
}
6558

6659
@ParameterizedTest

instrumentation/spring/spring-jms/spring-jms-6.0/metadata.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ semantic_conventions:
55
library_link: https://docs.spring.io/spring-framework/reference/integration/jms.html
66
configurations:
77
- name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled
8+
declarative_name: java.common.messaging.receive_telemetry/development.enabled
89
description: >
910
Enables experimental receive telemetry, which will cause consumers to start a new trace, with
1011
only a span link connecting it to the producer trace.
1112
type: boolean
1213
default: false
1314
- name: otel.instrumentation.messaging.experimental.capture-headers
15+
declarative_name: java.common.messaging.capture_headers/development
1416
description: A comma-separated list of header names to capture as span attributes.
1517
type: list
1618
default: ''

instrumentation/spring/spring-kafka-2.7/metadata.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@ semantic_conventions:
55
- MESSAGING_SPANS
66
configurations:
77
- name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled
8+
declarative_name: java.common.messaging.receive_telemetry/development.enabled
89
description: >
910
Enables experimental receive telemetry, which will cause consumers to start a new trace, with
1011
only a span link connecting it to the producer trace.
1112
type: boolean
1213
default: false
1314
- name: otel.instrumentation.messaging.experimental.capture-headers
15+
declarative_name: java.common.messaging.capture_headers/development
1416
description: A comma-separated list of header names to capture as span attributes.
1517
type: list
1618
default: ''
1719
- name: otel.instrumentation.kafka.experimental-span-attributes
20+
declarative_name: java.kafka.experimental_span_attributes/development
1821
description: Enables the capture of the experimental consumer attribute `kafka.record.queue_time_ms` and `messaging.kafka.bootstrap.servers`.
1922
type: boolean
2023
default: false

0 commit comments

Comments
 (0)