Closed rohan2817 closed 8 years ago
Hugo logs only the time it takes for a method to execute. Because Retrofit uses background threads to asynchronously handle the HTTP call the enclosing method returns very quickly. For anything like this, not just Retrofit, you need to handle measuring timing yourself or use some other means. Retrofit, for example, can use OkHttp which has a logging-interceptor that can log the time between request and response.
@JakeWharton I want to calculate the retrofit request time and I find there are two headers exist: "OkHttp-Sent-Millis", "OkHttp-Received-Millis" I want to use it ,but sometimes it's gone .Do you have some idears?
It's easy you can find the receivedResponseAtMillis() and the sendResponseAtMillis() in the raw() part of the response and then you can calculate the difference
response.raw().receivedResponseAtMillis()
I was trying to log method execution time for a method which makes an API request using Retrofit. I wanted it to include the response time taken by the request into method execution time. Is there any workaround for this ?