Skip to content

Commit 0db6fec

Browse files
committed
Fix unknownService test for old semconv mode
- getMethod() now returns fullMethodName when no slash separator exists - Remove RPC_METHOD_ORIGINAL assertion (stable semconv only attribute)
1 parent 89ef4f4 commit 0db6fec

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcRpcAttributesGetter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public String getMethod(GrpcRequest request) {
4141
String fullMethodName = request.getFullMethodName();
4242
int slashIndex = fullMethodName.lastIndexOf('/');
4343
if (slashIndex == -1) {
44-
return null;
44+
return fullMethodName;
4545
}
4646
return fullMethodName.substring(slashIndex + 1);
4747
}

instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static io.opentelemetry.semconv.incubating.MessageIncubatingAttributes.MESSAGE_TYPE;
2121
import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE;
2222
import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD;
23-
import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_METHOD_ORIGINAL;
2423
import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SERVICE;
2524
import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM;
2625
import static java.util.Collections.singletonList;
@@ -718,7 +717,6 @@ void unknownService() throws Exception {
718717
.hasAttributesSatisfyingExactly(
719718
equalTo(RPC_SYSTEM, "grpc"),
720719
equalTo(RPC_METHOD, "_OTHER"),
721-
equalTo(RPC_METHOD_ORIGINAL, "example.Greeter/SayHello"),
722720
equalTo(
723721
RPC_GRPC_STATUS_CODE,
724722
(long) Status.Code.UNIMPLEMENTED.value()))));

0 commit comments

Comments
 (0)