-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: critical alerts by modules - 2 #264
Open
AlexanderLukin
wants to merge
3
commits into
develop
Choose a base branch
from
feature/critical-csm-alets-2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make several changes in the current critical alerts engine. 1. Now critical alerts are sent for each module individually. 2. Change the architecture of critical alert classes. Now these classes have `moduleIndex` field that allows them to detect for which module this critical alert should be triggered. 3. To optimize calculation complexity, raw data that are needed for critical alerts to calculate their state is now extracted from the critical alert instance methods to the higher level. Now these raw data are fetched in the `CriticalAlerts` service and are passed to the critical alert instances in constructors on creation time. Also, these data are filtered by a specific module and epoch to reduce the size of containers that critical alert instances should look over. 4. Introduce two new env variables `CRITICAL_ALERTS_MIN_ACTIVE_VAL_COUNT` and `CRITICAL_ALERTS_MIN_AFFECTED_VAL_COUNT` that allow users to define custom numbers for the count of active and affected validators for the particular module for which a critical alert should be triggered. Define priority rules for these values. Add support for the new affected validators mechanics to critical alerts. Describe new priority rules in README. 5. Now it is possible to set a share of active validators and a minimal threshold number for which a critical alert should be triggered in the new `CRITICAL_ALERTS_MIN_ACTIVE_VAL_COUNT` env variable. Previously these values were hard coded in the code and non-configurable. 6. Add a new `nos_module_id` label to all critical alerts. So now it is possible to route alerts depending on the module to different channels via Alertmanager. 7. Rules for sending critical alerts were slightly loosened. Previously alerts were sent when the number of affected validators was greater than the particular threshold. Now alerts are sent when the number of affected validators is greater or equal to the threshold. 8. Add information about the module to the alert summary. 9. Slightly change log info for critical alerts. Now logs display the critical alert name for every sent alert. 10. Calculate and store fetched module indexes in the Registry service and all dependent registry services (`LidoSource`, `FileSource`, `KeysapiSource`). This allows the `CriticalAlerts` service to fetch all available module indexes conveniently. 11. Fix a bug in the `isValid` module function of the `FileSource` service. This function considered key files with multiple modules as invalid. Now this function can correctly validate key files with multiple modules. 12. Update the `custom_mainnet.yaml` and `custom_testnet.yaml` templates to demonstrate how multiple modules can be defined in a file with keys.
vgorkavenko
reviewed
Dec 16, 2024
1. Simplify the explanation of new critical alert rules in README. 2. Add to README a sample rule explaining how critical alert rules work. 3. Add comments to the code in several places.
1. Replace `reduce` in the `CriticalAlerts` service with for/of cycle. 2. Fix lint errors.
vgorkavenko
approved these changes
Dec 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make several changes in the current critical alerts engine.
Now critical alerts are sent for each module individually.
Change the architecture of critical alert classes. Now these classes have
moduleIndex
field that allows them to detect for which module this critical alert should be triggered.To optimize calculation complexity, raw data that are needed for critical alerts to calculate their state is now extracted from the critical alert instance methods to the higher level. Now these raw data are fetched in the
CriticalAlerts
service and are passed to the critical alert instances in constructors on creation time. Also, these data are filtered by a specific module and epoch to reduce the size of containers that critical alert instances should look over.Introduce two new env variables
CRITICAL_ALERTS_MIN_ACTIVE_VAL_COUNT
andCRITICAL_ALERTS_MIN_AFFECTED_VAL_COUNT
that allow users to define custom numbers for the count of active and affected validators for the particular module for which a critical alert should be triggered. Define priority rules for these values. Add support for the new affected validators mechanics to critical alerts. Describe new priority rules in README.Now it is possible to set a share of active validators and a minimal threshold number for which a critical alert should be triggered in the new
CRITICAL_ALERTS_MIN_ACTIVE_VAL_COUNT
env variable. Previously these values were hard coded in the code and non-configurable.Add a new
nos_module_id
label to all critical alerts. So now it is possible to route alerts depending on the module to different channels via Alertmanager.Rules for sending critical alerts were slightly loosened. Previously alerts were sent when the number of affected validators was greater than the particular threshold. Now alerts are sent when the number of affected validators is greater or equal to the threshold.
Add information about the module to the alert summary.
Slightly change log info for critical alerts. Now logs display the critical alert name for every sent alert.
Calculate and store fetched module indexes in the Registry service and all dependent registry services (
LidoSource
,FileSource
,KeysapiSource
). This allows theCriticalAlerts
service to fetch all available module indexes conveniently.Fix a bug in the
isValid
module function of theFileSource
service. This function considered key files with multiple modules as invalid. Now this function can correctly validate key files with multiple modules.Update the
custom_mainnet.yaml
andcustom_testnet.yaml
templates to demonstrate how multiple modules can be defined in a file with keys.