Skip to content

Commit da157f8

Browse files
authored
Merge pull request #84 from SimplyVC/feature/v0.3.2
0.3.2 Code
2 parents 2f5c327 + 43390ac commit da157f8

28 files changed

Lines changed: 676 additions & 597 deletions

File tree

.gitlab-ci.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,7 @@ Check if the installation was successful by checking if {NODE_IP}:{PORT}/metrics
222222
7. Take note of the Token generated, this is the App-Level Token.
223223
8. Go to the 'Install App' setting (left pane) and click `Install to Workspace`, followed by `Allow`.
224224
9. Go to the 'OAuth & Permissions' feature (left pane) and take note of the `Bot User OAuth Token`.
225-
10. Go to the 'Slash Commands' feature and create the following commands:
226-
* */start* command with *Welcome message* as the short description.
227-
* */help* command with *Available Commands* as the short description.
228-
* */ping* command with *Ping the Slack Commands Handler* as the short description.
229-
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`.
225+
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`.
230226
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)*.
231227

232228
**At the end, you should have:**

alerter/Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ freezegun = "*"
1212
configparser = "*"
1313
pika = "*"
1414
prometheus_client = "*"
15-
pymongo = "*"
15+
pymongo = "==3.12.1"
1616
python-telegram-bot = "*"
1717
python-dateutil = "*"
1818
pdpyras = "*"

alerter/Pipfile.lock

Lines changed: 202 additions & 190 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

alerter/src/alerter/alerters/contract/chainlink.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def _process_result(self, transformer_data: Dict,
150150
cl_alerts.ErrorNoSyncedDataSources,
151151
cl_alerts.SyncedDataSourcesFound,
152152
data_for_alerting, meta_data['node_parent_id'],
153-
"", "", meta_data['last_monitored'],
153+
meta_data['node_parent_id'], "",
154+
meta_data['last_monitored'],
154155
MetricCode.ErrorNoSyncedDataSources.value,
155156
"", "Synced EVM data sources found!", None
156157
)
@@ -160,7 +161,8 @@ def _process_result(self, transformer_data: Dict,
160161
cl_alerts.ErrorContractsNotRetrieved,
161162
cl_alerts.ContractsNowRetrieved,
162163
data_for_alerting, meta_data['node_parent_id'],
163-
"", "", meta_data['last_monitored'],
164+
meta_data['node_parent_id'], "",
165+
meta_data['last_monitored'],
164166
MetricCode.ErrorContractsNotRetrieved.value,
165167
"", "Chainlink contracts are now being retrieved!", None
166168
)
@@ -212,7 +214,7 @@ def _process_result(self, transformer_data: Dict,
212214
if (str_to_bool(configs.price_feed_not_observed['enabled'])
213215
and current_missed_observations is not None):
214216
sub_config = configs.price_feed_not_observed
215-
self.alerting_factory.\
217+
self.alerting_factory. \
216218
classify_thresholded_and_conditional_alert(
217219
current_missed_observations, sub_config,
218220
cl_alerts.
@@ -240,7 +242,7 @@ def _process_result(self, transformer_data: Dict,
240242
'deviation']
241243

242244
if current_deviation is not None:
243-
self.alerting_factory.\
245+
self.alerting_factory. \
244246
classify_thresholded_alert_contract(
245247
current_deviation, sub_config,
246248
cl_alerts.PriceFeedDeviationInreasedAboveThreshold,
@@ -305,9 +307,8 @@ def _process_error(self, data: Dict, data_for_alerting: List) -> None:
305307
cl_alerts.ErrorContractsNotRetrieved,
306308
cl_alerts.ContractsNowRetrieved,
307309
data_for_alerting, meta_data['node_parent_id'],
308-
"", "", meta_data['time'],
309-
MetricCode.ErrorContractsNotRetrieved.value,
310-
data['message'],
310+
meta_data['node_parent_id'], "", meta_data['time'],
311+
MetricCode.ErrorContractsNotRetrieved.value, data['message'],
311312
"Chainlink contracts are now being retrieved!", data['code']
312313
)
313314

@@ -316,7 +317,7 @@ def _process_error(self, data: Dict, data_for_alerting: List) -> None:
316317
cl_alerts.ErrorNoSyncedDataSources,
317318
cl_alerts.SyncedDataSourcesFound,
318319
data_for_alerting, meta_data['node_parent_id'],
319-
"", "", meta_data['time'],
320+
meta_data['node_parent_id'], "", meta_data['time'],
320321
MetricCode.ErrorNoSyncedDataSources.value,
321322
data['message'], "Synced EVM data sources found!", data['code']
322323
)

alerter/src/alerter/alerts/contract/chainlink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ChainlinkContractAlertCode)
33
from src.alerter.alert_data import ChainlinkContractAlertData
44
from src.alerter.alerts.alert import Alert
5-
from src.alerter.grouped_alerts_metric_code.contract.\
5+
from src.alerter.grouped_alerts_metric_code.contract. \
66
chainlink_contract_metric_code \
77
import GroupedChainlinkContractAlertsMetricCode as MetricCode
88

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

8686

8787
class ErrorContractsNotRetrieved(Alert):

alerter/src/alerter/grouped_alerts_metric_code/contract/chainlink_contract_metric_code.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
class GroupedChainlinkContractAlertsMetricCode(GroupedAlertsMetricCode):
5-
PriceFeedNotObserved = 'price_feed_not_observed'
6-
PriceFeedDeviation = 'price_feed_deviation'
7-
ConsensusFailure = 'consensus_failure'
8-
ErrorContractsNotRetrieved = 'contracts_not_retrieved'
9-
ErrorNoSyncedDataSources = 'no_synced_data_sources'
5+
PriceFeedNotObserved = 'cl_contract_price_feed_not_observed'
6+
PriceFeedDeviation = 'cl_contract_price_feed_deviation'
7+
ConsensusFailure = 'cl_contract_consensus_failure'
8+
ErrorContractsNotRetrieved = 'cl_contract_contracts_not_retrieved'
9+
ErrorNoSyncedDataSources = 'cl_contract_no_synced_data_sources'

alerter/src/alerter/grouped_alerts_metric_code/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
class GroupedGithubAlertsMetricCode(GroupedAlertsMetricCode):
55
GithubRelease = 'github_release'
6-
CannotAccessGithub = 'cannot_access_github'
6+
CannotAccessGithub = 'github_cannot_access'

alerter/src/alerter/grouped_alerts_metric_code/node/chainlink_node_metric_code.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33

44
class GroupedChainlinkNodeAlertsMetricCode(GroupedAlertsMetricCode):
5-
NoChangeInHeight = 'head_tracker_current_head'
6-
NoChangeInTotalHeadersReceived = 'head_tracker_heads_received_total'
7-
MaxUnconfirmedBlocksThreshold = 'max_unconfirmed_blocks'
8-
ChangeInSourceNode = 'process_start_time_seconds'
9-
GasBumpIncreasedOverNodeGasPriceLimit = \
10-
'tx_manager_gas_bump_exceeds_limit_total'
11-
NoOfUnconfirmedTxsThreshold = 'unconfirmed_transactions'
12-
TotalErroredJobRunsThreshold = 'run_status_update_total'
13-
EthBalanceThreshold = 'eth_balance_amount'
14-
EthBalanceTopUp = 'eth_balance_amount_increase'
15-
InvalidUrl = 'invalid_url'
16-
MetricNotFound = 'metric_not_found'
17-
NodeIsDown = 'node_is_down'
18-
PrometheusSourceIsDown = 'prometheus_is_down'
5+
NoChangeInHeight = 'cl_head_tracker_current_head'
6+
NoChangeInTotalHeadersReceived = 'cl_head_tracker_heads_received_total'
7+
MaxUnconfirmedBlocksThreshold = 'cl_max_unconfirmed_blocks'
8+
ChangeInSourceNode = 'cl_process_start_time_seconds'
9+
GasBumpIncreasedOverNodeGasPriceLimit = (
10+
'cl_tx_manager_gas_bump_exceeds_limit_total')
11+
NoOfUnconfirmedTxsThreshold = 'cl_unconfirmed_transactions'
12+
TotalErroredJobRunsThreshold = 'cl_run_status_update_total'
13+
EthBalanceThreshold = 'cl_eth_balance_amount'
14+
EthBalanceTopUp = 'cl_eth_balance_amount_increase'
15+
InvalidUrl = 'cl_invalid_url'
16+
MetricNotFound = 'cl_metric_not_found'
17+
NodeIsDown = 'cl_node_is_down'
18+
PrometheusSourceIsDown = 'cl_prometheus_is_down'

alerter/src/alerter/grouped_alerts_metric_code/node/evm_node_metric_code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
class GroupedEVMNodeAlertsMetricCode(GroupedAlertsMetricCode):
5+
NodeIsDown = 'evm_node_is_down'
56
BlockHeightDifference = 'evm_block_syncing_block_height_difference'
67
NoChangeInBlockHeight = 'evm_block_syncing_no_change_in_block_height'
7-
NodeIsDown = 'evm_node_is_down'
8-
InvalidUrl = 'invalid_url'
8+
InvalidUrl = 'evm_invalid_url'

0 commit comments

Comments
 (0)