-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rafthttp: add Raft send latency metric for writes #10023
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,8 +201,10 @@ func (cw *streamWriter) run() { | |
heartbeatc, msgc = nil, nil | ||
|
||
case m := <-msgc: | ||
start := time.Now() | ||
err := enc.encode(&m) | ||
if err == nil { | ||
took := time.Since(start) | ||
unflushed += m.Size() | ||
|
||
if len(msgc) == 0 || batched > streamBufSize/2 { | ||
|
@@ -214,6 +216,14 @@ func (cw *streamWriter) run() { | |
batched++ | ||
} | ||
|
||
// snapshot sends are tracked via separate metrics https://github.com/etcd-io/etcd/pull/9997 | ||
// heartbeats are tracked via prober https://github.com/etcd-io/etcd/pull/10022 | ||
// TODO: track other messages? | ||
if m.Type == raftpb.MsgProp || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not the sending time (flushing the buffer to the network card). we actually send the messages at line 211 when flush is called explicitly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would rather just remove this metrics. it is not easy to measure after all with buffers all over the places. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @xiang90 Good point. For now, tracking snapshots and heartbeats is good enough. Will come back to this later. |
||
m.Type == raftpb.MsgApp || | ||
m.Type == raftpb.MsgAppResp { | ||
raftSendSeconds.WithLabelValues(m.Type.String(), types.ID(m.To).String()).Observe(took.Seconds()) | ||
} | ||
continue | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean []string{"To"}?