Rename some *InstrumenterBuilder classes to *InstrumenterFactory (#4391)
This commit is contained in:
parent
b0430f2b79
commit
b2bc41453b
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.javaagent.instrumentation.kafkaclients;
|
||||
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
||||
import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterBuilder;
|
||||
import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterFactory;
|
||||
import io.opentelemetry.instrumentation.kafka.internal.ReceivedRecords;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
|
@ -15,11 +15,11 @@ public final class KafkaSingletons {
|
|||
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.kafka-clients-0.11";
|
||||
|
||||
private static final Instrumenter<ProducerRecord<?, ?>, Void> PRODUCER_INSTRUMENTER =
|
||||
KafkaInstrumenterBuilder.buildProducerInstrumenter(INSTRUMENTATION_NAME);
|
||||
KafkaInstrumenterFactory.createProducerInstrumenter(INSTRUMENTATION_NAME);
|
||||
private static final Instrumenter<ReceivedRecords, Void> CONSUMER_RECEIVE_INSTRUMENTER =
|
||||
KafkaInstrumenterBuilder.buildConsumerReceiveInstrumenter(INSTRUMENTATION_NAME);
|
||||
KafkaInstrumenterFactory.createConsumerReceiveInstrumenter(INSTRUMENTATION_NAME);
|
||||
private static final Instrumenter<ConsumerRecord<?, ?>, Void> CONSUMER_PROCESS_INSTRUMENTER =
|
||||
KafkaInstrumenterBuilder.buildConsumerProcessInstrumenter(INSTRUMENTATION_NAME);
|
||||
KafkaInstrumenterFactory.createConsumerProcessInstrumenter(INSTRUMENTATION_NAME);
|
||||
|
||||
public static Instrumenter<ProducerRecord<?, ?>, Void> producerInstrumenter() {
|
||||
return PRODUCER_INSTRUMENTER;
|
||||
|
|
|
@ -8,7 +8,7 @@ package io.opentelemetry.instrumentation.kafkaclients;
|
|||
import io.opentelemetry.api.OpenTelemetry;
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessageOperation;
|
||||
import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterBuilder;
|
||||
import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterFactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -43,9 +43,9 @@ public final class KafkaTracingBuilder {
|
|||
public KafkaTracing build() {
|
||||
return new KafkaTracing(
|
||||
openTelemetry,
|
||||
KafkaInstrumenterBuilder.buildProducerInstrumenter(
|
||||
KafkaInstrumenterFactory.createProducerInstrumenter(
|
||||
INSTRUMENTATION_NAME, openTelemetry, producerAttributesExtractors),
|
||||
KafkaInstrumenterBuilder.buildConsumerOperationInstrumenter(
|
||||
KafkaInstrumenterFactory.createConsumerOperationInstrumenter(
|
||||
INSTRUMENTATION_NAME,
|
||||
openTelemetry,
|
||||
MessageOperation.RECEIVE,
|
||||
|
|
|
@ -20,15 +20,15 @@ import java.util.Collections;
|
|||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
|
||||
public final class KafkaInstrumenterBuilder {
|
||||
public final class KafkaInstrumenterFactory {
|
||||
|
||||
public static Instrumenter<ProducerRecord<?, ?>, Void> buildProducerInstrumenter(
|
||||
public static Instrumenter<ProducerRecord<?, ?>, Void> createProducerInstrumenter(
|
||||
String instrumentationName) {
|
||||
return buildProducerInstrumenter(
|
||||
return createProducerInstrumenter(
|
||||
instrumentationName, GlobalOpenTelemetry.get(), Collections.emptyList());
|
||||
}
|
||||
|
||||
public static Instrumenter<ProducerRecord<?, ?>, Void> buildProducerInstrumenter(
|
||||
public static Instrumenter<ProducerRecord<?, ?>, Void> createProducerInstrumenter(
|
||||
String instrumentationName,
|
||||
OpenTelemetry openTelemetry,
|
||||
Iterable<AttributesExtractor<ProducerRecord<?, ?>, Void>> extractors) {
|
||||
|
@ -44,13 +44,13 @@ public final class KafkaInstrumenterBuilder {
|
|||
.newInstrumenter(SpanKindExtractor.alwaysProducer());
|
||||
}
|
||||
|
||||
public static Instrumenter<ReceivedRecords, Void> buildConsumerReceiveInstrumenter(
|
||||
public static Instrumenter<ReceivedRecords, Void> createConsumerReceiveInstrumenter(
|
||||
String instrumentationName) {
|
||||
return buildConsumerReceiveInstrumenter(
|
||||
return createConsumerReceiveInstrumenter(
|
||||
instrumentationName, GlobalOpenTelemetry.get(), Collections.emptyList());
|
||||
}
|
||||
|
||||
public static Instrumenter<ReceivedRecords, Void> buildConsumerReceiveInstrumenter(
|
||||
public static Instrumenter<ReceivedRecords, Void> createConsumerReceiveInstrumenter(
|
||||
String instrumentationName,
|
||||
OpenTelemetry openTelemetry,
|
||||
Iterable<AttributesExtractor<ReceivedRecords, Void>> extractors) {
|
||||
|
@ -67,16 +67,16 @@ public final class KafkaInstrumenterBuilder {
|
|||
.newInstrumenter(SpanKindExtractor.alwaysConsumer());
|
||||
}
|
||||
|
||||
public static Instrumenter<ConsumerRecord<?, ?>, Void> buildConsumerProcessInstrumenter(
|
||||
public static Instrumenter<ConsumerRecord<?, ?>, Void> createConsumerProcessInstrumenter(
|
||||
String instrumentationName) {
|
||||
return buildConsumerOperationInstrumenter(
|
||||
return createConsumerOperationInstrumenter(
|
||||
instrumentationName,
|
||||
GlobalOpenTelemetry.get(),
|
||||
MessageOperation.PROCESS,
|
||||
Collections.emptyList());
|
||||
}
|
||||
|
||||
public static Instrumenter<ConsumerRecord<?, ?>, Void> buildConsumerOperationInstrumenter(
|
||||
public static Instrumenter<ConsumerRecord<?, ?>, Void> createConsumerOperationInstrumenter(
|
||||
String instrumentationName,
|
||||
OpenTelemetry openTelemetry,
|
||||
MessageOperation operation,
|
||||
|
@ -108,5 +108,5 @@ public final class KafkaInstrumenterBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
private KafkaInstrumenterBuilder() {}
|
||||
private KafkaInstrumenterFactory() {}
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.javaagent.instrumentation.kafkastreams;
|
||||
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
||||
import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterBuilder;
|
||||
import io.opentelemetry.instrumentation.kafka.internal.KafkaInstrumenterFactory;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
|
||||
public final class KafkaStreamsSingletons {
|
||||
|
@ -16,7 +16,7 @@ public final class KafkaStreamsSingletons {
|
|||
private static final Instrumenter<ConsumerRecord<?, ?>, Void> INSTRUMENTER = buildInstrumenter();
|
||||
|
||||
private static Instrumenter<ConsumerRecord<?, ?>, Void> buildInstrumenter() {
|
||||
return KafkaInstrumenterBuilder.buildConsumerProcessInstrumenter(INSTRUMENTATION_NAME);
|
||||
return KafkaInstrumenterFactory.createConsumerProcessInstrumenter(INSTRUMENTATION_NAME);
|
||||
}
|
||||
|
||||
public static Instrumenter<ConsumerRecord<?, ?>, Void> instrumenter() {
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
|||
import io.opentelemetry.javaagent.instrumentation.servlet.v5_0.Servlet5Accessor;
|
||||
import io.opentelemetry.javaagent.instrumentation.servlet.v5_0.Servlet5Singletons;
|
||||
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatHelper;
|
||||
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatInstrumenterBuilder;
|
||||
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatInstrumenterFactory;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.coyote.Request;
|
||||
|
@ -18,7 +18,7 @@ import org.apache.coyote.Response;
|
|||
public final class Tomcat10Singletons {
|
||||
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.tomcat-10.0";
|
||||
private static final Instrumenter<Request, Response> INSTRUMENTER =
|
||||
TomcatInstrumenterBuilder.newInstrumenter(
|
||||
TomcatInstrumenterFactory.create(
|
||||
INSTRUMENTATION_NAME, Servlet5Accessor.INSTANCE, Tomcat10ServletEntityProvider.INSTANCE);
|
||||
private static final TomcatHelper<HttpServletRequest, HttpServletResponse> HELPER =
|
||||
new TomcatHelper<>(
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
|||
import io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Accessor;
|
||||
import io.opentelemetry.javaagent.instrumentation.servlet.v3_0.Servlet3Singletons;
|
||||
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatHelper;
|
||||
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatInstrumenterBuilder;
|
||||
import io.opentelemetry.javaagent.instrumentation.tomcat.common.TomcatInstrumenterFactory;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.coyote.Request;
|
||||
|
@ -18,7 +18,7 @@ import org.apache.coyote.Response;
|
|||
public final class Tomcat7Singletons {
|
||||
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.tomcat-7.0";
|
||||
private static final Instrumenter<Request, Response> INSTRUMENTER =
|
||||
TomcatInstrumenterBuilder.newInstrumenter(
|
||||
TomcatInstrumenterFactory.create(
|
||||
INSTRUMENTATION_NAME, Servlet3Accessor.INSTANCE, Tomcat7ServletEntityProvider.INSTANCE);
|
||||
private static final TomcatHelper<HttpServletRequest, HttpServletResponse> HELPER =
|
||||
new TomcatHelper<>(
|
||||
|
|
|
@ -24,11 +24,11 @@ import io.opentelemetry.javaagent.instrumentation.servlet.ServletErrorCauseExtra
|
|||
import org.apache.coyote.Request;
|
||||
import org.apache.coyote.Response;
|
||||
|
||||
public final class TomcatInstrumenterBuilder {
|
||||
public final class TomcatInstrumenterFactory {
|
||||
|
||||
private TomcatInstrumenterBuilder() {}
|
||||
private TomcatInstrumenterFactory() {}
|
||||
|
||||
public static <REQUEST, RESPONSE> Instrumenter<Request, Response> newInstrumenter(
|
||||
public static <REQUEST, RESPONSE> Instrumenter<Request, Response> create(
|
||||
String instrumentationName,
|
||||
ServletAccessor<REQUEST, RESPONSE> accessor,
|
||||
TomcatServletEntityProvider<REQUEST, RESPONSE> servletEntityProvider) {
|
Loading…
Reference in New Issue