I would like to use the AsyncHttpClient to make requests and then get timings for that request, much like you see in browser developer tools or HAR files. The timings would include DNS resolution, Connect, SSL, Send, Wait, and Receive times.
Since such functionality is not baked in, I wanted to get some ideas on how to accomplish this. My [rough] thoughts right now are I would need to create my own copy of httpclient.nim, asyncdispatch.nim, and perhaps some other modules, and add timers around the dns lookup, socket connect, ssl negotiation, send and read "events". I'm not sure of the exact architecture of where the timings would be stored (perhaps on the socket).
Any pointers on how this could best be accomplished? Am I missing anything?
connect*(socket: AsyncSocket, address: string, port: Port, af = AF_INET) {.async.}
in asyncnet.nim, it would be pretty trivial for me to add some timers. Is such a thing possible?Is this hypothetical, or does it actually work? If yes, care to post an example at some point? :)
I don't think AOP is a silver bullet, but for certain aspects (pun intended), such as logging, monitoring and access control it is fantastic. We could probably have a module with some helper macros that would provide syntactic features similar to AspectJ.