fix(tracex): use HTTP transaction end time for t (#925)

This issue was mentioned in https://github.com/ooni/probe/issues/2137.

I double checked the spec and this field is not mentioned. We will
update it when we do https://github.com/ooni/probe/issues/2238.
This commit is contained in:
Simone Basso
2022-09-02 15:10:57 +02:00
committed by GitHub
parent 1153850aca
commit 535be51cd1
+5 -6
View File
@@ -62,10 +62,6 @@ type HTTPTransportSaver struct {
// body snapshot that we collect along with the HTTP round trip.
func (txp *HTTPTransportSaver) RoundTrip(req *http.Request) (*http.Response, error) {
// TODO(bassosimone): we're currently using the started time for
// the transaction done event, which contrasts with what we do for
// every other event. What does the spec say?
started := time.Now()
txp.Saver.Write(&EventHTTPTransactionStart{&EventValue{
HTTPRequestHeaders: httpCloneRequestHeaders(req),
@@ -79,9 +75,12 @@ func (txp *HTTPTransportSaver) RoundTrip(req *http.Request) (*http.Response, err
HTTPMethod: req.Method,
HTTPURL: req.URL.String(),
Transport: txp.HTTPTransport.Network(),
Time: started,
Time: time.Time{}, // see below
}
defer txp.Saver.Write(&EventHTTPTransactionDone{ev})
defer func() {
ev.Time = time.Now() // https://github.com/ooni/probe/issues/2137
txp.Saver.Write(&EventHTTPTransactionDone{ev})
}()
resp, err := txp.HTTPTransport.RoundTrip(req)