private Long calculateRequestLatency ( TimingInfo timingInfo ) { if ( timingInfo == null ) { return null ; } TimingInfo httpClientSendRequestTime = timingInfo . getLastSubMeasurement ( AWSRequestMetrics . Field . HttpClientSendRequestTime . name ( ) ) ; TimingInfo httpClientReceiveResponseTime = timingInfo . getLastSubMeasurement ( AWSRequestMetrics . Field . HttpClientReceiveResponseTime . name ( ) ) ; if ( httpClientSendRequestTime != null && httpClientSendRequestTime . getTimeTakenMillisIfKnown ( ) != null && httpClientReceiveResponseTime != null && httpClientReceiveResponseTime . getTimeTakenMillisIfKnown ( ) != null ) { return httpClientSendRequestTime . getTimeTakenMillisIfKnown ( ) . longValue ( ) + httpClientReceiveResponseTime . getTimeTakenMillisIfKnown ( ) . longValue ( ) ; } return null ; }
Calculate the request latency . RequestLatency = httpClientSendRequestTime + HttpClientReceiveResponseTime