Skip to content

Commit

Permalink
drop excessive span logs (#1595)
Browse files Browse the repository at this point in the history
* drop excessive span logs

this is removing the `streamBody.byte:` logs which make up the biggest chunk of logs per proxy span.
Errors are still logged with the `streamBody.byte:` log.

Signed-off-by: Hanno Hecker <[email protected]>

* report total number of bytes copied

Signed-off-by: Hanno Hecker <[email protected]>
  • Loading branch information
vetinari authored Nov 6, 2020
1 parent 1163682 commit 52a7275
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,14 @@ func cloneHeaderExcluding(h http.Header, excludeList map[string]bool) http.Heade
func copyStream(to flushedResponseWriter, from io.Reader, tracing *proxyTracing, span ot.Span) error {
b := make([]byte, proxyBufferSize)

var bytesCopied int
defer func() {
tracing.logStreamEvent(span, StreamBodyEvent, fmt.Sprintf("%d", bytesCopied))
}()

for {
l, rerr := from.Read(b)

tracing.logStreamEvent(span, StreamBodyEvent, fmt.Sprintf("%d", l))

if rerr != nil && rerr != io.EOF {
return rerr
}
Expand All @@ -426,6 +429,7 @@ func copyStream(to flushedResponseWriter, from io.Reader, tracing *proxyTracing,
}

to.Flush()
bytesCopied += l
}

if rerr == io.EOF {
Expand Down

0 comments on commit 52a7275

Please sign in to comment.