Skip to content
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

Split metrics into data metrics and server metrics #985

Closed
2 tasks
drmingdrmer opened this issue Jan 10, 2024 · 5 comments · Fixed by #990
Closed
2 tasks

Split metrics into data metrics and server metrics #985

drmingdrmer opened this issue Jan 10, 2024 · 5 comments · Fixed by #990
Assignees
Labels
A-metrics Area: metrics report/subscribe improvement

Comments

@drmingdrmer
Copy link
Member

drmingdrmer commented Jan 10, 2024

RaftMetrics encapsulates a range of information about the internal states of
a Raft node, including the server state (e.g., Leader, Follower), and
data-related states such as the last log index and the last applied log index.

Applications interested in monitoring these details can subscribe to
RaftMetrics to receive updates when these metrics change, with
Raft::metrics().

However, some metrics, like last_log_index, are frequently updated, while
others, such as current_term and state, change less often.

For applications solely concerned with server state transitions (like switching
from Leader to Follower), being notified of changes to last_log_index can
result in unnecessary wake-ups.

To optimize this, it would be beneficial to add two subsets of the metrics:

  • Metrics that are not data-related, such as current_term, vote, and state.
  • Metrics that are data-related, including last_log_index and last_applied.

By segregating these metrics, applications can subscribe to the relevant subset
and reduce the overhead of processing frequent updates that are not pertinent to
their needs.

TODO:

  • add Raft::data_metrics() to return a watch::Receiver<RaftDataMetrics>
    that contains only metrics about log, state machine and snapshot.

  • add Raft::server_metrics() to return a
    watch::Receiver<RaftServerMetrics> that contains only server related
    metrics, such as vote, leader, id, running_state, membership

Copy link

👋 Thanks for opening this issue!

Get help or engage by:

  • /help : to print help messages.
  • /assignme : to assign this issue to you.

@schreter
Copy link
Collaborator

BTW, I was about to suggest the same :-).

@YangKian
Copy link
Contributor

Hi, may I claim this assignment? I'd like to have some try

@drmingdrmer
Copy link
Member Author

Hi, may I claim this assignment? I'd like to have some try

Sure. Thank you!

Please keep current API and data types and just add new APIs. :)

@YangKian
Copy link
Contributor

YangKian commented Jan 11, 2024

Please keep current API and data types and just add new APIs. :)

get it~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metrics Area: metrics report/subscribe improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants