Peter Toth created SPARK-59928:
----------------------------------

             Summary: Fix `kubernetes.client.http.response.latency.nanos` 
always recording about zero
                 Key: SPARK-59928
                 URL: https://issues.apache.org/jira/browse/SPARK-59928
             Project: Spark
          Issue Type: Sub-task
          Components: Kubernetes
    Affects Versions: kubernetes-operator-1.0.0
            Reporter: Peter Toth


- {{KubernetesMetricsInterceptor.after}} calls 
{{updateResponseMetrics(response, System.nanoTime())}}. 
{{updateResponseMetrics}} then computes the latency as {{System.nanoTime() - 
startTimeNanos}}. So the histogram only records the time between two adjacent 
{{nanoTime()}} calls.
- In a probe, the mock server answered a GET after 500 ms (814 ms wall time), 
and the histogram recorded 5167 ns.
- This started with the move from the OkHttp interceptor to the fabric8 
{{Interceptor}} in SPARK-53647 / SPARK-53648, first released in 0.5.0. OkHttp's 
{{intercept(chain)}} took the start time before {{chain.proceed}}. The fabric8 
{{Interceptor}} has no single call that wraps the request, so the start time 
has to be carried from {{consumer}} (which gets the same request object as 
{{after}}) to {{after}}.

Found while reviewing 
https://github.com/apache/spark-kubernetes-operator/pull/917.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to