etcdserver: Fix txn request 'took too long' warnings to use loggable request stringer

This commit is contained in:
Joe Betz 2018-06-11 16:58:48 -07:00 committed by jpbetz
parent 23c5c71426
commit e90934ec71
2 changed files with 4 additions and 3 deletions

View File

@ -64,7 +64,7 @@ func (as *InternalRaftStringer) String() string {
case as.Request.Txn != nil: case as.Request.Txn != nil:
return fmt.Sprintf("header:<%s> txn:<%s>", return fmt.Sprintf("header:<%s> txn:<%s>",
as.Request.Header.String(), as.Request.Header.String(),
newLoggableTxnRequest(as.Request.Txn).String(), NewLoggableTxnRequest(as.Request.Txn).String(),
) )
default: default:
// nothing to redact // nothing to redact
@ -78,7 +78,7 @@ type txnRequestStringer struct {
Request *TxnRequest Request *TxnRequest
} }
func newLoggableTxnRequest(request *TxnRequest) *txnRequestStringer { func NewLoggableTxnRequest(request *TxnRequest) *txnRequestStringer {
return &txnRequestStringer{request} return &txnRequestStringer{request}
} }

View File

@ -109,7 +109,8 @@ func warnOfExpensiveRequest(now time.Time, reqStringer fmt.Stringer, respMsg pro
warnOfExpensiveGenericRequest(now, reqStringer, "", resp, err) warnOfExpensiveGenericRequest(now, reqStringer, "", resp, err)
} }
func warnOfExpensiveReadOnlyTxnRequest(now time.Time, reqStringer fmt.Stringer, txnResponse *pb.TxnResponse, err error) { func warnOfExpensiveReadOnlyTxnRequest(now time.Time, r *pb.TxnRequest, txnResponse *pb.TxnResponse, err error) {
reqStringer := pb.NewLoggableTxnRequest(r)
var resp string var resp string
if !isNil(txnResponse) { if !isNil(txnResponse) {
var resps []string var resps []string