Avoid constructing URI
Resolves (Reactor Netty optimization was already implemented in
MODIFY
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcRequest.java
instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcRequest.java
@@ -8,7 +8,6 @@ package io.opentelemetry.instrumentation.grpc.v1_6;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import java.net.SocketAddress;
-import java.net.URI;
import javax.annotation.Nullable;
public final class GrpcRequest {
@@ -36,12 +35,16 @@ public final class GrpcRequest {
if (authority == null) {
return;
}
+ int index = authority.indexOf(':');
+ if (index == -1) {
+ logicalHost = authority;
+ } else {
+ logicalHost = authority.substring(0, index);
try {
- URI uri = new URI(null, authority, null, null, null);
- logicalHost = uri.getHost();
- logicalPort = uri.getPort();
- } catch (Throwable e) {
- // do nothing
+ logicalPort = Integer.parseInt(authority.substring(index + 1));
+ } catch (NumberFormatException e) {
+ // ignore
+ }
}
}

Avoid constructing URI (#7293)

Resolves #6568 (Reactor Netty optimization was already implemented in
#6600)