From 01553a7c522c773e5fa018c2aa034acac98d29f5 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 24 Oct 2022 10:27:28 -0700 Subject: [PATCH] Deprecate RocketMQ propagation setting (#6958) I suspect that this was added in the original RocketMQ instrumentation because it existed in the Kafka instrumentation, and not because there was a need for it(?) See #6957 for documentation on why it is needed in Kafka --- .../rocketmq-client-4.8/README.md | 1 - .../rocketmqclient/v4_8/RocketMqClientHooks.java | 16 ++++++++++++++++ .../v4_8/RocketMqTelemetryBuilder.java | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md index 4ea97b1779fa..ecab513000d6 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md @@ -3,4 +3,3 @@ | System property | Type | Default | Description | |---|---|---|---| | `otel.instrumentation.rocketmq-client.experimental-span-attributes` | Boolean | `false` | Enable the capture of experimental span attributes. | -| `otel.instrumentation.rocketmq-client.propagation` | Boolean | `true` | Enables remote context propagation via RocketMQ message headers. | \ No newline at end of file diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v4_8/RocketMqClientHooks.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v4_8/RocketMqClientHooks.java index e6870ddd8a87..097c9ff64e61 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v4_8/RocketMqClientHooks.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rocketmqclient/v4_8/RocketMqClientHooks.java @@ -9,11 +9,15 @@ import io.opentelemetry.instrumentation.rocketmqclient.v4_8.RocketMqTelemetry; import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig; +import java.util.logging.Logger; import org.apache.rocketmq.client.hook.ConsumeMessageHook; import org.apache.rocketmq.client.hook.SendMessageHook; public final class RocketMqClientHooks { + private static final Logger logger = Logger.getLogger(RocketMqClientHooks.class.getName()); + + @SuppressWarnings("deprecation") // call to deprecated method will be removed in the future private static final RocketMqTelemetry TELEMETRY = RocketMqTelemetry.builder(GlobalOpenTelemetry.get()) .setCapturedHeaders(ExperimentalConfig.get().getMessagingHeaders()) @@ -26,6 +30,18 @@ public final class RocketMqClientHooks { "otel.instrumentation.rocketmq-client.experimental-span-attributes", false)) .build(); + static { + if (InstrumentationConfig.get().getString("otel.instrumentation.rocketmq-client.propagation") + != null) { + logger.warning( + "The \"otel.instrumentation.rocketmq-client.propagation\" configuration property has" + + " been deprecated and will be removed in a future version." + + " If you have a need for this configuration property, please open an issue in the" + + " opentelemetry-java-instrumentation repository:" + + " https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues"); + } + } + public static final ConsumeMessageHook CONSUME_MESSAGE_HOOK = TELEMETRY.newTracingConsumeMessageHook(); diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqTelemetryBuilder.java b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqTelemetryBuilder.java index 3815d8a81fcf..264b564f5f0a 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqTelemetryBuilder.java +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/src/main/java/io/opentelemetry/instrumentation/rocketmqclient/v4_8/RocketMqTelemetryBuilder.java @@ -39,7 +39,12 @@ public RocketMqTelemetryBuilder setCaptureExperimentalSpanAttributes( /** * Sets whether the trace context should be written from producers / read from consumers for * propagating through messaging. + * + * @deprecated if you have a need for this configuration option please open an issue in the opentelemetry-java-instrumentation + * repository. */ + @Deprecated @CanIgnoreReturnValue public RocketMqTelemetryBuilder setPropagationEnabled(boolean propagationEnabled) { this.propagationEnabled = propagationEnabled;