Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate RocketMQ propagation setting #6958

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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