def after(self, event, state): extra = {"event_id": event.event_id} group = event.group target_type = ActionTargetType(self.data["targetType"]) if not mail_adapter.should_notify(target_type, group=group): extra["group_id"] = group.id self.logger.info("rule.fail.should_notify", extra=extra) return metrics.incr("notifications.sent", instance=self.metrics_slug, skip_internal=False) yield self.future( lambda event, futures: mail_adapter.rule_notify( event, futures, target_type, self.data.get("targetIdentifier", None) ) )
def should_notify(self, group, event): metrics.incr("mail_plugin.should_notify") return not group.project.flags.has_issue_alerts_targeting and mail_adapter.should_notify( group )