Skip to content

Commit

Permalink
Rename the non-exposed field "count" to "size"
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain Rabot authored and traefiker committed Jan 7, 2020
1 parent da3d814 commit 377c219
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkg/middlewares/accesslog/capture_request_reader.go
Expand Up @@ -3,8 +3,10 @@ package accesslog
import "io"

type captureRequestReader struct {
// source ReadCloser from where the request body is read.
source io.ReadCloser
count int64
// count Counts the number of bytes read (when captureRequestReader.Read is called).
count int64
}

func (r *captureRequestReader) Read(p []byte) (int, error) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/middlewares/accesslog/logdata.go
Expand Up @@ -129,5 +129,6 @@ type downstreamResponse struct {

type request struct {
headers http.Header
count int64
// Request body size
size int64
}
4 changes: 2 additions & 2 deletions pkg/middlewares/accesslog/logger.go
Expand Up @@ -214,7 +214,7 @@ func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http
size: crw.Size(),
}
if crr != nil {
logDataTable.Request.count = crr.count
logDataTable.Request.size = crr.count
}

if h.config.BufferingSize > 0 {
Expand Down Expand Up @@ -280,7 +280,7 @@ func (h *Handler) logTheRoundTrip(logDataTable *LogData) {
retryAttempts = 0
}
core[RetryAttempts] = retryAttempts
core[RequestContentSize] = logDataTable.Request.count
core[RequestContentSize] = logDataTable.Request.size

status := logDataTable.DownstreamResponse.status
core[DownstreamStatus] = status
Expand Down

0 comments on commit 377c219

Please sign in to comment.