Add the duration and start time to logged completed requests. (#13682)
This commit is contained in:
parent
4230749d9e
commit
279e0d4332
|
@ -0,0 +1,3 @@
|
|||
```release-note:improvement
|
||||
core: Add duration and start_time to completed requests log entries
|
||||
```
|
|
@ -3044,7 +3044,12 @@ func (c *Core) LogCompletedRequests(reqID string, statusCode int) {
|
|||
|
||||
// there is only one writer to this map, so skip checking for errors
|
||||
reqData := v.(InFlightReqData)
|
||||
c.logger.Log(logLevel, "completed_request", "client_id", reqData.ClientID, "client_address", reqData.ClientRemoteAddr, "status_code", statusCode, "request_path", reqData.ReqPath, "request_method", reqData.Method)
|
||||
c.logger.Log(logLevel, "completed_request",
|
||||
"start_time", reqData.StartTime.Format(time.RFC3339),
|
||||
"duration", fmt.Sprintf("%dms", time.Now().Sub(reqData.StartTime).Milliseconds()),
|
||||
"client_id", reqData.ClientID,
|
||||
"client_address", reqData.ClientRemoteAddr, "status_code", statusCode, "request_path", reqData.ReqPath,
|
||||
"request_method", reqData.Method)
|
||||
}
|
||||
|
||||
func (c *Core) ReloadLogRequestsLevel() {
|
||||
|
|
Loading…
Reference in New Issue