Add TTFB to all APIs and enable for responses without body (#20479)

Add TTFB for all requests in metrics-v3 in addition to the existing
GetObject. Also for the requests that do not return a body in the
response, calculate TTFB as the HTTP status code and the headers are
sent.
This commit is contained in:
Anis Eleuch
2024-09-24 18:12:18 +01:00
committed by Harshavardhana
parent f6f0807c86
commit 2b0156b1fc
5 changed files with 22 additions and 10 deletions

View File

@@ -100,7 +100,7 @@ func AuditLog(ctx context.Context, w http.ResponseWriter, r *http.Request, reqCl
outputBytes = int64(tc.ResponseRecorder.Size())
headerBytes = int64(tc.ResponseRecorder.HeaderSize())
timeToResponse = time.Now().UTC().Sub(tc.ResponseRecorder.StartTime)
timeToFirstByte = tc.ResponseRecorder.TimeToFirstByte
timeToFirstByte = tc.ResponseRecorder.TTFB()
}
entry.AccessKey = reqInfo.Cred.AccessKey