add abstract method getRpcSystem()
MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/RpcClientTracer.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/RpcClientTracer.java
@@ -13,4 +13,6 @@ public abstract class RpcClientTracer extends BaseTracer {
protected RpcClientTracer(Tracer tracer) {
super(tracer);
}
+
+ protected abstract String getRpcSystem();
}

MODIFY
instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/GrpcClientTracer.java
instrumentation/grpc-1.5/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_5/client/GrpcClientTracer.java
@@ -23,9 +23,14 @@ public class GrpcClientTracer extends RpcClientTracer {
super(tracer);
}
+ @Override
+ protected String getRpcSystem() {
+ return "grpc";
+ }
+
public Span startSpan(String name) {
SpanBuilder spanBuilder = tracer.spanBuilder(name).setSpanKind(CLIENT);
- spanBuilder.setAttribute(SemanticAttributes.RPC_SYSTEM, "grpc");
+ spanBuilder.setAttribute(SemanticAttributes.RPC_SYSTEM, getRpcSystem());
return spanBuilder.startSpan();
}

MODIFY
instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientTracer.java
instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientTracer.java
@@ -27,7 +27,7 @@ public class RmiClientTracer extends RpcClientTracer {
SpanBuilder spanBuilder =
tracer.spanBuilder(serviceName + "/" + methodName).setSpanKind(CLIENT);
- spanBuilder.setAttribute(SemanticAttributes.RPC_SYSTEM, "java_rmi");
+ spanBuilder.setAttribute(SemanticAttributes.RPC_SYSTEM, getRpcSystem());
spanBuilder.setAttribute(SemanticAttributes.RPC_SERVICE, serviceName);
spanBuilder.setAttribute(SemanticAttributes.RPC_METHOD, methodName);
@@ -38,4 +38,9 @@ public class RmiClientTracer extends RpcClientTracer {
protected String getInstrumentationName() {
return "io.opentelemetry.javaagent.rmi";
}
+
+ @Override
+ protected String getRpcSystem() {
+ return "java_rmi";
+ }
}

add abstract method getRpcSystem() (#2149)