mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: Fix txn request 'took too long' warnings to use loggable request stringer
This commit is contained in:
parent
59aec1fa31
commit
a6fad51603
@ -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}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ func (as *requestOpStringer) String() string {
|
|||||||
case *RequestOp_RequestPut:
|
case *RequestOp_RequestPut:
|
||||||
return fmt.Sprintf("request_put:<%s>", newLoggablePutRequest(op.RequestPut).String())
|
return fmt.Sprintf("request_put:<%s>", newLoggablePutRequest(op.RequestPut).String())
|
||||||
case *RequestOp_RequestTxn:
|
case *RequestOp_RequestTxn:
|
||||||
return fmt.Sprintf("request_txn:<%s>", newLoggableTxnRequest(op.RequestTxn).String())
|
return fmt.Sprintf("request_txn:<%s>", NewLoggableTxnRequest(op.RequestTxn).String())
|
||||||
default:
|
default:
|
||||||
// nothing to redact
|
// nothing to redact
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,8 @@ func warnOfExpensiveRequest(lg *zap.Logger, now time.Time, reqStringer fmt.Strin
|
|||||||
warnOfExpensiveGenericRequest(lg, now, reqStringer, "", resp, err)
|
warnOfExpensiveGenericRequest(lg, now, reqStringer, "", resp, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func warnOfExpensiveReadOnlyTxnRequest(lg *zap.Logger, now time.Time, reqStringer fmt.Stringer, txnResponse *pb.TxnResponse, err error) {
|
func warnOfExpensiveReadOnlyTxnRequest(lg *zap.Logger, 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user