Make use of pre-existing context in InstrumentRoundTripperTrace

Fixes #580

Signed-off-by: beorn7 <bjoern@rabenste.in>
This commit is contained in:
beorn7 2019-05-16 11:03:34 +02:00
parent 6c520f6aca
commit bc54582c5e
1 changed files with 1 additions and 2 deletions

View File

@ -14,7 +14,6 @@
package promhttp
import (
"context"
"crypto/tls"
"net/http"
"net/http/httptrace"
@ -213,7 +212,7 @@ func InstrumentRoundTripperTrace(it *InstrumentTrace, next http.RoundTripper) Ro
}
},
}
r = r.WithContext(httptrace.WithClientTrace(context.Background(), trace))
r = r.WithContext(httptrace.WithClientTrace(r.Context(), trace))
return next.RoundTrip(r)
})