Skip to content

Commit

Permalink
Add 'total' time to the timings
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Schneider committed Jan 14, 2023
1 parent 4eecf2d commit 0602e80
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions logging/upstream_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,16 @@ func (u *UpstreamLog) RoundTrip(req *http.Request) (*http.Response, error) {
timingResults := Fields{
"total": RoundMS(rtDone.Sub(rtStart)),
}
serverTimingsVal[fmt.Sprintf(`%s_%s`, serverTimingsKey, "total")] = fmt.Sprintf(`dur=%.3f`, timingResults["total"])

timingsMu.RLock()
for f, v := range timings { // clone
timingResults[f] = v

serverTimingsVal[fmt.Sprintf(`%s_%s`, serverTimingsKey, f)] = fmt.Sprintf(`dur=%.3f`, v)
}
timingsMu.RUnlock()

fields["timings"] = timingResults
//timings["ttlb"] = RoundMS(rtDone.Sub(timeTTFB)) // TODO: depends on stream or buffer

Expand Down

0 comments on commit 0602e80

Please sign in to comment.