ykisana commented on code in PR #918:
URL:
https://github.com/apache/spark-kubernetes-operator/pull/918#discussion_r4170984214
##########
spark-operator/src/main/java/org/apache/spark/k8s/operator/metrics/source/KubernetesMetricsInterceptor.java:
##########
@@ -88,6 +88,24 @@ public KubernetesMetricsInterceptor() {
}
}
+ /**
+ * Called before a request is sent, to allow wrapping the consumer of the
response body.
+ *
+ * <p>Wraps the consumer to carry the request start time. fabric8 passes the
returned consumer to
+ * {@link #after(HttpRequest, HttpResponse, AsyncBody.Consumer)}, also for a
request re-sent after
+ * {@link #afterFailure(BasicBuilder, HttpResponse, RequestTags)}, which
computes the response
+ * latency from it. A WebSocket upgrade has no consumer, so no latency is
recorded for it.
+ *
+ * @param consumer the consumer of the response body
+ * @param request the request about to be sent
+ * @return the consumer carrying the request start time
+ */
+ @Override
+ public AsyncBody.Consumer<List<ByteBuffer>> consumer(
+ AsyncBody.Consumer<List<ByteBuffer>> consumer, HttpRequest request) {
+ return new TimedConsumer(consumer, System.nanoTime());
Review Comment:
I think restarting the clock per response makes sense here. Going that path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]