Add putIdleConn to ensure we're done
@@ -53,6 +53,7 @@ func (hct *httpClientTracer) getClientTrace() *httptrace.ClientTrace {
GotFirstResponseByte: hct.gotFirstResponseByte,
ConnectStart: hct.connectStart,
WroteRequest: hct.wroteRequest,
+ PutIdleConn: hct.putIdleConn,
}
}
@@ -100,6 +101,11 @@ func (hct *httpClientTracer) wroteRequest(info httptrace.WroteRequestInfo) {
hct.startSpan("http.finishedWrite")
}
+// putIdleConn is the last thing called, so wrap up any pending spans
+func (hct *httpClientTracer) putIdleConn(err error) {
+ hct.currentSpan.ClientFinish(hct.traceClient)
+}
+
// PostHelper is shared code for POSTing to an endpoint, that consumes JSON, is zlib-
// compressed, that returns 202 on success, that has a small response
// action as a string used for statsd metric names and log messages emitted from
