Skip to content

feat: support multiple webhooks per notification channel in monitor_metrics - #119

Open
jackclucas wants to merge 2 commits into
masterfrom
feature/multi-webhook-notifications
Open

feat: support multiple webhooks per notification channel in monitor_metrics#119
jackclucas wants to merge 2 commits into
masterfrom
feature/multi-webhook-notifications

Conversation

@jackclucas

Copy link
Copy Markdown
Contributor

Summary

Customers running monitor_metrics.py (the lslocks-based lock-contention detector) asked for the ability to send the same alert to multiple Slack channels — e.g. IT ops and a dev team — without needing to run a separate Alertmanager setup.

Changes

scripts/monitor_metrics.py — each channel's config value (notifications.slack, .teams, .email, .script) may now be either a single mapping (unchanged, fully backward compatible) or a list of mappings. Every enabled entry in the list gets its own notification sent. Applies uniformly to all four channel types since they share one dispatch loop.

scripts/monitor_metrics.yaml — added a commented-out example showing the two-webhook list form for the slack section.

Backward compatibility

Existing single-mapping configs work exactly as before — all 11 tests pass unchanged.

Example config (new list form)

notifications:
  slack:
    - enabled: true
      webhook_url: "https://hooks.slack.com/services/T000/AAA/xxx"   # IT channel
    - enabled: true
      webhook_url: "https://hooks.slack.com/services/T000/BBB/yyy"   # dev-team channel

…etrics

Allow each notification channel (slack, teams, email, script) to be
configured as either a single mapping (existing behaviour, fully backward
compatible) or a list of mappings so that the same alert is fanned out to
multiple destinations - e.g. an IT Slack channel and a dev-team channel.

Changes:
- monitor_metrics.py: wrap dispatch loop body in an inner 'for cfg in
  cfg_list' loop where cfg_list is [raw_cfg] for a mapping or raw_cfg
  itself for a list
- monitor_metrics.yaml: document the list form for the slack section with
  a commented-out two-webhook example

All 11 existing tests pass unchanged, confirming backward compatibility.
@jackclucas jackclucas self-assigned this Jul 31, 2026
@jackclucas
jackclucas requested a review from rcowham July 31, 2026 17:50
@rcowham

rcowham commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Tests for the new version too?

@rcowham

rcowham commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Sorry - been adding stuff to notifications. Can you resolve conflicts please and will look to get this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants