def deliver_digest(key, schedule_timestamp=None): from sentry import digests from sentry.mail import mail_adapter try: project, target_type, target_identifier = split_key(key) except Project.DoesNotExist as error: logger.info("Cannot deliver digest %r due to error: %s", key, error) digests.delete(key) return minimum_delay = ProjectOption.objects.get_value( project, get_option_key("mail", "minimum_delay")) with snuba.options_override({"consistent": True}): try: with digests.digest(key, minimum_delay=minimum_delay) as records: digest = build_digest(project, records) except InvalidState as error: logger.info("Skipped digest delivery: %s", error, exc_info=True) return if digest: mail_adapter.notify_digest(project, digest, target_type, target_identifier)
def deliver_digest(key, schedule_timestamp=None): from sentry import digests from sentry.mail import mail_adapter try: project, target_type, target_identifier = split_key(key) except Project.DoesNotExist as error: logger.info(f"Cannot deliver digest {key} due to error: {error}") digests.delete(key) return minimum_delay = ProjectOption.objects.get_value( project, get_option_key("mail", "minimum_delay")) with snuba.options_override({"consistent": True}): try: with digests.digest(key, minimum_delay=minimum_delay) as records: digest, logs = build_digest(project, records) except InvalidState as error: logger.info(f"Skipped digest delivery: {error}", exc_info=True) return if digest: mail_adapter.notify_digest(project, digest, target_type, target_identifier) else: logger.info( "Skipped digest delivery due to empty digest", extra={ "project": project.id, "target_type": target_type.value, "target_identifier": target_identifier, "build_digest_logs": logs, }, )
def deliver_digest(key, schedule_timestamp=None): from sentry import digests from sentry.models import ProjectOption # Django 1.9 setup issue from sentry.models import Project # Django 1.9 setup issue try: plugin, project = split_key(key) except Project.DoesNotExist as error: logger.info('Cannot deliver digest %r due to error: %s', key, error) digests.delete(key) return minimum_delay = ProjectOption.objects.get_value( project, get_option_key(plugin.get_conf_key(), 'minimum_delay')) with snuba.options_override({'consistent': True}): try: with digests.digest(key, minimum_delay=minimum_delay) as records: digest = build_digest(project, records) except InvalidState as error: logger.info('Skipped digest delivery: %s', error, exc_info=True) return if digest: plugin.notify_digest(project, digest)
def deliver_digest(key, schedule_timestamp=None): from sentry.app import digests try: plugin, project = split_key(key) except Project.DoesNotExist as error: logger.info('Cannot deliver digest %r due to error: %s', key, error) digests.delete(key) return minimum_delay = ProjectOption.objects.get_value( project, get_option_key(plugin.get_conf_key(), 'minimum_delay') ) with digests.digest(key, minimum_delay=minimum_delay) as records: digest = build_digest(project, records) if digest: plugin.notify_digest(project, digest)
def deliver_digest(key, schedule_timestamp=None): from sentry import digests try: plugin, project = split_key(key) except Project.DoesNotExist as error: logger.info('Cannot deliver digest %r due to error: %s', key, error) digests.delete(key) return minimum_delay = ProjectOption.objects.get_value( project, get_option_key(plugin.get_conf_key(), 'minimum_delay') ) with snuba.options_override({'consistent': True}): try: with digests.digest(key, minimum_delay=minimum_delay) as records: digest = build_digest(project, records) except InvalidState as error: logger.info('Skipped digest delivery: %s', error, exc_info=True) return if digest: plugin.notify_digest(project, digest)