Skip to content

Commit

Permalink
Rename some *InstrumenterBuilder classes to *InstrumenterFactory (ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek authored and RashmiRam committed May 23, 2022
1 parent 2258a3b commit dd3101d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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;
Expand Down Expand Up @@ -43,9 +43,9 @@ public KafkaTracingBuilder addConsumerAttributesExtractors(
public KafkaTracing build() {
return new KafkaTracing(
openTelemetry,
KafkaInstrumenterBuilder.buildProducerInstrumenter(
KafkaInstrumenterFactory.createProducerInstrumenter(
INSTRUMENTATION_NAME, openTelemetry, producerAttributesExtractors),
KafkaInstrumenterBuilder.buildConsumerOperationInstrumenter(
KafkaInstrumenterFactory.createConsumerOperationInstrumenter(
INSTRUMENTATION_NAME,
openTelemetry,
MessageOperation.RECEIVE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
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) {
Expand All @@ -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) {
Expand All @@ -67,16 +67,16 @@ public static Instrumenter<ReceivedRecords, Void> buildConsumerReceiveInstrument
.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,
Expand Down Expand Up @@ -108,5 +108,5 @@ public static Instrumenter<ReceivedRecords, Void> buildConsumerReceiveInstrument
}
}

private KafkaInstrumenterBuilder() {}
private KafkaInstrumenterFactory() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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;
Expand All @@ -18,7 +18,7 @@
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<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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;
Expand All @@ -18,7 +18,7 @@
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<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
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) {
Expand Down

0 comments on commit dd3101d

Please sign in to comment.