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

fix: alerts #10

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 10 additions & 26 deletions docker/prometheus/rules/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,28 @@ groups:
rules:

- alert: HeadBlockIsNotChanging
expr: absent(ethereum_slashing_watcher_slot_number) OR changes(ethereum_slashing_watcher_slot_number[15m]) == 0
for: 1m
expr: absent(ethereum_head_watcher_slot_number) OR changes(ethereum_head_watcher_slot_number[1h]) == 0
for: 5m
labels:
severity: critical
annotations:
emoji: ⏳🐦
summary: "Head block doesn't change for more than 15 minutes"
resolved_summary: "Head block was changed"
summary: "⏳🐦 Head block doesn't change for more than 1 hour"
description: "It's not OK. Please, check app health"
resolved_description: "It's OK"
footer_text: 'Slot • {{ with query "ethereum_slashing_watcher_slot_number" }}{{ . | first | value | printf "%.0f" }}{{ end }}'
footer_icon_url: "https://cryptologos.cc/logos/steth-steth-logo.png"

- alert: ValidatorsIndexSlotIsNotChanging
expr: absent(ethereum_slashing_watcher_validators_index_slot_number) OR changes(ethereum_slashing_watcher_validators_index_slot_number[1h]) == 0
for: 1m
expr: absent(ethereum_head_watcher_validators_index_slot_number) OR changes(ethereum_head_watcher_validators_index_slot_number[1h]) == 0
for: 5m
labels:
severity: critical
annotations:
emoji: ⏳👥
summary: "Validators index slot doesn't change for more than 1 hour"
resolved_summary: "Validators index slot was changed"
summary: "⏳👥 Validators index slot doesn't change for more than 1 hour"
description: "It's not OK. Please, check app health"
resolved_description: "It's OK"
footer_text: 'Slot • {{ with query "ethereum_slashing_watcher_slot_number" }}{{ . | first | value | printf "%.0f" }}{{ end }}'
footer_icon_url: "https://cryptologos.cc/logos/steth-steth-logo.png"


- alert: KeysAPISlotIsNotChanging
expr: absent(ethereum_slashing_watcher_keys_api_slot_number) OR changes(ethereum_slashing_watcher_keys_api_slot_number[1h]) == 0
for: 1m
expr: absent(ethereum_head_watcher_keys_api_slot_number) OR changes(ethereum_head_watcher_keys_api_slot_number[1h]) == 0
for: 5m
labels:
severity: critical
annotations:
emoji: ⏳🔑
summary: "KeysAPI index slot doesn't change for more than 1 hour"
resolved_summary: "KeysAPI index slot was changed"
description: "It's not OK. Please, check app health"
resolved_description: "It's OK"
footer_text: 'Slot • {{ with query "ethereum_slashing_watcher_slot_number" }}{{ . | first | value | printf "%.0f" }}{{ end }}'
footer_icon_url: "https://cryptologos.cc/logos/steth-steth-logo.png"
summary: "⏳🔑 KeysAPI index slot doesn't change for more than 1 hour"
description: "It's not OK. Please, check app health"
2 changes: 1 addition & 1 deletion src/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# - Metrics -
PROMETHEUS_PORT = int(os.getenv('PROMETHEUS_PORT', 9000))
PROMETHEUS_PREFIX = os.getenv("PROMETHEUS_PREFIX", "ethereum_slashing_watcher")
PROMETHEUS_PREFIX = os.getenv("PROMETHEUS_PREFIX", "ethereum_head_watcher")

HEALTHCHECK_SERVER_PORT = int(os.getenv('HEALTHCHECK_SERVER_PORT', 9010))

Expand Down
5 changes: 3 additions & 2 deletions src/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _update_validators(self):
now = time.time()
diff = now - self.genesis_time
slot = int(diff / SECONDS_PER_SLOT)
if self.indexed_validators_keys and SLOTS_PER_EPOCH != 0:
if self.indexed_validators_keys and slot % SLOTS_PER_EPOCH != 0:
return
logger.info({'msg': 'Updating indexed validators keys'})
try:
Expand Down Expand Up @@ -155,7 +155,8 @@ def _update_lido_keys(self, header: BlockHeaderResponseData) -> None:
modules = self.keys_api.get_modules()[0]

current_nonce = sum(module['nonce'] for module in modules)
if self.keys_api_nonce >= current_nonce:
if self.keys_api_nonce == current_nonce:
KEYS_API_SLOT_NUMBER.set(int(header.header.message.slot))
return
self.keys_api_nonce = current_nonce

Expand Down