-
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 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…econds" metric Currently, only v2 metrics ("stats.FollowerStats") tracks Raft message send latencies. Add Prometheus histogram to track Raft messages for writes, since heartbeats are probed (see #10022) and snapshots are already being tracked via #9997. ``` etcd_network_raft_send_total_duration_seconds_bucket{To="7339c4e5e833c029",Type="MsgProp",le="0.0001"} 1 etcd_network_raft_send_total_duration_seconds_bucket{To="7339c4e5e833c029",Type="MsgProp",le="0.0002"} 1 etcd_network_raft_send_total_duration_seconds_bucket{To="729934363faa4a24",Type="MsgApp",le="0.0001"} 9 etcd_network_raft_send_total_duration_seconds_bucket{To="729934363faa4a24",Type="MsgApp",le="0.0002"} 9 etcd_network_raft_send_total_duration_seconds_bucket{To="7339c4e5e833c029",Type="MsgAppResp",le="0.0001"} 8 etcd_network_raft_send_total_duration_seconds_bucket{To="7339c4e5e833c029",Type="MsgAppResp",le="0.0002"} 8 ``` Signed-off-by: Gyuho Lee <[email protected]>
- Loading branch information
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()) | ||
} | ||
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. Is there a reason that MsgProp, MsgApp and MsgAppResp are chosen here? I was reading the doc, and you explained snapshot and heartbeats, how about other message types? |
||
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"}?