• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python notifications.event_to_record函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sentry.digests.notifications.event_to_record函数的典型用法代码示例。如果您正苦于以下问题:Python event_to_record函数的具体用法?Python event_to_record怎么用?Python event_to_record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了event_to_record函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_notify_digest

 def test_notify_digest(self, send, notify):
     project = self.event.project
     rule = project.rule_set.all()[0]
     digest = build_digest(
         project,
         (
             event_to_record(self.create_event(group=self.create_group()), (rule,)),
             event_to_record(self.event, (rule,)),
         ),
     )
     self.plugin.notify_digest(project, digest)
     assert send.call_count is 1
     assert notify.call_count is 0
开发者ID:rkeilty,项目名称:sentry,代码行数:13,代码来源:tests.py


示例2: rule_notify

    def rule_notify(self, event, futures):
        rules = []
        for future in futures:
            rules.append(future.rule)
            if not future.kwargs:
                continue
            raise NotImplementedError('The default behavior for notification de-duplication does not support args')

        project = event.group.project
        if hasattr(self, 'notify_digest') and digests.enabled(project):
            get_digest_option = lambda key: ProjectOption.objects.get_value(
                project,
                get_digest_option_key(self.get_conf_key(), key),
            )
            digest_key = unsplit_key(self, event.group.project)
            immediate_delivery = digests.add(
                digest_key,
                event_to_record(event, rules),
                increment_delay=get_digest_option('increment_delay'),
                maximum_delay=get_digest_option('maximum_delay'),
            )
            if immediate_delivery:
                deliver_digest.delay(digest_key)

        else:
            notification = Notification(
                event=event,
                rules=rules,
            )
            self.notify(notification)
开发者ID:Akashguharoy,项目名称:sentry,代码行数:30,代码来源:notify.py


示例3: rule_notify

    def rule_notify(self, event, futures):
        rules = []
        for future in futures:
            rules.append(future.rule)
            if not future.kwargs:
                continue
            raise NotImplementedError('The default behavior for notification de-duplication does not support args')

        if hasattr(self, 'notify_digest'):
            project = event.group.project

            # If digest delivery is disabled, we still need to send a
            # notification -- we also need to check rate limits, since
            # ``should_notify`` skips this step if the plugin supports digests.
            if not features.has('projects:digests:deliver', project):
                if self.__is_rate_limited(event.group, event):
                    logger = logging.getLogger('sentry.plugins.{0}'.format(self.get_conf_key()))
                    logger.info('Notification for project %r dropped due to rate limiting', project)
                    return

                notification = Notification(event=event, rules=rules)
                self.notify(notification)

            if features.has('projects:digests:store', project):
                key = unsplit_key(self, event.group.project)
                if digests.add(key, event_to_record(event, rules)):
                    deliver_digest.delay(key)

        else:
            notification = Notification(event=event, rules=rules)
            self.notify(notification)
开发者ID:haojiang1,项目名称:sentry,代码行数:31,代码来源:notify.py


示例4: test_notify_digest

    def test_notify_digest(self, has, send, notify):
        has.side_effect = lambda label, *a, **k: {
            'projects:digests:deliver': True,
        }.get(label, False)

        project = self.event.project
        rule = project.rule_set.all()[0]
        digest = build_digest(
            project,
            (
                event_to_record(self.create_event(group=self.create_group()), (rule,)),
                event_to_record(self.event, (rule,)),
            ),
        )
        self.plugin.notify_digest(project, digest)
        assert send.call_count is 1
        assert notify.call_count is 0
开发者ID:haojiang1,项目名称:sentry,代码行数:17,代码来源:tests.py


示例5: test_notify_digest_subject_prefix

    def test_notify_digest_subject_prefix(self):
        project = self.event.project
        rule = project.rule_set.all()[0]
        digest = build_digest(
            project,
            (
                event_to_record(self.create_event(group=self.create_group()), (rule,)),
                event_to_record(self.event, (rule,)),
            ),
        )
        self.plugin.notify_digest(project, digest)

        assert len(mail.outbox) == 1

        msg = mail.outbox[0]

        assert msg.subject.startswith('[Example prefix] [foo Bar]')
开发者ID:Andy-hpliu,项目名称:sentry,代码行数:17,代码来源:tests.py


示例6: test_notify_digest_single_record

 def test_notify_digest_single_record(self, send_async, notify):
     project = self.event.project
     rule = project.rule_set.all()[0]
     digest = build_digest(
         project,
         (event_to_record(self.event, (rule, )), ),
     )
     self.plugin.notify_digest(project, digest)
     assert send_async.call_count is 1
     assert notify.call_count is 1
开发者ID:Kayle009,项目名称:sentry,代码行数:10,代码来源:tests.py


示例7: test_notify_digest

    def test_notify_digest(self, notify):
        project = self.event.project
        rule = project.rule_set.all()[0]
        digest = build_digest(
            project,
            (
                event_to_record(self.create_event(group=self.create_group()), (rule, )),
                event_to_record(self.event, (rule, )),
            ),
        )

        with self.tasks():
            self.plugin.notify_digest(project, digest)

        assert notify.call_count is 0
        assert len(mail.outbox) == 1

        message = mail.outbox[0]
        assert 'List-ID' in message.message()
开发者ID:Kayle009,项目名称:sentry,代码行数:19,代码来源:tests.py


示例8: test_simple

    def test_simple(self):
        rule = self.project.rule_set.all()[0]
        records = [event_to_record(event, (rule, ))
                   for event in self.team1_events + self.team2_events + self.user4_events]
        digest = build_digest(self.project, sort_records(records))

        expected_result = {
            self.user1.id: set(self.team1_events),
            self.user2.id: set(self.team2_events),
            self.user3.id: set(self.team1_events + self.team2_events),
            self.user4.id: set(self.user4_events),
        }
        self.assert_get_personalized_digests(self.project, digest, self.user_ids, expected_result)
开发者ID:Kayle009,项目名称:sentry,代码行数:13,代码来源:test_utilities.py


示例9: rule_notify

    def rule_notify(self, event, futures):
        rules = []
        for future in futures:
            rules.append(future.rule)
            if not future.kwargs:
                continue
            raise NotImplementedError('The default behavior for notification de-duplication does not support args')

        if self.__can_be_digested(event):
            key = unsplit_key(self, event.group.project)
            if digests.add(key, event_to_record(event, rules)):
                deliver_digest.delay(key)
        else:
            notification = Notification(event=event, rules=rules)
            self.notify(notification)
开发者ID:keimlink,项目名称:sentry,代码行数:15,代码来源:notify.py


示例10: test_everyone_with_owners

 def test_everyone_with_owners(self):
     rule = self.project.rule_set.all()[0]
     events = self.create_events(
         timezone.now(), self.project, [
             'hello.moz', 'goodbye.moz', 'hola.moz', 'adios.moz'])
     records = [event_to_record(event, (rule, )) for event in events + self.team1_events]
     digest = build_digest(self.project, sort_records(records))
     expected_result = {
         self.user1.id: set(events + self.team1_events),
         self.user2.id: set(events),
         self.user3.id: set(events + self.team1_events),
         self.user4.id: set(events),
         self.user5.id: set(events),
     }
     self.assert_get_personalized_digests(self.project, digest, self.user_ids, expected_result)
开发者ID:Kayle009,项目名称:sentry,代码行数:15,代码来源:test_utilities.py


示例11: rule_notify

    def rule_notify(self, event, futures):
        rules = []
        extra = {
            'event_id': event.id,
            'group_id': event.group_id,
            'plugin': self.slug,
        }
        log_event = 'dispatched'
        for future in futures:
            rules.append(future.rule)
            extra['rule_id'] = future.rule.id
            if not future.kwargs:
                continue
            raise NotImplementedError(
                'The default behavior for notification de-duplication does not support args'
            )

        project = event.group.project
        extra['project_id'] = project.id
        if hasattr(self, 'notify_digest') and digests.enabled(project):

            def get_digest_option(key):
                return ProjectOption.objects.get_value(
                    project,
                    get_digest_option_key(self.get_conf_key(), key),
                )

            digest_key = unsplit_key(self, event.group.project)
            extra['digest_key'] = digest_key
            immediate_delivery = digests.add(
                digest_key,
                event_to_record(event, rules),
                increment_delay=get_digest_option('increment_delay'),
                maximum_delay=get_digest_option('maximum_delay'),
            )
            if immediate_delivery:
                deliver_digest.delay(digest_key)
            else:
                log_event = 'digested'

        else:
            notification = Notification(
                event=event,
                rules=rules,
            )
            self.notify(notification)

        self.logger.info('notification.%s' % log_event, extra=extra)
开发者ID:getsentry,项目名称:sentry,代码行数:48,代码来源:notify.py


示例12: rule_notify

    def rule_notify(self, event, futures):
        rules = []
        for future in futures:
            rules.append(future.rule)
            if not future.kwargs:
                continue
            raise NotImplementedError('The default behavior for notification de-duplication does not support args')

        if self.__can_be_digested(event):
            digests.add(
                unsplit_key(self, event.group.project),  # TODO: Improve this abstraction.
                event_to_record(event, rules),
            )
        else:
            notification = Notification(event=event, rules=rules)
            self.notify(notification)
开发者ID:midrissi,项目名称:sentry,代码行数:16,代码来源:notify.py


示例13: test_get_event_from_groups_in_digest

    def test_get_event_from_groups_in_digest(self):
        project = self.create_project()
        rule = project.rule_set.all()[0]
        same_group = self.create_group(project=project)

        events = [
            self.create_event(group=same_group),
            self.create_event(group=same_group),
            self.create_event(group=self.create_group(project=project)),
            self.create_event(group=self.create_group(project=project)),
            self.create_event(group=self.create_group(project=project)),
            self.create_event(group=self.create_group(project=project)),
        ]
        digest = build_digest(
            project,
            sort_records([event_to_record(event, (rule, )) for event in events]),
        )

        events.pop(0)  # remove event with same group
        assert get_event_from_groups_in_digest(digest) == set(events)
开发者ID:Kayle009,项目名称:sentry,代码行数:20,代码来源:test_utilities.py


示例14: test_team_without_members

 def test_team_without_members(self):
     team = self.create_team()
     project = self.create_project(teams=[team])
     ProjectOwnership.objects.create(
         project_id=project.id,
         schema=dump_schema([
             Rule(Matcher('path', '*.cpp'), [
                 Owner('team', team.slug),
             ]),
         ]),
         fallthrough=True,
     )
     rule = project.rule_set.all()[0]
     records = [
         event_to_record(event, (rule, )) for event in self.create_events(timezone.now(), project, [
             'hello.py', 'goodbye.py', 'hola.py', 'adios.py'])
     ]
     digest = build_digest(project, sort_records(records))
     user_ids = [member.user_id for member in team.member_set]
     assert not user_ids
     for user_id, user_digest in get_personalized_digests(project.id, digest, user_ids):
         assert False  # no users in this team no digests should be processed
开发者ID:Kayle009,项目名称:sentry,代码行数:22,代码来源:test_utilities.py


示例15: record

 def record(self):
     return event_to_record(self.event, (self.rule,))
开发者ID:Cobbyzhang,项目名称:sentry,代码行数:2,代码来源:test_notifications.py



注:本文中的sentry.digests.notifications.event_to_record函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python event_manager.generate_culprit函数代码示例发布时间:2022-05-27
下一篇:
Python notifications.build_digest函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap