Skip to content

feat(alerts): delivery by target through the channels, content prepared once and health per destination - #33975

Merged
manerow merged 5 commits into
feat/alerting-redesign-8-tick-orderfrom
feat/alerting-redesign-9-delivery
Oct 6, 2026
Merged

manerow merged 5 commits into
feat/alerting-redesign-8-tick-orderfrom
feat/alerting-redesign-9-delivery

Conversation

@manerow

@manerow manerow commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #33118
Fixes #34266

What this pull request implements

  • Delivery by target. Each resolved address is a target, sent to on its own: a failure affects only that target and that event.
  • One delivery path. A consumer that makes its own work, such as a credit alert, sends through the alert's channels as a tick does.
  • Content prepared once per event, and a report's file built once.
  • Health per destination. Each destination reports its own outcome: delivered, failed (with how many of its recipients failed), or not attempted and why (SMTP off, nobody to send to).
  • Each question to its owner. The channel says whether it can send and carries files; the attachment provider, whether an event needs its file. A destination nothing can be sent through costs the rest of its channel nothing.
  • New settings, all off by default: honourWebhookMethod, awaitEmailOutcome and targetSendConcurrency. With skipUnreachableTargetWithinTick on, an unreachable target is not retried in that tick.

What was wrong before

The first failing endpoint of a channel dropped that channel's other recipients for the event, and only one destination per channel recorded a status.

Design

  • TargetResolver turns one channel's destinations into the targets of one event. Candidates with the same identity are one Target, sent with the first destination's configuration.
  • ChannelDelivery sends one event through every destination and returns a Delivery: how many channels delivered it, and which failed, including any that could not try. TickChannels is the tick's: it sets aside destinations nothing can be sent through, groups the rest by the Channel that serves them, shares one EventContent per event and isolates each channel: one that throws fails each of its destinations.
  • ChannelDispatch sends one event through one channel: availability, a missing file, then the targets, each sent in isolation by IsolatedSends.
  • TickHealth sums each destination's targets into a DestinationOutcome, the only writer of health. A failed recipient outranks a channel that failed as a whole, then a failed lookup, then not being attempted, and nothing later in the tick hides a failure. Nobody to send to ranks last: reaching anyone in the tick reads delivered. HealthStreak counts failures only.
  • AlertLedger writes a tick's failed events in one batch, the last row per event.

What users notice

  • A test case's first result appears once in webhook payloads.
  • Addresses that differ only in letter case receive one email; webhooks that differ only in query parameters each receive it.
  • An event a channel could not try (email with SMTP off, or owners with no Slack address) counts as failed, with the reason; on main both counted as sent (Fixes #24691: Deduplicate recipients across multiple EventSubscription destinations #25312). The destination reads that reason tick after tick, with no failing streak.

How it was tested

The alerting unit tests (90 classes, 629 tests), the alert integration tests (15 classes, 98 tests, including DispatchScenariosIT and AlertDeliveryIT) and the existing alert integration tests (566 tests) pass on MySQL and on PostgreSQL.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 805 → 805
- 0 added, 0 removed, 3 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/utils/apiResponse.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/webhook.ts
  openmetadata-ui/src/main/resources/ui/src/generated/type/changeEvent.ts

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 829 → 829
- 0 added, 0 removed, 3 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/utils/apiResponse.ts
  openmetadata-ui/src/main/resources/ui/playwright/utils/webhook.ts
  openmetadata-ui/src/main/resources/ui/src/generated/type/changeEvent.ts

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — stack_invalidated (2026-10-06T10:43:07Z)

The entry left the queue before it was built, so no checks ran against it.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — stack_invalidated (2026-10-06T13:07:12Z)

The entry left the queue before it was built, so no checks ran against it.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-10-06T14:09:57Z)

The entry left the queue before it was built, so no checks ran against it.

@gitar-bot

gitar-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 3 closed / 3 findings

🔴 High risk · Alert dispatch and destination-health tracking are redesigned across notification channels

Redesigns alert delivery to send each resolved address as an independent target, with content prepared once per event and health reported per destination. Addresses the prior behavior where a single failing endpoint would drop other recipients for that channel. Resolves lookup failure handling in event failure reasons, TickHealth failure ordering, and health tracking for prepare() failures.

✅ 3 closed
✅ Bug: Lookup failures counted as failed recipients in the event failure reason

📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/ChannelDispatch.java:75-83 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/ChannelDispatch.java:180-193
Failures.add is called once per failed lookup (lines 76-78) and once per failed send, but asOneFailure divides by resolved.targets().size(), which counts only the targets that were attempted. Say one team lookup fails and both found recipients get the message: the failed-event reason then reads "1 of 2 recipients failed: team X: …" when neither recipient failed. If the lookup fails and nothing was found, it reads "1 of 0 recipients failed". To fix this, keep a separate lookup-failure count, or word lookup failures differently, e.g. "recipients could not be looked up: …".

✅ Bug: TickHealth loses the first failure reason, depending on order

📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/TickHealth.java:59-73 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/TickHealth.java:97-111
lookupFailed/notAttempted set mostSerious and clear firstFailure. If a target of that destination fails later in the same tick, failed() fills firstFailure, and isMoreSerious returns false because a FAILED status is already known. sum() then replaces the reason with "N of M recipients failed. …", so the lookup failure reason is lost. In the reverse order, a later lookupFailed sets firstFailure back to null and throws away the recipient failure tally. Either way, the reported health depends on event order and hides one of the two causes. Keeping a separate field for the lookup or not-attempted reason, and adding it to the summed reason in sum(), would fix this.

✅ Bug: Failure in prepare() skips health, so the destination can stay ACTIVE

📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/ChannelDispatch.java:108-112 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/TickChannels.java:119-130 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/TickHealth.java:100-102
ChannelDispatch.sendToTargets calls first.prepare(event, content) outside IsolatedSends. For email/Slack/Teams/GChat, prepare() renders the template. If it throws (for example a broken template helper, a format error, or an EventPublisherException), the exception goes up to TickChannels.sendThrough. That method returns a Delivery.Failure and never calls health.failed(...) for the group's destinations. Because TickHealth stays silent about a destination that produced no outcome, that destination keeps its previous health (often ACTIVE) and builds no failure streak, while failedEvents and the failure rows keep growing on every tick. Before this change, the publisher's own catch block set an error status in this case. Fix: catch failures from prepare() inside ChannelDispatch and record health.failed for every origin of every resolved target. Or have TickChannels.sendThrough mark each destination in the group as failed in TickHealth before it returns the failure.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

This branch was previously deployed

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

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

4 participants