Skip to content

Commit

Permalink
etcdserver: Fix txn request 'took too long' warnings to use loggable …
Browse files Browse the repository at this point in the history
…request stringer
  • Loading branch information
jpbetz committed Jun 12, 2018
1 parent 4db8b94 commit 0ce2ef1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions etcdserver/etcdserverpb/raft_internal_stringer.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (as *InternalRaftStringer) String() string {
case as.Request.Txn != nil:
return fmt.Sprintf("header:<%s> txn:<%s>",
as.Request.Header.String(),
newLoggableTxnRequest(as.Request.Txn).String(),
NewLoggableTxnRequest(as.Request.Txn).String(),
)
default:
// nothing to redact
Expand All @@ -78,7 +78,7 @@ type txnRequestStringer struct {
Request *TxnRequest
}

func newLoggableTxnRequest(request *TxnRequest) *txnRequestStringer {
func NewLoggableTxnRequest(request *TxnRequest) *txnRequestStringer {
return &txnRequestStringer{request}
}

Expand Down
3 changes: 2 additions & 1 deletion etcdserver/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ func warnOfExpensiveRequest(now time.Time, reqStringer fmt.Stringer, respMsg pro
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
if !isNil(txnResponse) {
var resps []string
Expand Down

0 comments on commit 0ce2ef1

Please sign in to comment.