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

Rename netty always-create-connect-span property to `connection-tel… #5834

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions instrumentation/netty/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Settings for the Netty instrumentation

| System property | Type | Default | Description |
|---|---|---|---|
| `otel.instrumentation.netty.always-create-connect-span` | Boolean | `false` | Enable the creation of Connect and DNS spans by default for Netty 4.0 and higher instrumentation. |
| `otel.instrumentation.netty.ssl-telemetry.enabled` | Boolean | `false ` | Enable SSL telemetry for Netty 4.0 and higher instrumentation. |
| System property | Type | Default | Description |
|-----------------------------------------------------------|---------|---------|---------------------------------------------------------------------------------------------------|
| `otel.instrumentation.netty.connection-telemetry.enabled` | Boolean | `false` | Enable the creation of Connect and DNS spans by default for Netty 4.0 and higher instrumentation. |
| `otel.instrumentation.netty.ssl-telemetry.enabled` | Boolean | `false` | Enable SSL telemetry for Netty 4.0 and higher instrumentation. |
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
public final class NettyClientInstrumenterFactory {

private final String instrumentationName;
private final boolean alwaysCreateConnectSpan;
private final boolean connectionTelemetryEnabled;
private final boolean sslTelemetryEnabled;

public NettyClientInstrumenterFactory(
String instrumentationName, boolean alwaysCreateConnectSpan, boolean sslTelemetryEnabled) {
String instrumentationName, boolean connectionTelemetryEnabled, boolean sslTelemetryEnabled) {
this.instrumentationName = instrumentationName;
this.alwaysCreateConnectSpan = alwaysCreateConnectSpan;
this.connectionTelemetryEnabled = connectionTelemetryEnabled;
this.sslTelemetryEnabled = sslTelemetryEnabled;
}

Expand Down Expand Up @@ -58,11 +58,11 @@ public NettyConnectionInstrumenter createConnectionInstrumenter() {
.addAttributesExtractor(PeerServiceAttributesExtractor.create(netAttributesGetter))
.setTimeExtractor(new NettyConnectionTimeExtractor())
.newInstrumenter(
alwaysCreateConnectSpan
connectionTelemetryEnabled
? SpanKindExtractor.alwaysInternal()
: SpanKindExtractor.alwaysClient());

return alwaysCreateConnectSpan
return connectionTelemetryEnabled
? new NettyConnectionInstrumenterImpl(instrumenter)
: new NettyErrorOnlyConnectionInstrumenter(instrumenter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tasks {
includeTestsMatching("Netty40ClientSslTest")
}
include("**/Netty40ConnectionSpanTest.*", "**/Netty40ClientSslTest.*")
jvmArgs("-Dotel.instrumentation.netty.always-create-connect-span=true")
jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true")
jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@

public final class NettyClientSingletons {

private static final boolean alwaysCreateConnectSpan =
Config.get().getBoolean("otel.instrumentation.netty.always-create-connect-span", false);
private static final boolean sslTelemetryEnabled =
Config.get().getBoolean("otel.instrumentation.netty.ssl-telemetry.enabled", false);
private static final boolean connectionTelemetryEnabled;
private static final boolean sslTelemetryEnabled;

static {
Config config = Config.get();
boolean alwaysCreateConnectSpan =
config.getBoolean("otel.instrumentation.netty.always-create-connect-span", false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try to communicate to users that they are using a deprecated property? Or will we just document the deprecation in release notes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we've probably never done that before, but that's a good idea - @open-telemetry/java-instrumentation-approvers WDYT about adding a warning log if a deprecated property is used?

connectionTelemetryEnabled =
config.getBoolean(
"otel.instrumentation.netty.connection-telemetry.enabled", alwaysCreateConnectSpan);
sslTelemetryEnabled =
config.getBoolean("otel.instrumentation.netty.ssl-telemetry.enabled", false);
}

private static final Instrumenter<HttpRequestAndChannel, HttpResponse> INSTRUMENTER;
private static final NettyConnectionInstrumenter CONNECTION_INSTRUMENTER;
Expand All @@ -27,7 +36,7 @@ public final class NettyClientSingletons {
static {
NettyClientInstrumenterFactory factory =
new NettyClientInstrumenterFactory(
"io.opentelemetry.netty-4.0", alwaysCreateConnectSpan, sslTelemetryEnabled);
"io.opentelemetry.netty-4.0", connectionTelemetryEnabled, sslTelemetryEnabled);
INSTRUMENTER = factory.createHttpInstrumenter();
CONNECTION_INSTRUMENTER = factory.createConnectionInstrumenter();
SSL_INSTRUMENTER = factory.createSslInstrumenter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tasks {
includeTestsMatching("Netty41ClientSslTest")
}
include("**/Netty41ConnectionSpanTest.*", "**/Netty41ClientSslTest.*")
jvmArgs("-Dotel.instrumentation.netty.always-create-connect-span=true")
jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true")
jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ public final class NettyClientSingletons {
static final AttributeKey<HttpResponse> HTTP_RESPONSE =
AttributeKey.valueOf(NettyClientSingletons.class, "http-client-response");

private static final boolean alwaysCreateConnectSpan =
Config.get().getBoolean("otel.instrumentation.netty.always-create-connect-span", false);
private static final boolean sslTelemetryEnabled =
Config.get().getBoolean("otel.instrumentation.netty.ssl-telemetry.enabled", false);
private static final boolean connectionTelemetryEnabled;
private static final boolean sslTelemetryEnabled;

static {
Config config = Config.get();
boolean alwaysCreateConnectSpan =
config.getBoolean("otel.instrumentation.netty.always-create-connect-span", false);
connectionTelemetryEnabled =
config.getBoolean(
"otel.instrumentation.netty.connection-telemetry.enabled", alwaysCreateConnectSpan);
sslTelemetryEnabled =
config.getBoolean("otel.instrumentation.netty.ssl-telemetry.enabled", false);
}

private static final Instrumenter<HttpRequestAndChannel, HttpResponse> INSTRUMENTER;
private static final NettyConnectionInstrumenter CONNECTION_INSTRUMENTER;
Expand All @@ -33,7 +42,7 @@ public final class NettyClientSingletons {
static {
NettyClientInstrumenterFactory factory =
new NettyClientInstrumenterFactory(
"io.opentelemetry.netty-4.1", alwaysCreateConnectSpan, sslTelemetryEnabled);
"io.opentelemetry.netty-4.1", connectionTelemetryEnabled, sslTelemetryEnabled);
INSTRUMENTER = factory.createHttpInstrumenter();
CONNECTION_INSTRUMENTER = factory.createConnectionInstrumenter();
SSL_INSTRUMENTER = factory.createSslInstrumenter();
Expand Down
6 changes: 3 additions & 3 deletions instrumentation/reactor/reactor-netty/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Settings for the Reactor Netty instrumentation

| System property | Type | Default | Description |
|---|---|---|---|
| `otel.instrumentation.reactor-netty.always-create-connect-span` | Boolean | `false` | Enable the creation of Connect and DNS spans by default. |
| System property | Type | Default | Description |
|-------------------------------------------------------------------|---------|---------|----------------------------------------------------------|
| `otel.instrumentation.reactor-netty.connection-telemetry.enabled` | Boolean | `false` | Enable the creation of Connect and DNS spans by default. |
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tasks {
includeTestsMatching("ReactorNettyConnectionSpanTest")
}
include("**/ReactorNettyConnectionSpanTest.*")
jvmArgs("-Dotel.instrumentation.netty.always-create-connect-span=true")
jvmArgs("-Dotel.instrumentation.netty.connection-telemetry.enabled=true")
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tasks {
}
include("**/ReactorNettyConnectionSpanTest.*", "**/ReactorNettyClientSslTest.*")
jvmArgs("-Dotel.instrumentation.netty.ssl-telemetry.enabled=true")
jvmArgs("-Dotel.instrumentation.reactor-netty.always-create-connect-span=true")
jvmArgs("-Dotel.instrumentation.reactor-netty.connection-telemetry.enabled=true")
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ public final class ReactorNettySingletons {

private static final String INSTRUMENTATION_NAME = "io.opentelemetry.reactor-netty-1.0";

private static final boolean alwaysCreateConnectSpan =
Config.get()
.getBoolean("otel.instrumentation.reactor-netty.always-create-connect-span", false);
private static final boolean connectionTelemetryEnabled;

static {
Config config = Config.get();
boolean alwaysCreateConnectSpan =
config.getBoolean("otel.instrumentation.reactor-netty.always-create-connect-span", false);
connectionTelemetryEnabled =
config.getBoolean(
"otel.instrumentation.reactor-netty.connection-telemetry.enabled",
alwaysCreateConnectSpan);
}

private static final Instrumenter<HttpClientConfig, HttpClientResponse> INSTRUMENTER;
private static final NettyConnectionInstrumenter CONNECTION_INSTRUMENTER;
Expand All @@ -51,7 +59,7 @@ public final class ReactorNettySingletons {
.newInstrumenter(SpanKindExtractor.alwaysClient());

NettyClientInstrumenterFactory instrumenterFactory =
new NettyClientInstrumenterFactory(INSTRUMENTATION_NAME, alwaysCreateConnectSpan, false);
new NettyClientInstrumenterFactory(INSTRUMENTATION_NAME, connectionTelemetryEnabled, false);
CONNECTION_INSTRUMENTER = instrumenterFactory.createConnectionInstrumenter();
}

Expand Down