-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature - Request Timelines #1054
Conversation
cc @jshier, @kcharwood, @kylef for review |
I'll add a section to the README about this once everyone is on board that this is a good set of changes to put in. |
@@ -77,6 +88,7 @@ extension Response: CustomDebugStringConvertible { | |||
output.append(response != nil ? "[Response]: \(response!)" : "[Response]: nil") | |||
output.append("[Data]: \(data?.length ?? 0) bytes") | |||
output.append("[Result]: \(result.debugDescription)") | |||
output.append("[Timeline]: \(timeline.debugDescription)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a new line between this and the [Result]
output. Perhaps there's an extra newline in result.debugDescription
? Trivial, but didn't quite match the rest of the output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah bummer. I'll check it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is possible if the value stored in the result contains newlines. There's nothing to fix here.
Wow Dude @cnoon , this is much more complete than what I had in mind, thank you. |
Thanks @alimoeeny! It was definitely fun to put together. |
👍 @alimoeeny I do logging in my custom |
thanks @jshier I think I'd do the same. |
These changes started with me experimenting with the ideas in #1029, then became something pretty awesome!
This PR adds the ability for Alamofire to track the timings of a
Request
throughout it's entire lifecycle with virtually zero overhead. TheTimeline
object stores all the timing info about theRequest
and is delivered as part of theResponse
object. The timings are collected at various points throughout the lifecycle of the request.Alamofire can now report the latency, request duration and total duration of any
Request
. I also addedCustomStringConvertible
andCustomDebugStringConvertible
conformance to theTimeline
to make it really easy to print out the info.