add RetryAttempts to AccessLog in JSON format
This commit is contained in:
parent
23cdb37165
commit
dae7e7a80a
11 changed files with 130 additions and 90 deletions
19
middlewares/accesslog/save_retries.go
Normal file
19
middlewares/accesslog/save_retries.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package accesslog
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// SaveRetries is an implementation of RetryListener that stores RetryAttempts in the LogDataTable.
|
||||
type SaveRetries struct{}
|
||||
|
||||
// Retried implements the RetryListener interface and will be called for each retry that happens.
|
||||
func (s *SaveRetries) Retried(req *http.Request, attempt int) {
|
||||
// it is the request attempt x, but the retry attempt is x-1
|
||||
if attempt > 0 {
|
||||
attempt--
|
||||
}
|
||||
|
||||
table := GetLogDataTable(req)
|
||||
table.Core[RetryAttempts] = attempt
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue