-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Description
There're 2 items related with the http request size.
- caddyhttp.computeApproximateRequestSize : cacluates a normal http request from the Content-Lenght header, does not applicable to Transfer-Encoding: chunked bodies or a websocket connection.
- Server.logRequest handle the request size in a special way by just logged it as the
bytes_read
field in the log.
Propose to align the behavior of request size with response size.
- add a method in the
ResponseRecorder
interface.
type ResponseRecorder interface {
http.ResponseWriter
Status() int
Buffer() *bytes.Buffer
Buffered() bool
Size() int
ReqSize() int // propose to export
WriteResponse() error
}
-
export http.request.size as a replacer as well as http.response.size, the latter was exported after the the upstream response received or aborted.
-
update the synmantic of the prometheus metrics request_size_bytes, by
ResponseRecorder.ReqSize()
to including all bytes of an http request, e.g. Transfer-Encoding: chunked bodies or a websocket connection. -
keep the log field bytes_read unchanged to keep backward compatibility.
If this proposal is accepted I'm happy to submit a PR.
Metadata
Metadata
Assignees
Labels
No labels