-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
kvserver: add x-region, x-zone Raft msg metrics to Store #105122
Conversation
7aa20ec
to
eb9fe42
Compare
7383221
to
9f95c9c
Compare
The commit renames `RaftMessageHandler` to `IncomingRaftMessageHandler`. Another PR is introducing a new interface `OutgoingRaftMessageHandler`, dedicated to managing messages sent. The main purpose of this PR is to make the future PR cleaner by handling the renaming process. Note that this commit does not change any existing functionality. Part of: cockroachdb#103983 Related: cockroachdb#105122 Release Note: None
9f95c9c
to
7c1d8ec
Compare
The commit renames `RaftMessageHandler` to `IncomingRaftMessageHandler`. Another PR is introducing a new interface `OutgoingRaftMessageHandler`, dedicated to managing messages sent. The main purpose of this PR is to make the future PR cleaner by handling the renaming process. Note that this commit does not change any existing functionality. Part of: cockroachdb#103983 Related: cockroachdb#105122 Release Note: None
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.
Looking pretty good (only looked at last commit here)! Some of the same ideas I had in the base PRs apply here as well. It probably makes sense to settle these dependencies first, after that I think this PR will be in pretty good shape automatically.
b894549
to
026ab0c
Compare
026ab0c
to
5ae357f
Compare
The commit renames `RaftMessageHandler`, `Listen`, and `Stop` to `IncomingRaftMessageHandler`, `ListenIncomingRaftMessages`, and `StopIncomingRaftMessages`. Another PR is introducing a new interface `OutgoingRaftMessageHandler`, dedicated to managing messages sent. The main purpose of this PR is to make the future PR cleaner by handling the renaming process. Note that this commit does not change any existing functionality. Part of: cockroachdb#103983 Related: cockroachdb#105122 Release Note: None
The commit renames `RaftMessageHandler`, `Listen`, and `Stop` to `IncomingRaftMessageHandler`, `ListenIncomingRaftMessages`, and `StopIncomingRaftMessages`. Another PR is introducing a new interface `OutgoingRaftMessageHandler`, dedicated to managing messages sent. The main purpose of this PR is to make the future PR cleaner by handling the renaming process. Note that this commit does not change any existing functionality. Part of: cockroachdb#103983 Related: cockroachdb#105122 Release Note: None
4a6425c
to
900af28
Compare
Previously, wenyihu6 (Wenyi Hu) wrote…
Update: decided to just rename everything and have updated the rename PR |
900af28
to
3730490
Compare
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.
Looking good, almost there! Main point is trimming down the tests.
105123: kvserver: rename RaftMessageHandler to IncomingRaftMessageHandler r=tbg,kvoli a=wenyihu6 The commit renames `RaftMessageHandler`, `Listen`, and `Stop` to `IncomingRaftMessageHandler`, `ListenIncomingRaftMessages`, and `StopIncomingRaftMessages`. Another PR is introducing a new interface `OutgoingRaftMessageHandler`, dedicated to managing messages sent. The main purpose of this PR is to make the future PR cleaner by handling the renaming process. Note that this commit does not change any existing functionality. Part of: #103983 Related: #105122 Release Note: None 105519: kvserver: fix and re-enable slow lease application logging r=erikgrinaker a=erikgrinaker Resolves #97209. Epic: none Release note: None Co-authored-by: Wenyi <[email protected]> Co-authored-by: Erik Grinaker <[email protected]>
6c0f4e8
to
40368c6
Compare
Ack. Replaced the end to end test with one integration test for handlers and one unit test for cross locality metrics. |
40368c6
to
20e25ca
Compare
require.Equal(t, expected, actual) | ||
}) | ||
|
||
t.Run("sent raft message", func(t *testing.T) { |
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.
Subtests need to be independent of each other, I think these ones aren't. So either make this just one test (remove the subtests) or set up the environment anew in each subtest.
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.
Taking it back, they are independent due to the use of diffs. So this is "fine", I still think my top-level comment about merging the tests makes sense - could always have overlooked something.
Thanks for the updates! The code looks good, the test could be improved somewhat. In the cross-region specific test, you have a nice tabledriven setup. But then you also have the other test, which tests a few more slices of the stack (in a way that seems to work out really well) but which doesn't have nice tabledriven layout. Would you consider consolidating the two? I'm thinking ditch the non-tabledriven test, moving its coverage into the tabledriven test instead and renaming that test so that it is a bit more general (testing all send/receive metrics that have to do w the raft transport). After that (and my other trivial comments above), this is good to 🚀 ! Approving preemptively. |
require.Equal(t, expected, actual) | ||
}) | ||
|
||
t.Run("sent raft message", func(t *testing.T) { |
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.
Taking it back, they are independent due to the use of diffs. So this is "fine", I still think my top-level comment about merging the tests makes sense - could always have overlooked something.
Previously, there were no metrics to observe cross-region, cross-zone traffic in raft messages requests sent / received at each store. To improve this issue, this commit adds six new store metrics - ``` "raft.rcvd.bytes" "raft.sent.bytes" "raft.rcvd.cross_region.bytes" "raft.sent.cross_region.bytes" "raft.rcvd.cross_zone.bytes" "raft.sent.cross_zone.bytes" ``` The first two metrics track the total byte of raft messages received and sent in a store. Additionally, there are four metrics to track the aggregate byte count of cross-region, cross-zone Raft messages sent and received in the store. Note that these metrics capture the byte count of requests immediately upon message reception and just prior to message transmission. In the case of messages containing heartbeats or heartbeat_resps, they capture the byte count of requests with coalesced heartbeats. To facilitate metrics updating, this commit also introduces a new raft message handler interface `OutgoingRaftMessageHandler`. This interface captures outgoing messages right before they are sent to `raftSendQueue`. Note that the message may not be successfully queued if the outgoing queue is full. Resolves: cockroachdb#103983 Release note (ops change): Six new metrics - "raft.rcvd.bytes" "raft.sent.bytes" "raft.rcvd.cross_region.bytes" "raft.sent.cross_region.bytes" "raft.rcvd.cross_zone.bytes" "raft.sent.cross_zone.bytes" - have now been added for each store. For accurate metrics, follow these assumptions: - Configure region and zone tier keys consistently across nodes. - Within a node locality, ensure unique region and zone tier keys. - Maintain consistent configuration of region and zone tiers across nodes.
20e25ca
to
5479d92
Compare
Discussed this over slack - The last push was to rebase on master and cherry pick the last commit. Will merge when CI goes green. |
Thanks a lot for the review! bors r=tbg |
Build succeeded: |
Previously, there were no metrics to observe cross-region, cross-zone traffic in
raft messages requests sent / received at each store.
To improve this issue, this commit adds six new store metrics -
The first two metrics track the total byte of raft messages received and sent in
a store. Additionally, there are four metrics to track the aggregate byte count
of cross-region, cross-zone Raft messages sent and received in the store.
Note that these metrics capture the byte count of requests immediately upon
message reception and just prior to message transmission. In the case of
messages containing heartbeats or heartbeat_resps, they capture the byte count
of requests with coalesced heartbeats.
To facilitate metrics updating, this commit also introduces a new raft message
handler interface
OutgoingRaftMessageHandler
. This interface captures outgoingmessages right before they are sent to
raftSendQueue
. Note that the messagemay not be successfully queued if the outgoing queue is full.
Resolves: #103983
Release note (ops change): Six new metrics -
"raft.rcvd.bytes"
"raft.sent.bytes"
"raft.rcvd.cross_region.bytes"
"raft.sent.cross_region.bytes"
"raft.rcvd.cross_zone.bytes"
"raft.sent.cross_zone.bytes" - have now been added for each store.
For accurate metrics, follow these assumptions: