Huh.  Is this actually not possible? (That is, without modifying net/http 
directly?)

On Friday, January 19, 2018 at 12:47:06 PM UTC-7, Augusto Roman wrote:
>
> I'm interested in tracking total bandwidth on a per-request basis.  It's 
> easy to intercept the ResponseWriter and track the number of bytes sent out 
> for the response body, and it's easy to intercept the Request.Body to count 
> the number of bytes read from the remote source, but both of these ignore 
> the request framing and the headers.
>
> I realize that I could also make my own net.Listener and wrap the net.Conn 
> to count the number of bytes read/written there, but how do I associate 
> that with a given request?  Especially with HTTP/2 long-lived connections, 
> a net.Conn may be used for a number of interleaved requests.
>
> In particular, I'm interested in doing bandwidth accounting for multiple 
> hosted services, so I want accurate per-service usage numbers.
>
> - Augusto
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to