You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to add a metric that measures the total size of the request in bytes on the wire as received by the server(headers + body + trailer). This does not seem possible at the moment.
I propose we add a Size field to http.Request that behaves similar to the Trailer field.
typeRequeststruct {
// Size is the total bytes of the Request including headers, body and// trailers. // // For server requests Size is initially zero. While the handler is // reading from Body, it must not reference Size. After reading from Body // returns EOF, Size can be read and will contain the total bytes of the// Request including headers, body and trailers. //// For client requests Size is always set to zero. Sizeint64
}
The text was updated successfully, but these errors were encountered:
I've had to deal with implementing this for logging several times. Everybody means something different in how exactly you calculate this and anything we add is going to be insufficient for somebody else. Do you count http2 frame sizes? Or only the payload size? Before or after compression? Before or after whitespace normalization? Before or after header folding? etc.
If anything, this can be addressed in the httptrace package. Currently httptrace only has ClientTrace, but in #18997 people are discussing ServerTrace hooks. That's the right place for low-level disgusting detail where we don't care about godoc pollution. And we could add numbers and hooks for all the possible things you might care about.
I'm trying to add a metric that measures the total size of the request in bytes on the wire as received by the server(headers + body + trailer). This does not seem possible at the moment.
I propose we add a Size field to http.Request that behaves similar to the Trailer field.
The text was updated successfully, but these errors were encountered: