Skip to content
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
4 changes: 2 additions & 2 deletions instrumentation-api-incubator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ tasks {
val testStableSemconv by registering(Test::class) {
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath
jvmArgs("-Dotel.semconv-stability.opt-in=database,code,service.peer")
jvmArgs("-Dotel.semconv-stability.opt-in=database,code,service.peer,rpc")
inputs.dir(jflexOutputDir)
}

val testBothSemconv by registering(Test::class) {
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath
jvmArgs("-Dotel.semconv-stability.opt-in=database/dup,code/dup,service.peer/dup")
jvmArgs("-Dotel.semconv-stability.opt-in=database/dup,code/dup,service.peer/dup,rpc/dup")
inputs.dir(jflexOutputDir)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public final class SemconvStability {
private static final boolean emitOldServicePeerSemconv;
private static final boolean emitStableServicePeerSemconv;

private static final boolean emitOldRpcSemconv;
private static final boolean emitStableRpcSemconv;

static {
boolean oldDatabase = true;
boolean stableDatabase = false;
Expand All @@ -37,6 +40,9 @@ public final class SemconvStability {
boolean oldServicePeer = true;
boolean stableServicePeer = false;

boolean oldRpc = true;
boolean stableRpc = false;

String value = System.getProperty("otel.semconv-stability.opt-in");
if (value == null) {
value = System.getenv("OTEL_SEMCONV_STABILITY_OPT_IN");
Expand Down Expand Up @@ -73,6 +79,15 @@ public final class SemconvStability {
oldServicePeer = true;
stableServicePeer = true;
}

if (values.contains("rpc")) {
oldRpc = false;
stableRpc = true;
}
if (values.contains("rpc/dup")) {
oldRpc = true;
stableRpc = true;
}
}

emitOldDatabaseSemconv = oldDatabase;
Expand All @@ -83,6 +98,9 @@ public final class SemconvStability {

emitOldServicePeerSemconv = oldServicePeer;
emitStableServicePeerSemconv = stableServicePeer;

emitOldRpcSemconv = oldRpc;
emitStableRpcSemconv = stableRpc;
}

public static boolean emitOldDatabaseSemconv() {
Expand Down Expand Up @@ -134,5 +152,25 @@ public static boolean isEmitStableCodeSemconv() {
return emitStableCodeSemconv;
}

public static boolean emitOldRpcSemconv() {
return emitOldRpcSemconv;
}

public static boolean emitStableRpcSemconv() {
return emitStableRpcSemconv;
}

private static final Map<String, String> rpcSystemNameMap = new HashMap<>();

static {
rpcSystemNameMap.put("apache_dubbo", "dubbo");
rpcSystemNameMap.put("connect_rpc", "connectrpc");
}

public static String stableRpcSystemName(String oldRpcSystem) {
String rpcSystemName = rpcSystemNameMap.get(oldRpcSystem);
return rpcSystemName != null ? rpcSystemName : oldRpcSystem;
}

private SemconvStability() {}
}
Loading