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

RPC endpoint for election statistics #4533

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

RickiNano
Copy link
Contributor

@RickiNano RickiNano commented Apr 3, 2024

This pull request adds a new election_statistics RPC endpoint to help identify bottlenecks within the AEC.
The endpoint will respond with the number of active elections for each electiontype. It will also return the percentage of AEC slots in use.
If this is merged, I intend to expand the dataset with the average and max election age.

Request:

{
    "action": "election_statistics" 
}

Response example:

{
    "normal": "1595",
    "hinted": "70",
    "optimistic": "222",
    "total": "1887",
    "aec_utilization_percentage": "37.74"
}

@clemahieu
Copy link
Contributor

This seems useful. The PR should include a test that at least runs the code.

@clemahieu clemahieu merged commit 311bf68 into nanocurrency:develop Apr 3, 2024
25 of 27 checks passed
ASSERT_EQ ("0", response1.get<std::string> ("hinted"));
ASSERT_EQ ("0", response1.get<std::string> ("optimistic"));
ASSERT_EQ ("0", response1.get<std::string> ("total"));
ASSERT_EQ ("0.00", response1.get<std::string> ("aec_utilization_percentage"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could at least start a single election which would ensure reported values work as expected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pwojcikdev I'm not sure how to do this. If I start a normal election it might get confirmed before the RPC request is executed.

RickiNano added a commit to RickiNano/nano-node that referenced this pull request Apr 5, 2024
@qwahzi qwahzi added documentation This item indicates the need for or supplies updated or expanded documentation rpc Changes related to Remote Procedure Calls labels Apr 7, 2024
@qwahzi qwahzi added this to the V27 milestone Apr 7, 2024
RickiNano added a commit to RickiNano/nano-node that referenced this pull request May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This item indicates the need for or supplies updated or expanded documentation rpc Changes related to Remote Procedure Calls
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants