Merge pull request #13238 from sakateka/etcdserver-logs

etcdserver: remove code duplication from the peer.send func
This commit is contained in:
Piotr Tabor 2021-09-27 09:01:34 +02:00 committed by GitHub
commit 752a206da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -250,30 +250,16 @@ func (p *peer) send(m raftpb.Message) {
if isMsgSnap(m) {
p.r.ReportSnapshot(m.To, raft.SnapshotFailure)
}
if p.status.isActive() {
if p.lg != nil {
p.lg.Warn(
"dropped internal Raft message since sending buffer is full (overloaded network)",
zap.String("message-type", m.Type.String()),
zap.String("local-member-id", p.localID.String()),
zap.String("from", types.ID(m.From).String()),
zap.String("remote-peer-id", p.id.String()),
zap.String("remote-peer-name", name),
zap.Bool("remote-peer-active", p.status.isActive()),
)
}
} else {
if p.lg != nil {
p.lg.Warn(
"dropped internal Raft message since sending buffer is full (overloaded network)",
zap.String("message-type", m.Type.String()),
zap.String("local-member-id", p.localID.String()),
zap.String("from", types.ID(m.From).String()),
zap.String("remote-peer-id", p.id.String()),
zap.String("remote-peer-name", name),
zap.Bool("remote-peer-active", p.status.isActive()),
)
}
if p.lg != nil {
p.lg.Warn(
"dropped internal Raft message since sending buffer is full",
zap.String("message-type", m.Type.String()),
zap.String("local-member-id", p.localID.String()),
zap.String("from", types.ID(m.From).String()),
zap.String("remote-peer-id", p.id.String()),
zap.String("remote-peer-name", name),
zap.Bool("remote-peer-active", p.status.isActive()),
)
}
sentFailures.WithLabelValues(types.ID(m.To).String()).Inc()
}