Add rocksmq produce slowly hint log (#12156)

Signed-off-by: fishpenguin <kun.yu@zilliz.com>
This commit is contained in:
yukun 2021-11-21 15:33:13 +08:00 committed by GitHub
parent 116a503b4a
commit ac175b6f00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -424,9 +424,6 @@ func (rmq *rocksmq) Produce(topicName string, messages []ProducerMessage) ([]Uni
defer lock.Unlock()
getLockTime := time.Since(start).Milliseconds()
if getLockTime > 200 {
log.Warn("rocksmq produce get lock slow", zap.Int64("elapse", getLockTime))
}
msgLen := len(messages)
idStart, idEnd, err := rmq.idAllocator.Alloc(uint32(msgLen))
@ -516,8 +513,12 @@ func (rmq *rocksmq) Produce(topicName string, messages []ProducerMessage) ([]Uni
if err != nil {
return []UniqueID{}, err
}
log.Debug("Rocksmq produce successfully ", zap.String("topic", topicName),
zap.Int64("elapsed", time.Since(start).Milliseconds()))
getProduceTime := time.Since(start).Milliseconds()
if getLockTime > 200 || getProduceTime > 200 {
log.Warn("rocksmq produce too slowly", zap.String("topic", topicName),
zap.Int64("get lock elapse", getLockTime), zap.Int64("produce elapse", getProduceTime))
}
return msgIDs, nil
}