-
Notifications
You must be signed in to change notification settings - Fork 38
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
Optional metric for era points of specified validator #2361
base: master
Are you sure you want to change the base?
Conversation
@@ -786,6 +786,7 @@ namespace kagome::application { | |||
"The global log level can be set with -l<level>.") | |||
("validator", "Enable validator node") | |||
("config-file,c", po::value<std::string>(), "Filepath to load configuration from.") | |||
("validator-address", po::value<std::string>(), "SS58 address, if provided, erapoints of current era for it will be sent as metric\n") |
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.
("validator-address", po::value<std::string>(), "SS58 address, if provided, erapoints of current era for it will be sent as metric\n") | |
("validator-address", po::value<std::string>(), "SS58 address, if provided, erapoints of current era for it will be sent as metric") |
|
||
namespace kagome::state_metrics { | ||
|
||
static constexpr auto SET_ERA_POINTS_PERIOD = 60; |
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.
static constexpr auto SET_ERA_POINTS_PERIOD = 60; | |
static constexpr auto SET_ERA_POINTS_PERIOD = 60; // in seconds |
std::move(registry), | ||
std::move(hasher)); | ||
} | ||
return nullptr; |
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.
I strongly disagree with the case of sptr being initialized with nullptr.
A possible solution could be wrapping it with an optional.
Referenced issues
If validator-id is provided by cli, metric of it's era points in current era appears. Info about active era, list of validators in it and their points are taken from storage. Once a minute it's set in gauge in same registry as other metrics. If id is not validator anymore it's era points number is considered 0.
Description of the Change
Possible Drawbacks
Checklist Before Opening a PR
Before you open a Pull Request (PR), please make sure you've completed the following steps and confirm by answering 'Yes' to each item: