Skip to content

Commit

Permalink
Fixes stream headers end tracing event (#1867)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored Sep 29, 2021
1 parent a9ab81b commit cbff642
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,6 @@ func (p *Proxy) serveResponse(ctx *context) {
start := time.Now()
p.tracing.logStreamEvent(ctx.proxySpan, StreamHeadersEvent, StartEvent)
copyHeader(ctx.responseWriter.Header(), ctx.response.Header)
p.tracing.logStreamEvent(ctx.proxySpan, StreamHeadersEvent, EndEvent)

if err := ctx.Request().Context().Err(); err != nil {
// deadline exceeded or canceled in stdlib, client closed request
Expand All @@ -1207,6 +1206,8 @@ func (p *Proxy) serveResponse(ctx *context) {

ctx.responseWriter.WriteHeader(ctx.response.StatusCode)
ctx.responseWriter.Flush()
p.tracing.logStreamEvent(ctx.proxySpan, StreamHeadersEvent, EndEvent)

n, err := copyStream(ctx.responseWriter, ctx.response.Body)
p.tracing.logStreamEvent(ctx.proxySpan, StreamBodyEvent, strconv.FormatInt(n, 10))
if err != nil {
Expand Down

0 comments on commit cbff642

Please sign in to comment.