Skip to content

Commit

Permalink
fix: placement of context
Browse files Browse the repository at this point in the history
  • Loading branch information
sswastioyono18 committed Aug 31, 2024
1 parent 16d6d4a commit 8187018
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ func (tw traceware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Add(tw.traceResponseHeaderKey, span.SpanContext().TraceID().String())
}

r2 := r.WithContext(ctx)
rrw := getRRW(w)
defer putRRW(rrw)

ctx = context.WithValue(ctx, "trace-id", span.SpanContext().TraceID().String())

r2 := r.WithContext(ctx)

tw.handler.ServeHTTP(rrw.writer, r2)
if rrw.status > 0 {
span.SetAttributes(semconv.HTTPStatusCode(rrw.status))
Expand Down

0 comments on commit 8187018

Please # to comment.