Skip to content

Commit

Permalink
Remove propagationEnabled setting
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-ai committed Oct 25, 2022
1 parent 4f07902 commit 2254b03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessageOperation;
import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.messaging.MessagingAttributesGetter;
Expand All @@ -25,7 +24,7 @@ final class RocketMqInstrumenterFactory {
private RocketMqInstrumenterFactory() {}

public static Instrumenter<PublishingMessageImpl, SendReceiptImpl> createProducerInstrumenter(
OpenTelemetry openTelemetry, List<String> capturedHeaders, boolean propagationEnabled) {
OpenTelemetry openTelemetry, List<String> capturedHeaders) {

RocketMqProducerAttributeGetter getter = RocketMqProducerAttributeGetter.INSTANCE;
MessageOperation operation = MessageOperation.SEND;
Expand All @@ -47,10 +46,7 @@ public static Instrumenter<PublishingMessageImpl, SendReceiptImpl> createProduce
}
});

if (propagationEnabled) {
return instrumenterBuilder.buildProducerInstrumenter(MapSetter.INSTANCE);
}
return instrumenterBuilder.buildInstrumenter(SpanKindExtractor.alwaysProducer());
return instrumenterBuilder.buildProducerInstrumenter(MapSetter.INSTANCE);
}

private static <T, R> MessagingAttributesExtractor<T, R> buildMessagingAttributesExtractor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,17 @@
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig;
import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig;
import org.apache.rocketmq.client.java.impl.producer.SendReceiptImpl;
import org.apache.rocketmq.client.java.message.PublishingMessageImpl;

public final class RocketMqSingletons {
private static final boolean PROPAGATION_ENABLED =
InstrumentationConfig.get()
.getBoolean("otel.instrumentation.rocketmq-client-java.propagation", true);

private static final Instrumenter<PublishingMessageImpl, SendReceiptImpl> PRODUCER_INSTRUMENTER;

static {
PRODUCER_INSTRUMENTER =
RocketMqInstrumenterFactory.createProducerInstrumenter(
GlobalOpenTelemetry.get(),
ExperimentalConfig.get().getMessagingHeaders(),
PROPAGATION_ENABLED);
GlobalOpenTelemetry.get(), ExperimentalConfig.get().getMessagingHeaders());
}

public static Instrumenter<PublishingMessageImpl, SendReceiptImpl> producerInstrumenter() {
Expand Down

0 comments on commit 2254b03

Please sign in to comment.