Remove unnecessary parameter (#3955)
This commit is contained in:
parent
b5aec6a2e0
commit
dc2442ce75
|
@ -61,7 +61,7 @@ public class KafkaConsumerInstrumentation implements TypeInstrumentation {
|
|||
public static void wrap(
|
||||
@Advice.Return(readOnly = false) Iterable<ConsumerRecord<?, ?>> iterable) {
|
||||
if (iterable != null) {
|
||||
iterable = new TracingIterable(iterable, consumerInstrumenter());
|
||||
iterable = new TracingIterable(iterable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class KafkaConsumerInstrumentation implements TypeInstrumentation {
|
|||
@Advice.OnMethodExit(suppress = Throwable.class)
|
||||
public static void wrap(@Advice.Return(readOnly = false) List<ConsumerRecord<?, ?>> iterable) {
|
||||
if (iterable != null) {
|
||||
iterable = new TracingList(iterable, consumerInstrumenter());
|
||||
iterable = new TracingList(iterable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,20 +5,17 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.kafkaclients;
|
||||
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
||||
import static io.opentelemetry.javaagent.instrumentation.kafkaclients.KafkaSingletons.consumerInstrumenter;
|
||||
|
||||
import java.util.Iterator;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
|
||||
public class TracingIterable implements Iterable<ConsumerRecord<?, ?>> {
|
||||
private final Iterable<ConsumerRecord<?, ?>> delegate;
|
||||
private final Instrumenter<ConsumerRecord<?, ?>, Void> instrumenter;
|
||||
private boolean firstIterator = true;
|
||||
|
||||
public TracingIterable(
|
||||
Iterable<ConsumerRecord<?, ?>> delegate,
|
||||
Instrumenter<ConsumerRecord<?, ?>, Void> instrumenter) {
|
||||
public TracingIterable(Iterable<ConsumerRecord<?, ?>> delegate) {
|
||||
this.delegate = delegate;
|
||||
this.instrumenter = instrumenter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +25,7 @@ public class TracingIterable implements Iterable<ConsumerRecord<?, ?>> {
|
|||
// However, this is not thread-safe, but usually the first (hopefully only) traversal of
|
||||
// ConsumerRecords is performed in the same thread that called poll()
|
||||
if (firstIterator) {
|
||||
it = new TracingIterator(delegate.iterator(), instrumenter);
|
||||
it = new TracingIterator(delegate.iterator(), consumerInstrumenter());
|
||||
firstIterator = false;
|
||||
} else {
|
||||
it = delegate.iterator();
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.kafkaclients;
|
||||
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
@ -14,9 +13,8 @@ import org.apache.kafka.clients.consumer.ConsumerRecord;
|
|||
public class TracingList extends TracingIterable implements List<ConsumerRecord<?, ?>> {
|
||||
private final List<ConsumerRecord<?, ?>> delegate;
|
||||
|
||||
public TracingList(
|
||||
List<ConsumerRecord<?, ?>> delegate, Instrumenter<ConsumerRecord<?, ?>, Void> instrumenter) {
|
||||
super(delegate, instrumenter);
|
||||
public TracingList(List<ConsumerRecord<?, ?>> delegate) {
|
||||
super(delegate);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue