mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
humanize timeToFirstByte
and timeToResponse
upto nanoseconds (#9641)
This commit is contained in:
parent
b11adfa5cd
commit
0cc2ed04f5
@ -22,6 +22,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
@ -166,8 +167,11 @@ func AuditLog(w http.ResponseWriter, r *http.Request, api string, reqClaims map[
|
|||||||
entry.API.Object = object
|
entry.API.Object = object
|
||||||
entry.API.Status = http.StatusText(statusCode)
|
entry.API.Status = http.StatusText(statusCode)
|
||||||
entry.API.StatusCode = statusCode
|
entry.API.StatusCode = statusCode
|
||||||
entry.API.TimeToFirstByte = timeToFirstByte.String()
|
entry.API.TimeToResponse = strconv.FormatInt(timeToResponse.Nanoseconds(), 10) + "ns"
|
||||||
entry.API.TimeToResponse = timeToResponse.String()
|
// ttfb will be recorded only for GET requests, Ignore such cases where ttfb will be empty.
|
||||||
|
if timeToFirstByte != 0 {
|
||||||
|
entry.API.TimeToFirstByte = strconv.FormatInt(timeToFirstByte.Nanoseconds(), 10) + "ns"
|
||||||
|
}
|
||||||
|
|
||||||
// Send audit logs only to http targets.
|
// Send audit logs only to http targets.
|
||||||
for _, t := range AuditTargets {
|
for _, t := range AuditTargets {
|
||||||
|
@ -57,6 +57,9 @@ minio server /mnt/data
|
|||||||
```
|
```
|
||||||
|
|
||||||
Setting this environment variable automatically enables audit logging to the HTTP target. The audit logging is in JSON format as described below.
|
Setting this environment variable automatically enables audit logging to the HTTP target. The audit logging is in JSON format as described below.
|
||||||
|
|
||||||
|
NOTE: `timeToFirstByte` and `timeToResponse` will be expressed in Nanoseconds.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "1",
|
"version": "1",
|
||||||
@ -68,8 +71,8 @@ Setting this environment variable automatically enables audit logging to the HTT
|
|||||||
"object": "hosts",
|
"object": "hosts",
|
||||||
"status": "OK",
|
"status": "OK",
|
||||||
"statusCode": 200,
|
"statusCode": 200,
|
||||||
"timeToFirstByte": "0s",
|
"timeToFirstByte": "366333ns",
|
||||||
"timeToResponse": "2.143308ms"
|
"timeToResponse": "16438202ns"
|
||||||
},
|
},
|
||||||
"remotehost": "127.0.0.1",
|
"remotehost": "127.0.0.1",
|
||||||
"requestID": "15BA4A72C0C70AFC",
|
"requestID": "15BA4A72C0C70AFC",
|
||||||
|
Loading…
Reference in New Issue
Block a user