Skip to content

Commit

Permalink
get cmd before done
Browse files Browse the repository at this point in the history
  • Loading branch information
lintanghui committed Mar 21, 2019
1 parent b41826d commit 5e36625
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions proxy/proto/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,17 @@ func (mp *msgPipe) pipe() {
msg := mp.batch[i]
msg.WithError(err) // NOTE: maybe err is nil
if prom.On {
cmd := msg.Request().CmdString()
duration := msg.RemoteDur()
msg.Done()
if err != nil {
prom.ErrIncr(nc.Cluster(), nc.Addr(), msg.Request().CmdString(), perr.Cause(err).Error())
prom.ErrIncr(nc.Cluster(), nc.Addr(), cmd, perr.Cause(err).Error())
} else {
prom.HandleTime(nc.Cluster(), nc.Addr(), msg.Request().CmdString(), int64(msg.RemoteDur()/time.Microsecond))
prom.HandleTime(nc.Cluster(), nc.Addr(), cmd, int64(duration/time.Microsecond))
}
} else {
msg.Done()
}
msg.Done()
}
mp.count = 0
if err != nil {
Expand Down

0 comments on commit 5e36625

Please sign in to comment.