Rename two props to otel.instrumentation.common.*
MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtils.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtils.java
@@ -20,12 +20,13 @@ public final class NetPeerUtils {
public static final NetPeerUtils INSTANCE = new NetPeerUtils(Config.get());
- private final Map<String, String> endpointPeerServiceMapping;
+ private final Map<String, String> peerServiceMapping;
// visible for testing
NetPeerUtils(Config config) {
- this.endpointPeerServiceMapping =
- Collections.unmodifiableMap(config.getMapProperty("otel.endpoint.peer.service.mapping"));
+ this.peerServiceMapping =
+ Collections.unmodifiableMap(
+ config.getMapProperty("otel.instrumentation.common.peer-service-mapping"));
}
public void setNetPeer(Span span, @Nullable InetSocketAddress remoteConnection) {
@@ -83,9 +84,9 @@ public final class NetPeerUtils {
span.setAttribute(SemanticAttributes.NET_PEER_IP, peerIp);
}
- String peerService = mapToPeer(peerName);
+ String peerService = mapToPeerService(peerName);
if (peerService == null) {
- peerService = mapToPeer(peerIp);
+ peerService = mapToPeerService(peerIp);
}
if (peerService != null) {
span.setAttribute(SemanticAttributes.PEER_SERVICE, peerService);
@@ -95,12 +96,12 @@ public final class NetPeerUtils {
}
}
- private String mapToPeer(String endpoint) {
+ private String mapToPeerService(String endpoint) {
if (endpoint == null) {
return null;
}
- return endpointPeerServiceMapping.get(endpoint);
+ return peerServiceMapping.get(endpoint);
}
/**

MODIFY
instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/HttpClientTracerTest.groovy
instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/HttpClientTracerTest.groovy
package io.opentelemetry.instrumentation.api.tracer
import io.opentelemetry.api.trace.Span
-import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
import io.opentelemetry.context.propagation.TextMapSetter
import io.opentelemetry.instrumentation.api.config.Config
import io.opentelemetry.instrumentation.api.config.ConfigBuilder
+import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
import spock.lang.Shared
class HttpClientTracerTest extends BaseTracerTest {
def setupSpec() {
Config.INSTANCE = new ConfigBuilder().readProperties([
- "otel.endpoint.peer.service.mapping": "1.2.3.4=catservice,dogs.com=dogsservice"
+ "otel.instrumentation.common.peer-service-mapping": "1.2.3.4=catservice,dogs.com=dogsservice"
]).build()
}

MODIFY
instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtilsTest.groovy
instrumentation-api/src/test/groovy/io/opentelemetry/instrumentation/api/tracer/utils/NetPeerUtilsTest.groovy
package io.opentelemetry.instrumentation.api.tracer.utils
-import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
import io.opentelemetry.instrumentation.api.config.Config
import io.opentelemetry.instrumentation.api.config.ConfigBuilder
import io.opentelemetry.instrumentation.api.tracer.BaseTracerTest
+import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
class NetPeerUtilsTest extends BaseTracerTest {
@@ -40,7 +40,7 @@ class NetPeerUtilsTest extends BaseTracerTest {
def "test setAttributes with mapped peer"() {
setup:
def config = new ConfigBuilder().readProperties([
- "otel.endpoint.peer.service.mapping": "1.2.3.4=catservice,dogs.com=dogsservice"
+ "otel.instrumentation.common.peer-service-mapping": "1.2.3.4=catservice,dogs.com=dogsservice"
]).build()
def utils = new NetPeerUtils(config)

MODIFY
javaagent-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/db/StatementSanitizationConfig.java
javaagent-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/db/StatementSanitizationConfig.java
@@ -11,7 +11,8 @@ import io.opentelemetry.instrumentation.api.config.Config;
final class StatementSanitizationConfig {
private static final boolean STATEMENT_SANITIZATION_ENABLED =
- Config.get().getBooleanProperty("otel.instrumentation.db-statement-sanitizer.enabled", true);
+ Config.get()
+ .getBooleanProperty("otel.instrumentation.common.db-statement-sanitizer.enabled", true);
static boolean isStatementSanitizationEnabled() {
return STATEMENT_SANITIZATION_ENABLED;

MODIFY
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java
@@ -57,7 +57,6 @@ public class OpenTelemetryInstaller implements ComponentInstaller {
(key, value) -> {
String keyStr = (String) key;
if (!environmentProperties.containsKey(key)
- && !keyStr.equals("otel.endpoint.peer.service.mapping")
&& keyStr.startsWith("otel.")
&& !keyStr.startsWith("otel.instrumentation")) {
System.setProperty(keyStr, (String) value);

Rename two props to otel.instrumentation.common.* (#2457)