add RetryAttempts to AccessLog in JSON format

This commit is contained in:
Marco Jantke 2017-08-28 12:50:02 +02:00 committed by Traefiker
parent 23cdb37165
commit dae7e7a80a
11 changed files with 130 additions and 90 deletions

View file

@ -33,6 +33,7 @@ var (
testMethod = "POST"
testReferer = "testReferer"
testUserAgent = "testUserAgent"
testRetryAttempts = 2
)
func TestLoggerCLF(t *testing.T) {
@ -91,6 +92,7 @@ func TestLoggerJSON(t *testing.T) {
RequestCount,
Duration,
Overhead,
RetryAttempts,
"time",
"StartLocal",
"StartUTC",
@ -150,6 +152,8 @@ func TestLoggerJSON(t *testing.T) {
assertCount++
assert.NotZero(t, jsonData[Overhead].(float64))
assertCount++
assert.Equal(t, float64(testRetryAttempts), jsonData[RetryAttempts].(float64))
assertCount++
assert.NotEqual(t, "", jsonData["time"].(string))
assertCount++
assert.NotEqual(t, "", jsonData["StartLocal"].(string))
@ -275,4 +279,5 @@ func logWriterTestHandlerFunc(rw http.ResponseWriter, r *http.Request) {
logDataTable.Core[BackendURL] = testBackendName
logDataTable.Core[OriginStatus] = testStatus
logDataTable.Core[OriginContentSize] = testContentSize
logDataTable.Core[RetryAttempts] = testRetryAttempts
}