OpenMetadata
OpenMetadata copied to clipboard
Alerts Not Triggering for Failed DQ Test Cases After Upgrade to 1.5.4
Description: SMTP alerting for failed DQ (Data Quality) test cases on table followers has stopped working. The system seems to be detecting events correctly, but no alert emails are being sent.
Steps to Reproduce:
- Upgrade OpenMetadata from version 1.4.3 to 1.5.4.
- Set up SMTP email alerts for failed DQ test cases.
- Run tests that generate DQ test failures.
- Monitor if alert emails are sent to the configured followers.
Expected Behavior: Email alerts should be triggered and sent to the followers when a DQ test case fails.
Observed Behavior:
- Subscriptions are correctly detecting change events.
- Alert triggers are being evaluated properly.
- Quartz alert jobs are being created as expected.
- However, no alert emails are being sent for failed DQ test cases.
Environment:
- OpenMetadata Version: 1.5.4
- Previous Version: 1.4.3 (where the issue was not present)
- SMTP setup is confirmed to be working and has not changed since the upgrade.
hey, we were able to unblock TestCase and TestSuite followers/owners alerting by this workaround, probably in notifications there are more entities wich may need some logic for extracting owners/followers,
---
Index: openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java
--- a/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java (revision 95ef74c8de81c7dc84045a71df4fee42d983058a)
+++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java (revision f60abbb5e794b2ed6f48e6f50d1943ba8609ceb4)
@@ -305,6 +305,33 @@
return Optional.empty();
}
+ private static Set<UUID> findTablesForTestSuite(UUID testSuiteId , CollectionDAO daoCollection) {
+
+ Set<UUID> tableIds = new HashSet<>();
+ List<CollectionDAO.EntityRelationshipRecord> tables = daoCollection.relationshipDAO()
+ .findFrom(testSuiteId, Entity.TEST_SUITE,Relationship.CONTAINS.ordinal());
+
+ tables.forEach(table-> tableIds.add(table.getId()));
+
+ return tableIds;
+ }
+
+ private static Set<UUID> findRelatedEntities(UUID entityId, String entityType, CollectionDAO daoCollection) {
+ Set<UUID> relatedEntityIds = new HashSet<>();
+
+ if (Entity.TEST_CASE.equals(entityType)) {
+ List<CollectionDAO.EntityRelationshipRecord> testSuites = daoCollection.relationshipDAO()
+ .findFrom(entityId, Entity.TEST_CASE, Relationship.CONTAINS.ordinal());
+ testSuites.forEach( testSuite -> relatedEntityIds.addAll(findTablesForTestSuite(testSuite.getId(),daoCollection)));
+ } else if (Entity.TEST_SUITE.equals(entityType)) {
+ relatedEntityIds.addAll(findTablesForTestSuite(entityId, daoCollection));
+ } else {
+ throw new IllegalArgumentException("findRelatedEntities: Unsupported entity type: "+ entityType);
+ }
+
+ return relatedEntityIds;
+ }
+
public static Set<String> buildReceiversListFromActions(
SubscriptionAction action,
SubscriptionDestination.SubscriptionCategory category,
@@ -338,22 +365,35 @@
receiverList = action.getReceivers() == null ? receiverList : action.getReceivers();
}
+ Set<UUID> relatedEntityIds = Set.of(entityId);
+ String relatedEntityType = entityType;
+
+ if (Entity.TEST_SUITE.equals(entityType) || Entity.TEST_CASE.equals(entityType)) {
+ relatedEntityIds = findRelatedEntities(entityId , entityType ,daoCollection);
+ relatedEntityType = Entity.TABLE;
+ }
+
// Send to Admins
if (Boolean.TRUE.equals(action.getSendToAdmins())) {
receiverList.addAll(getAdminsData(type));
}
- // Send To Owners
- if (Boolean.TRUE.equals(action.getSendToOwners())) {
- receiverList.addAll(
- getOwnerOrFollowers(type, daoCollection, entityId, entityType, Relationship.OWNS));
- }
+ for (UUID relatedentityId : relatedEntityIds) {
+
+ // Send To Owners
+ if (Boolean.TRUE.equals(action.getSendToOwners())) {
+ receiverList.addAll(
+ getOwnerOrFollowers(type, daoCollection, relatedentityId, relatedEntityType, Relationship.OWNS));
+ }
- // Send To Followers
- if (Boolean.TRUE.equals(action.getSendToFollowers())) {
- receiverList.addAll(
- getOwnerOrFollowers(type, daoCollection, entityId, entityType, Relationship.FOLLOWS));
+ // Send To Followers
+ if (Boolean.TRUE.equals(action.getSendToFollowers())) {
+ receiverList.addAll(
+ getOwnerOrFollowers(type, daoCollection, relatedentityId, relatedEntityType, Relationship.FOLLOWS));
+ }
}
+
+ LOG.debug("Action receiversList :" + receiverList.toString());
return receiverList;
}
Resolved here: https://github.com/open-metadata/OpenMetadata/pull/18181