etcdserver: remove capnslog (#11611)
remove capnslog from etcdserver pkg, except etcdserver/api.
This commit is contained in:
@ -140,25 +140,15 @@ func warnOfExpensiveReadOnlyRangeRequest(lg *zap.Logger, now time.Time, reqStrin
|
||||
func warnOfExpensiveGenericRequest(lg *zap.Logger, now time.Time, reqStringer fmt.Stringer, prefix string, resp string, err error) {
|
||||
d := time.Since(now)
|
||||
if d > warnApplyDuration {
|
||||
if lg != nil {
|
||||
lg.Warn(
|
||||
"apply request took too long",
|
||||
zap.Duration("took", d),
|
||||
zap.Duration("expected-duration", warnApplyDuration),
|
||||
zap.String("prefix", prefix),
|
||||
zap.String("request", reqStringer.String()),
|
||||
zap.String("response", resp),
|
||||
zap.Error(err),
|
||||
)
|
||||
} else {
|
||||
var result string
|
||||
if err != nil {
|
||||
result = fmt.Sprintf("error:%v", err)
|
||||
} else {
|
||||
result = resp
|
||||
}
|
||||
plog.Warningf("%srequest %q with result %q took too long (%v) to execute", prefix, reqStringer.String(), result, d)
|
||||
}
|
||||
lg.Warn(
|
||||
"apply request took too long",
|
||||
zap.Duration("took", d),
|
||||
zap.Duration("expected-duration", warnApplyDuration),
|
||||
zap.String("prefix", prefix),
|
||||
zap.String("request", reqStringer.String()),
|
||||
zap.String("response", resp),
|
||||
zap.Error(err),
|
||||
)
|
||||
slowApplies.Inc()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user