Skip to content

Allow Alerts to notify Lineage downstream entities stakeholders - #23218

Merged
TeddyCr merged 7 commits into
mainfrom
feature/alert-downstream-entities
Sep 5, 2025
Merged

TeddyCr merged 7 commits into
mainfrom
feature/alert-downstream-entities

Conversation

@manerow

@manerow manerow commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

I worked on extending OpenMetadata's alert notification system to include downstream stakeholders because currently, when an alert is triggered on a data asset, only the direct stakeholders of that asset are notified.
This misses critical downstream consumers who depend on the affected data.

Key changes:

  • Added notifyDownstream and downstreamDepth fields to SubscriptionDestination schema to enable opt-in downstream notifications
  • Created LineageGraphExplorer utility class for cycle-safe lineage graph traversal using DFS with configurable depth limits
  • Modified SubscriptionUtil.getTargetsForAlert() to expand notifications to downstream entity stakeholders when enabled
  • Updated all publisher classes (Email, Slack, Teams, GChat, Generic) to pass the full SubscriptionDestination object

Testing approach:

  • Created comprehensive integration tests for LineageGraphExplorer with real database and lineage data
  • Tested linear traversal, cycle detection, depth limiting, and complex mixed-entity graphs
  • Verified backward compatibility - all existing notification behavior remains unchanged
  • Ran existing publisher tests to ensure no regressions

Additional Notes:

  • No database migration required - the event_subscription_entity table stores EventSubscription objects as JSON, automatically accommodating new schema fields
  • Feature is opt-in with notifyDownstream: false by default, ensuring zero impact on existing subscriptions
  • Depth limiting and cycle detection prevent performance issues in complex lineage graphs
  • Excludes EXTERNAL category from downstream expansion to prevent notifications to external systems about indirect relationships

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • The issue properly describes why the new feature is needed, what's the goal, and how we are building it. Any discussion
    or decision-making process is reflected in the issue.
  • I have updated the documentation.
  • I have added tests around the new logic.

@manerow manerow self-assigned this Sep 3, 2025
@manerow manerow added the safe to test Add this label to run secure Github workflows on PRs label Sep 3, 2025
@manerow
manerow requested review from a team as code owners September 3, 2025 10:22
@manerow manerow added backend area:alerts-notifications Change events, event subscriptions, alerts, notification templates and channels, email. labels Sep 3, 2025
@manerow manerow added this to Roadmap Sep 3, 2025
@manerow manerow moved this to Data Observability in Roadmap Sep 3, 2025
@manerow
manerow force-pushed the feature/alert-downstream-entities branch from fbb9d62 to 4649427 Compare September 3, 2025 15:15
@github-actions

github-actions Bot commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

TypeScript types have been updated based on the JSON schema changes in the PR

}

public Set<EntityReference> findUniqueEntitiesDownstream(UUID id, String type, Integer maxDepth) {
if (maxDepth != null && maxDepth == 0) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be (maxDepth != null || maxDepth == 0)

@TeddyCr TeddyCr Sep 4, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also do maxDepth <= 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

  • (maxDepth != null || maxDepth == 0) could cause an NPE.
  • Agreed on <= 0. For non-null values we should stop when maxDepth <= 0.

Since null means unlimited traversal and 0 (or negative) means no traversal, I’ll keep it as:

if (maxDepth != null && maxDepth <= 0) {
  return Set.of();
}

@github-actions

github-actions Bot commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

TypeScript types have been updated based on the JSON schema changes in the PR

@sonarqubecloud

sonarqubecloud Bot commented Sep 5, 2025

Copy link
Copy Markdown

@TeddyCr
TeddyCr merged commit 571d7ee into main Sep 5, 2025
@TeddyCr
TeddyCr deleted the feature/alert-downstream-entities branch September 5, 2025 10:49
@github-project-automation github-project-automation Bot moved this from Data Observability to Done in Roadmap Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:alerts-notifications Change events, event subscriptions, alerts, notification templates and channels, email. backend safe to test Add this label to run secure Github workflows on PRs

Projects

Status: Done ✅

Development

Successfully merging this pull request may close these issues.

2 participants