diff --git a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java index 25b68110c220e..3817970a2d4e8 100644 --- a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java +++ b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java @@ -2,6 +2,7 @@ import io.netty.handler.codec.http.LastHttpContent; import io.netty.handler.codec.http.multipart.InterfaceHttpData; +import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; import io.smallrye.stork.Stork; import io.smallrye.stork.api.ServiceInstance; @@ -408,7 +409,7 @@ public Uni createRequest(RestClientRequestContext state) { try { serviceInstance = Stork.getInstance() .getService(serviceName) - .selectInstanceAndRecordStart(true); + .selectInstanceAndRecordStart(shouldMeasureTime(state)); } catch (Throwable e) { log.error("Error selecting service instance for serviceName: " + serviceName, e); return Uni.createFrom().failure(e); @@ -416,7 +417,7 @@ public Uni createRequest(RestClientRequestContext state) { requestOptions = serviceInstance.onItem().transform(new Function<>() { @Override public RequestOptions apply(ServiceInstance serviceInstance) { - if (serviceInstance.gatherStatistics()) { + if (serviceInstance.gatherStatistics() && shouldMeasureTime(state)) { state.setCallStatsCollector(serviceInstance); } return new RequestOptions() @@ -457,6 +458,10 @@ public Uni apply(RequestOptions options) { }); } + private boolean shouldMeasureTime(RestClientRequestContext state) { + return !Multi.class.equals(state.getResponseType().getRawType()); + } + private int getPort(boolean isHttps, int specifiedPort) { return specifiedPort != -1 ? specifiedPort : defaultPort(isHttps); }