Skip to content

Commit 2bf66b4

Browse files
committed
Add Discord webhook support to dora_monitor
Slack and Discord can be configured independently or together (fan-out). Adds DiscordNotifier with emoji-shortcode and mrkdwn translation, Notifier aggregator with dry-run de-dup, and a parallel Discord embed builder for the heartbeat sharing the data-gather step with the existing Slack one.
1 parent d6ee544 commit 2bf66b4

7 files changed

Lines changed: 430 additions & 130 deletions

File tree

dora_monitor/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# dora_monitor
22

3-
Polls a [Dora explorer](https://github.com/ethpandaops/dora) API and posts Slack alerts when a specific client (e.g. `ethrex`) misses a block, orphans a block, drifts onto a fork, falls behind the canonical head, or drops offline.
3+
Polls a [Dora explorer](https://github.com/ethpandaops/dora) API and posts Slack and/or Discord alerts when a specific client (e.g. `ethrex`) misses a block, orphans a block, drifts onto a fork, falls behind the canonical head, or drops offline.
44

55
## Install
66

@@ -12,7 +12,7 @@ pip install -e .
1212

1313
## Configure
1414

15-
Copy `config.example.yaml` and edit it; the only mandatory fields are `dora_url`, `client_match`, and the Slack webhook (which can come from `SLACK_WEBHOOK_URL` instead).
15+
Copy `config.example.yaml` and edit it; the mandatory fields are `dora_url`, `client_match`, and at least one webhook (`slack_webhook_url` or `discord_webhook_url`; either can come from the `SLACK_WEBHOOK_URL` / `DISCORD_WEBHOOK_URL` env var instead). Both may be set, in which case every alert and heartbeat is fanned out to each.
1616

1717
```bash
1818
cp config.example.yaml config.yaml
@@ -46,7 +46,7 @@ The process holds dedup state in `state_file` so restarts don't re-alert on alre
4646

4747
Recoveries (fork resolved, caught up, back online) are posted as well.
4848

49-
The periodic heartbeat digest uses Slack Block Kit (`{"blocks": [...]}`) with a plain-text fallback for notifications. Action alerts (offline / fork / lag / version change / missed-block) use plain mrkdwn `text` posts. Clients with status `online`, on the canonical fork, and at `distance == 0` from canonical head collapse into a single "online @ canonical" bucket so the digest highlights outliers instead of repeating identical rows; use `heartbeat_other_clients: detailed` (default) to list the healthy names, `summary` for just a count, or `off` to drop the section entirely.
49+
The periodic heartbeat digest uses Slack Block Kit (`{"blocks": [...]}`) on Slack and a rich embed on Discord, both built from the same gathered data plus a shared plain-text fallback. Action alerts (offline / fork / lag / version change / missed-block) use plain mrkdwn `text` posts on Slack; the same strings are run through a mrkdwn→Discord-markdown translator (single-asterisk bold → double, `:shortcode:` emoji → unicode) before being posted to Discord. Clients with status `online`, on the canonical fork, and at `distance == 0` from canonical head collapse into a single "online @ canonical" bucket so the digest highlights outliers instead of repeating identical rows; use `heartbeat_other_clients: detailed` (default) to list the healthy names, `summary` for just a count, or `off` to drop the section entirely.
5050

5151
## A note on what "client" means here
5252

dora_monitor/config.example.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ dora_url: "https://dora.bal-devnet-7.ethpandaops.io"
66
client_match: "ethrex"
77

88
# Slack incoming webhook URL. Can also be set via SLACK_WEBHOOK_URL env var.
9+
# Leave empty to disable Slack delivery.
910
slack_webhook_url: ""
1011

12+
# Discord webhook URL. Can also be set via DISCORD_WEBHOOK_URL env var.
13+
# Leave empty to disable Discord delivery. At least one of slack / discord
14+
# must be configured (unless --dry-run).
15+
discord_webhook_url: ""
16+
1117
# Optional label shown in alert headers (e.g. network name).
1218
network_label: "bal-devnet-7"
1319

0 commit comments

Comments
 (0)