Skip to content

Commit

Permalink
Deprecate RocketMQ propagation setting (open-telemetry#6958)
Browse files Browse the repository at this point in the history
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 open-telemetry#6957 for documentation on why it is needed in Kafka
  • Loading branch information
trask authored and LironKS committed Oct 31, 2022
1 parent 753d957 commit 01553a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a
* href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues">opentelemetry-java-instrumentation</a>
* repository.
*/
@Deprecated
@CanIgnoreReturnValue
public RocketMqTelemetryBuilder setPropagationEnabled(boolean propagationEnabled) {
this.propagationEnabled = propagationEnabled;
Expand Down

0 comments on commit 01553a7

Please sign in to comment.