Skip to content

Commit 9aa1fe5

Browse files
otelbot[bot]trask
andauthored
Module cleanup (run 25329827818) (open-telemetry#18567)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
1 parent d1cdd04 commit 9aa1fe5

10 files changed

Lines changed: 16 additions & 17 deletions

File tree

instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/KafkaClientDefaultTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ void testPassThroughTombstone() throws Exception {
156156
@ValueSource(booleans = {true, false})
157157
void testRecordsWithTopicPartitionKafkaConsume(boolean testListIterator) throws Exception {
158158
String greeting = "Hello from MockConsumer!";
159-
producer.send(new ProducerRecord<>(SHARED_TOPIC, partition, null, greeting)).get(5, SECONDS);
159+
producer.send(new ProducerRecord<>(SHARED_TOPIC, PARTITION, null, greeting)).get(5, SECONDS);
160160

161161
testing.waitForTraces(1);
162162

163163
awaitUntilConsumerIsReady();
164164
ConsumerRecords<?, ?> consumerRecords = poll(Duration.ofSeconds(5));
165165
List<? extends ConsumerRecord<?, ?>> recordsInPartition =
166-
consumerRecords.records(KafkaClientBaseTest.topicPartition);
166+
consumerRecords.records(KafkaClientBaseTest.TOPIC_PARTITION);
167167
assertThat(recordsInPartition).hasSize(1);
168168

169169
// iterate over records to generate spans

instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/v0_11/KafkaClientSuppressReceiveSpansTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ void testPassThroughTombstone() throws Exception {
119119
@Test
120120
void testRecordsWithTopicPartitionKafkaConsume() throws Exception {
121121
String greeting = "Hello from MockConsumer!";
122-
producer.send(new ProducerRecord<>(SHARED_TOPIC, partition, null, greeting)).get(5, SECONDS);
122+
producer.send(new ProducerRecord<>(SHARED_TOPIC, PARTITION, null, greeting)).get(5, SECONDS);
123123

124124
testing.waitForTraces(1);
125125

126126
awaitUntilConsumerIsReady();
127127
ConsumerRecords<?, ?> consumerRecords = poll(Duration.ofSeconds(5));
128128
List<? extends ConsumerRecord<?, ?>> recordsInPartition =
129-
consumerRecords.records(KafkaClientBaseTest.topicPartition);
129+
consumerRecords.records(KafkaClientBaseTest.TOPIC_PARTITION);
130130
assertThat(recordsInPartition).hasSize(1);
131131

132132
// iterate over records to generate spans

instrumentation/kafka/kafka-clients/kafka-clients-0.11/testing/src/main/java/io/opentelemetry/instrumentation/kafkaclients/common/v0_11/internal/KafkaClientBaseTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ public abstract class KafkaClientBaseTest {
8585
private static final boolean EXPERIMENTAL_ATTRIBUTES =
8686
Boolean.getBoolean("otel.instrumentation.kafka.experimental-span-attributes");
8787

88-
public static final int partition = 0;
89-
public static final TopicPartition topicPartition = new TopicPartition(SHARED_TOPIC, partition);
88+
public static final int PARTITION = 0;
89+
public static final TopicPartition TOPIC_PARTITION = new TopicPartition(SHARED_TOPIC, PARTITION);
9090

9191
@BeforeAll
9292
void setupClass() throws ExecutionException, InterruptedException, TimeoutException {

instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies {
1717
}
1818

1919
tasks {
20-
withType<Test>().configureEach {
20+
test {
2121
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
2222
systemProperty("testLatestDeps", otelProps.testLatestDeps)
2323
systemProperty("collectMetadata", otelProps.collectMetadata)

instrumentation/kafka/kafka-clients/kafka-clients-common-0.11/library/src/main/java/io/opentelemetry/instrumentation/kafkaclients/common/v0_11/internal/KafkaMetricRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ final class KafkaMetricRegistry {
5252
for (Map.Entry<String, String> entry : classNameToType.entrySet()) {
5353
try {
5454
measurableToInstrumentType.put(Class.forName(entry.getKey()), entry.getValue());
55-
} catch (ClassNotFoundException e) {
55+
} catch (ClassNotFoundException ignored) {
5656
// Class doesn't exist in this version of kafka client - skip
5757
}
5858
}
@@ -92,7 +92,7 @@ static RegisteredObservable getRegisteredObservable(Meter meter, KafkaMetric kaf
9292
private static Class<? extends Measurable> getMeasurable(KafkaMetric kafkaMetric) {
9393
try {
9494
return kafkaMetric.measurable().getClass();
95-
} catch (IllegalStateException e) {
95+
} catch (IllegalStateException ignored) {
9696
return null;
9797
}
9898
}

instrumentation/kafka/kafka-clients/kafka-clients-common-0.11/library/src/main/java/io/opentelemetry/instrumentation/kafkaclients/common/v0_11/internal/KafkaPropagation.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
public final class KafkaPropagation {
2121

2222
private static final KafkaHeadersSetter SETTER = KafkaHeadersSetter.INSTANCE;
23-
private static final boolean hasMaxUsableProduceMagic = hasMaxUsableProduceMagic();
23+
private static final boolean HAS_MAX_USABLE_PRODUCE_MAGIC = hasMaxUsableProduceMagic();
2424

2525
// Do not inject headers for batch versions below 2
2626
// This is how similar check is being done in Kafka client itself:
@@ -30,7 +30,7 @@ public final class KafkaPropagation {
3030
// headers attempt to read messages that were produced by clients > 0.11 and the magic
3131
// value of the broker(s) is >= 2
3232
public static boolean shouldPropagate(ApiVersions apiVersions) {
33-
return !hasMaxUsableProduceMagic
33+
return !HAS_MAX_USABLE_PRODUCE_MAGIC
3434
|| maxUsableProduceMagic(apiVersions) >= RecordBatch.MAGIC_VALUE_V2;
3535
}
3636

@@ -44,7 +44,7 @@ private static boolean hasMaxUsableProduceMagic() {
4444
// missing in kafka 4.x
4545
ApiVersions.class.getMethod("maxUsableProduceMagic");
4646
return true;
47-
} catch (NoSuchMethodException e) {
47+
} catch (NoSuchMethodException ignored) {
4848
return false;
4949
}
5050
}
@@ -59,7 +59,7 @@ public static <K, V> ProducerRecord<K, V> propagateContext(
5959
TextMapPropagator propagator, Context context, ProducerRecord<K, V> record) {
6060
try {
6161
inject(propagator, context, record);
62-
} catch (IllegalStateException e) {
62+
} catch (IllegalStateException ignored) {
6363
// headers must be read-only from reused record. try again with new one.
6464
record =
6565
new ProducerRecord<>(

instrumentation/kafka/kafka-clients/kafka-clients-common-0.11/library/src/main/java/io/opentelemetry/instrumentation/kafkaclients/common/v0_11/internal/KafkaUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private static String extractConsumerGroup(Consumer<?, ?> consumer) {
105105
try {
106106
Object metadata = GET_GROUP_METADATA.invoke(consumer);
107107
return (String) GET_GROUP_ID.invoke(metadata);
108-
} catch (Throwable t) {
108+
} catch (Throwable ignored) {
109109
return null;
110110
}
111111
}

instrumentation/kafka/kafka-connect-2.6/testing/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ dependencies {
2323
testImplementation("org.testcontainers:testcontainers-mongodb") // For MongoDBContainer
2424
testImplementation("org.mongodb:mongodb-driver-sync:4.11.0") // MongoDB Java driver
2525

26-
// Testcontainers dependencies for integration testing
27-
testImplementation("org.testcontainers:testcontainers-junit-jupiter")
2826
testImplementation("org.testcontainers:testcontainers")
29-
testImplementation("org.testcontainers:testcontainers-kafka")
3027
testImplementation("io.rest-assured:rest-assured:5.5.5")
3128
testImplementation("com.fasterxml.jackson.core:jackson-databind")
3229
}

instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/v0_11/KafkaStreamsDefaultTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void testKafkaProduceAndConsumeWithStreamsInBetween() throws Exception {
7272
});
7373

7474
KafkaStreams streams = streamBuilder.createStreams(values, config, STREAM_PROCESSED);
75+
cleanup.deferCleanup(() -> streams.close());
7576
streams.start();
7677

7778
String greeting = "TESTING TESTING 123!";

instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/v0_11/KafkaStreamsSuppressReceiveSpansTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ void testKafkaProduceAndConsumeWithStreamsInBetween() throws Exception {
6969
});
7070

7171
KafkaStreams streams = streamBuilder.createStreams(values, config, STREAM_PROCESSED);
72+
cleanup.deferCleanup(() -> streams.close());
7273
streams.start();
7374

7475
String greeting = "TESTING TESTING 123!";

0 commit comments

Comments
 (0)