functional/tester: improve logging

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
release-3.4
Gyuho Lee 2018-04-09 11:28:11 -07:00
parent 7facfde6fd
commit ecadb0fdf7
3 changed files with 25 additions and 9 deletions

View File

@ -152,7 +152,7 @@ func (clus *Cluster) doRound() error {
fcase := fa.FailureCase() fcase := fa.FailureCase()
if fcase != rpcpb.FailureCase_NO_FAIL_WITH_NO_STRESS_FOR_LIVENESS { if fcase != rpcpb.FailureCase_NO_FAIL_WITH_NO_STRESS_FOR_LIVENESS {
clus.lg.Info( clus.lg.Info(
"stresser START", "stress START",
zap.Int("round", clus.rd), zap.Int("round", clus.rd),
zap.Int("case", clus.cs), zap.Int("case", clus.cs),
zap.Int("case-total", len(clus.failures)), zap.Int("case-total", len(clus.failures)),
@ -190,7 +190,13 @@ func (clus *Cluster) doRound() error {
} }
if stressStarted { if stressStarted {
clus.lg.Info("stresser PAUSE") clus.lg.Info(
"stress PAUSE",
zap.Int("round", clus.rd),
zap.Int("case", clus.cs),
zap.Int("case-total", len(clus.failures)),
zap.String("desc", fa.Desc()),
)
ems := clus.stresser.Pause() ems := clus.stresser.Pause()
if fcase == rpcpb.FailureCase_NO_FAIL_WITH_STRESS && len(ems) > 0 { if fcase == rpcpb.FailureCase_NO_FAIL_WITH_STRESS && len(ems) > 0 {
ess := make([]string, 0, len(ems)) ess := make([]string, 0, len(ems))
@ -213,12 +219,24 @@ func (clus *Cluster) doRound() error {
} }
} }
clus.lg.Info("health check START") clus.lg.Info(
"health check START",
zap.Int("round", clus.rd),
zap.Int("case", clus.cs),
zap.Int("case-total", len(clus.failures)),
zap.String("desc", fa.Desc()),
)
if err := clus.WaitHealth(); err != nil { if err := clus.WaitHealth(); err != nil {
return fmt.Errorf("wait full health error: %v", err) return fmt.Errorf("wait full health error: %v", err)
} }
clus.lg.Info("consistency check START") clus.lg.Info(
"consistency check START",
zap.Int("round", clus.rd),
zap.Int("case", clus.cs),
zap.Int("case-total", len(clus.failures)),
zap.String("desc", fa.Desc()),
)
if err := clus.checkConsistency(); err != nil { if err := clus.checkConsistency(); err != nil {
return fmt.Errorf("consistency check error (%v)", err) return fmt.Errorf("consistency check error (%v)", err)
} }

View File

@ -251,8 +251,6 @@ func (f *failureUntilSnapshot) Inject(clus *Cluster) error {
now := time.Now() now := time.Now()
clus.lg.Info( clus.lg.Info(
"trigger snapshot START", "trigger snapshot START",
zap.Int("round", clus.rd),
zap.Int("case", clus.cs),
zap.String("desc", f.Desc()), zap.String("desc", f.Desc()),
zap.Int64("etcd-snapshot-count", snapshotCount), zap.Int64("etcd-snapshot-count", snapshotCount),
) )
@ -283,8 +281,6 @@ func (f *failureUntilSnapshot) Inject(clus *Cluster) error {
if diff > snapshotCount { if diff > snapshotCount {
clus.lg.Info( clus.lg.Info(
"trigger snapshot PASS", "trigger snapshot PASS",
zap.Int("round", clus.rd),
zap.Int("case", clus.cs),
zap.Int("retries", i), zap.Int("retries", i),
zap.String("desc", f.Desc()), zap.String("desc", f.Desc()),
zap.Int64("committed-entries", diff), zap.Int64("committed-entries", diff),

View File

@ -18,6 +18,7 @@ import (
"context" "context"
"fmt" "fmt"
"math/rand" "math/rand"
"reflect"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
@ -158,9 +159,10 @@ func (s *keyStresser) run() {
return return
default: default:
s.lg.Warn( s.lg.Warn(
"stress stopped", "stress run exiting",
zap.String("stress-type", s.stype.String()), zap.String("stress-type", s.stype.String()),
zap.String("endpoint", s.m.EtcdClientEndpoint), zap.String("endpoint", s.m.EtcdClientEndpoint),
zap.String("error-type", reflect.TypeOf(err).String()),
zap.Error(err), zap.Error(err),
) )
return return