-
Notifications
You must be signed in to change notification settings - Fork 160
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
Feature: add Raft::data_metrics()
and Raft::server_metrics()
#990
Conversation
@drmingdrmer Hi~ I'm done, PTAL when you have time |
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.
Thank you man.
The metrics producing process can be simplified:)
Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @YangKian)
openraft/src/metrics/mod.rs
line 42 at r1 (raw file):
pub use metric::Metric; pub use raft_metrics::is_data_metrics_changed; pub use raft_metrics::is_server_metrics_changed;
I think these two functions can be removed since the spawned task I mentioned above is no necessary.
openraft/src/metrics/raft_metrics.rs
line 174 at r1 (raw file):
where NID: NodeId { pub last_log_index: Option<u64>,
OpenRaft prefers the use of LogId
over log-index
whenever possible.
RaftMetrics::last_log_index
is kept for backward compatibility.
For this newly added field, use last_log: Option<LogId>
instead.
openraft/src/metrics/raft_metrics.rs
line 238 at r1 (raw file):
{ pub id: NID, pub current_term: u64,
Openraft uses Vote
instead of term
when possible. current_term
is kept in RaftMetrics
for backward compatibility. In RaftServerMetrics
, this field can be removed. An application can just use vote.leader_id.get_term()
instead.
openraft/src/raft/mod.rs
line 210 at r1 (raw file):
} } });
you do not have to create another task to replicate the metrics to data-metrics and server-metrics.
Just do this in report_metrics
, which is the only entry in Openraft to update metrics.
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.
Reviewable status: 2 of 7 files reviewed, 4 unresolved discussions (waiting on @drmingdrmer)
openraft/src/metrics/mod.rs
line 42 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
I think these two functions can be removed since the spawned task I mentioned above is no necessary.
Done.
openraft/src/metrics/raft_metrics.rs
line 174 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
OpenRaft prefers the use of
LogId
overlog-index
whenever possible.
RaftMetrics::last_log_index
is kept for backward compatibility.
For this newly added field, uselast_log: Option<LogId>
instead.
Done.
openraft/src/metrics/raft_metrics.rs
line 238 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
Openraft uses
Vote
instead ofterm
when possible.current_term
is kept inRaftMetrics
for backward compatibility. InRaftServerMetrics
, this field can be removed. An application can just usevote.leader_id.get_term()
instead.
Done.
openraft/src/raft/mod.rs
line 210 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
you do not have to create another task to replicate the metrics to data-metrics and server-metrics.
Just do this inreport_metrics
, which is the only entry in Openraft to update metrics.
Done.
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.
Reviewed 5 of 5 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @YangKian)
close #985
This change is