Skip to content

Commit

Permalink
Merge pull request #84 from SimplyVC/feature/v0.3.2
Browse files Browse the repository at this point in the history
0.3.2 Code
  • Loading branch information
Cherrett authored Jan 21, 2022
2 parents 2f5c327 + 43390ac commit da157f8
Show file tree
Hide file tree
Showing 28 changed files with 676 additions and 597 deletions.
29 changes: 0 additions & 29 deletions .gitlab-ci.yml

This file was deleted.

6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,7 @@ Check if the installation was successful by checking if {NODE_IP}:{PORT}/metrics
7. Take note of the Token generated, this is the App-Level Token.
8. Go to the 'Install App' setting (left pane) and click `Install to Workspace`, followed by `Allow`.
9. Go to the 'OAuth & Permissions' feature (left pane) and take note of the `Bot User OAuth Token`.
10. Go to the 'Slash Commands' feature and create the following commands:
* */start* command with *Welcome message* as the short description.
* */help* command with *Available Commands* as the short description.
* */ping* command with *Ping the Slack Commands Handler* as the short description.
11. Add the newly created `PANIC Notifications` app to the target channel by typing `/add` within the channel and selecting `Add apps to this channel`.
10. Add the newly created `PANIC Notifications` app to the target channel by typing `/add` within the channel and selecting `Add apps to this channel`.
4. Go to the Slack client, right click the name of the target slack channel within the list of channels (left pane), click `Open channel details`, and take note of the Channel ID *(found at the bottom)*.

**At the end, you should have:**
Expand Down
2 changes: 1 addition & 1 deletion alerter/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ freezegun = "*"
configparser = "*"
pika = "*"
prometheus_client = "*"
pymongo = "*"
pymongo = "==3.12.1"
python-telegram-bot = "*"
python-dateutil = "*"
pdpyras = "*"
Expand Down
392 changes: 202 additions & 190 deletions alerter/Pipfile.lock

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions alerter/src/alerter/alerters/contract/chainlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def _process_result(self, transformer_data: Dict,
cl_alerts.ErrorNoSyncedDataSources,
cl_alerts.SyncedDataSourcesFound,
data_for_alerting, meta_data['node_parent_id'],
"", "", meta_data['last_monitored'],
meta_data['node_parent_id'], "",
meta_data['last_monitored'],
MetricCode.ErrorNoSyncedDataSources.value,
"", "Synced EVM data sources found!", None
)
Expand All @@ -160,7 +161,8 @@ def _process_result(self, transformer_data: Dict,
cl_alerts.ErrorContractsNotRetrieved,
cl_alerts.ContractsNowRetrieved,
data_for_alerting, meta_data['node_parent_id'],
"", "", meta_data['last_monitored'],
meta_data['node_parent_id'], "",
meta_data['last_monitored'],
MetricCode.ErrorContractsNotRetrieved.value,
"", "Chainlink contracts are now being retrieved!", None
)
Expand Down Expand Up @@ -212,7 +214,7 @@ def _process_result(self, transformer_data: Dict,
if (str_to_bool(configs.price_feed_not_observed['enabled'])
and current_missed_observations is not None):
sub_config = configs.price_feed_not_observed
self.alerting_factory.\
self.alerting_factory. \
classify_thresholded_and_conditional_alert(
current_missed_observations, sub_config,
cl_alerts.
Expand Down Expand Up @@ -240,7 +242,7 @@ def _process_result(self, transformer_data: Dict,
'deviation']

if current_deviation is not None:
self.alerting_factory.\
self.alerting_factory. \
classify_thresholded_alert_contract(
current_deviation, sub_config,
cl_alerts.PriceFeedDeviationInreasedAboveThreshold,
Expand Down Expand Up @@ -305,9 +307,8 @@ def _process_error(self, data: Dict, data_for_alerting: List) -> None:
cl_alerts.ErrorContractsNotRetrieved,
cl_alerts.ContractsNowRetrieved,
data_for_alerting, meta_data['node_parent_id'],
"", "", meta_data['time'],
MetricCode.ErrorContractsNotRetrieved.value,
data['message'],
meta_data['node_parent_id'], "", meta_data['time'],
MetricCode.ErrorContractsNotRetrieved.value, data['message'],
"Chainlink contracts are now being retrieved!", data['code']
)

Expand All @@ -316,7 +317,7 @@ def _process_error(self, data: Dict, data_for_alerting: List) -> None:
cl_alerts.ErrorNoSyncedDataSources,
cl_alerts.SyncedDataSourcesFound,
data_for_alerting, meta_data['node_parent_id'],
"", "", meta_data['time'],
meta_data['node_parent_id'], "", meta_data['time'],
MetricCode.ErrorNoSyncedDataSources.value,
data['message'], "Synced EVM data sources found!", data['code']
)
Expand Down
4 changes: 2 additions & 2 deletions alerter/src/alerter/alerts/contract/chainlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ChainlinkContractAlertCode)
from src.alerter.alert_data import ChainlinkContractAlertData
from src.alerter.alerts.alert import Alert
from src.alerter.grouped_alerts_metric_code.contract.\
from src.alerter.grouped_alerts_metric_code.contract. \
chainlink_contract_metric_code \
import GroupedChainlinkContractAlertsMetricCode as MetricCode

Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self, origin_name: str, severity: str,
"The Chainlink Node observing the price feed is {}."
.format(proxy_address, origin_name),
severity, timestamp, parent_id, origin_id,
MetricCode.ConsensusFailure)
MetricCode.ConsensusFailure, alert_data)


class ErrorContractsNotRetrieved(Alert):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@


class GroupedChainlinkContractAlertsMetricCode(GroupedAlertsMetricCode):
PriceFeedNotObserved = 'price_feed_not_observed'
PriceFeedDeviation = 'price_feed_deviation'
ConsensusFailure = 'consensus_failure'
ErrorContractsNotRetrieved = 'contracts_not_retrieved'
ErrorNoSyncedDataSources = 'no_synced_data_sources'
PriceFeedNotObserved = 'cl_contract_price_feed_not_observed'
PriceFeedDeviation = 'cl_contract_price_feed_deviation'
ConsensusFailure = 'cl_contract_consensus_failure'
ErrorContractsNotRetrieved = 'cl_contract_contracts_not_retrieved'
ErrorNoSyncedDataSources = 'cl_contract_no_synced_data_sources'
2 changes: 1 addition & 1 deletion alerter/src/alerter/grouped_alerts_metric_code/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

class GroupedGithubAlertsMetricCode(GroupedAlertsMetricCode):
GithubRelease = 'github_release'
CannotAccessGithub = 'cannot_access_github'
CannotAccessGithub = 'github_cannot_access'
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@


class GroupedChainlinkNodeAlertsMetricCode(GroupedAlertsMetricCode):
NoChangeInHeight = 'head_tracker_current_head'
NoChangeInTotalHeadersReceived = 'head_tracker_heads_received_total'
MaxUnconfirmedBlocksThreshold = 'max_unconfirmed_blocks'
ChangeInSourceNode = 'process_start_time_seconds'
GasBumpIncreasedOverNodeGasPriceLimit = \
'tx_manager_gas_bump_exceeds_limit_total'
NoOfUnconfirmedTxsThreshold = 'unconfirmed_transactions'
TotalErroredJobRunsThreshold = 'run_status_update_total'
EthBalanceThreshold = 'eth_balance_amount'
EthBalanceTopUp = 'eth_balance_amount_increase'
InvalidUrl = 'invalid_url'
MetricNotFound = 'metric_not_found'
NodeIsDown = 'node_is_down'
PrometheusSourceIsDown = 'prometheus_is_down'
NoChangeInHeight = 'cl_head_tracker_current_head'
NoChangeInTotalHeadersReceived = 'cl_head_tracker_heads_received_total'
MaxUnconfirmedBlocksThreshold = 'cl_max_unconfirmed_blocks'
ChangeInSourceNode = 'cl_process_start_time_seconds'
GasBumpIncreasedOverNodeGasPriceLimit = (
'cl_tx_manager_gas_bump_exceeds_limit_total')
NoOfUnconfirmedTxsThreshold = 'cl_unconfirmed_transactions'
TotalErroredJobRunsThreshold = 'cl_run_status_update_total'
EthBalanceThreshold = 'cl_eth_balance_amount'
EthBalanceTopUp = 'cl_eth_balance_amount_increase'
InvalidUrl = 'cl_invalid_url'
MetricNotFound = 'cl_metric_not_found'
NodeIsDown = 'cl_node_is_down'
PrometheusSourceIsDown = 'cl_prometheus_is_down'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class GroupedEVMNodeAlertsMetricCode(GroupedAlertsMetricCode):
NodeIsDown = 'evm_node_is_down'
BlockHeightDifference = 'evm_block_syncing_block_height_difference'
NoChangeInBlockHeight = 'evm_block_syncing_no_change_in_block_height'
NodeIsDown = 'evm_node_is_down'
InvalidUrl = 'invalid_url'
InvalidUrl = 'evm_invalid_url'
6 changes: 3 additions & 3 deletions alerter/src/alerter/grouped_alerts_metric_code/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

class GroupedSystemAlertsMetricCode(GroupedAlertsMetricCode):
SystemIsDown = 'system_is_down'
InvalidUrl = 'invalid_url'
OpenFileDescriptorsThreshold = 'open_file_descriptors'
InvalidUrl = 'system_invalid_url'
OpenFileDescriptorsThreshold = 'system_open_file_descriptors'
SystemCPUUsageThreshold = 'system_cpu_usage'
SystemRAMUsageThreshold = 'system_ram_usage'
SystemStorageUsageThreshold = 'system_storage_usage'
MetricNotFound = 'metric_not_found'
MetricNotFound = 'system_metric_not_found'
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,10 @@ def mute_callback(self, ack: Ack, say: Say,
say("Performing mute...")

# Expected: /panicmute or /panicmute List[<severity>]
inputted_severities = command.get('text', '').split(' ')[1:]
inputted_severities = command.get('text', '').split(' ')
inputted_severities = list(filter(
lambda severity: severity != '', inputted_severities)
)
unrecognized_severities = []
recognized_severities = []

Expand Down Expand Up @@ -608,7 +611,10 @@ def muteall_callback(self, ack: Ack, say: Say,
say("Performing muteall...")

# Expected: /muteall or /muteall List[<severity>]
inputted_severities = command.get('text', '').split(' ')[1:]
inputted_severities = command.get('text', '').split(' ')
inputted_severities = list(filter(
lambda severity: severity != '', inputted_severities)
)
unrecognized_severities = []
recognized_severities = []

Expand Down
Loading

0 comments on commit da157f8

Please sign in to comment.