当前位置: 首页>>代码示例>>Python>>正文


Python Event.message方法代码示例

本文整理汇总了Python中sentry.models.Event.message方法的典型用法代码示例。如果您正苦于以下问题:Python Event.message方法的具体用法?Python Event.message怎么用?Python Event.message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sentry.models.Event的用法示例。


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

示例1: test_notify_users_does_email

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_does_email(self, _send_mail):
        project = Project(id=1, name='Project Name')

        group = Group()
        group.first_seen = timezone.now()
        group.last_seen = group.first_seen
        group.project = project
        group.id = 2

        event = Event()
        event.group = group
        event.message = 'hello world'
        event.logger = 'root'
        event.project = project
        event.date = group.last_seen

        with self.Settings(SENTRY_URL_PREFIX='http://example.com'):
            p = MailProcessor(send_to=['[email protected]m'])
            p.notify_users(group, event)

        _send_mail.assert_called_once()
        args, kwargs = _send_mail.call_args
        self.assertEquals(kwargs.get('fail_silently'), False)
        self.assertEquals(kwargs.get('project'), project)
        self.assertEquals(kwargs.get('subject'), u"[Project Name] ERROR: hello world")
开发者ID:Crowdbooster,项目名称:sentry,代码行数:27,代码来源:tests.py

示例2: test_notify_users_renders_interfaces_with_utf8_fix_issue_422

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_renders_interfaces_with_utf8_fix_issue_422(self, _send_mail):
        group = Group(
            id=2,
            first_seen=timezone.now(),
            last_seen=timezone.now(),
            project=self.project,
        )

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_email_html.return_value = u'רונית מגן'
        stacktrace.get_title.return_value = 'Stacktrace'

        event = Event()
        event.group = group
        event.project = self.project
        event.message = 'Soubor ji\xc5\xbe existuje'
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        notification = Notification(event=event)

        with self.options({'system.url-prefix': 'http://example.com'}):
            self.plugin.notify(notification)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_email_html.assert_called_once_with(event)
开发者ID:rkeilty,项目名称:sentry,代码行数:27,代码来源:tests.py

示例3: test_notify_users_renders_interfaces_with_utf8

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_renders_interfaces_with_utf8(self, _send_mail):
        group = Group(
            id=2,
            first_seen=timezone.now(),
            last_seen=timezone.now(),
            project=self.project,
        )

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_email_html.return_value = u'רונית מגן'
        stacktrace.get_title.return_value = 'Stacktrace'

        event = Event()
        event.group = group
        event.project = self.project
        event.message = 'hello world'
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        notification = Notification(event=event)

        with self.settings(SENTRY_URL_PREFIX='http://example.com'):
            self.plugin.notify(notification)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_email_html.assert_called_once_with(event)
开发者ID:Natim,项目名称:sentry,代码行数:27,代码来源:tests.py

示例4: test_notify_users_renders_interfaces_with_utf8

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_renders_interfaces_with_utf8(self, _send_mail):
        group = Group(
            id=2,
            first_seen=timezone.now(),
            last_seen=timezone.now(),
            project=self.project,
        )

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_string.return_value = u'רונית מגן'
        stacktrace.get_title.return_value = 'Stacktrace'

        event = Event()
        event.group = group
        event.message = 'hello world'
        event.logger = 'root'
        event.site = None
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        with self.Settings(SENTRY_URL_PREFIX='http://example.com'):
            p = MailProcessor(send_to=['[email protected]'])
            p.notify_users(group, event)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_string.assert_called_once_with(event)
开发者ID:DamianZaremba,项目名称:sentry,代码行数:27,代码来源:tests.py

示例5: test_notify_users_renders_interfaces_with_utf8_fix_issue_422

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_renders_interfaces_with_utf8_fix_issue_422(self, _send_mail):
        group = Group(
            id=2,
            first_seen=timezone.now(),
            last_seen=timezone.now(),
            project=self.project,
        )

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_email_html.return_value = u'רונית מגן'
        stacktrace.get_title.return_value = 'Stacktrace'

        event = Event()
        event.group = group
        event.project = self.project
        event.message = 'Soubor ji\xc5\xbe existuje'
        event.logger = 'root'
        event.site = None
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        with self.settings(SENTRY_URL_PREFIX='http://example.com'):
            self.plugin.notify_users(group, event)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_email_html.assert_called_once_with(event)
开发者ID:flecno,项目名称:sentry,代码行数:27,代码来源:tests.py

示例6: test_notify_users_does_email

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_does_email(self, _send_mail):
        project = Project(id=1, name="Project Name")

        group = Group()
        group.first_seen = datetime.datetime.now()
        group.last_seen = group.first_seen
        group.project = project
        group.id = 2

        event = Event()
        event.group = group
        event.message = "hello world"
        event.logger = "root"
        event.project = project
        event.date = group.last_seen

        with self.Settings(SENTRY_URL_PREFIX="http://example.com"):
            p = MailProcessor(send_to=["[email protected]"])
            p.notify_users(group, event)

        _send_mail.assert_called_once()
        args, kwargs = _send_mail.call_args
        self.assertEquals(kwargs.get("fail_silently"), False)
        self.assertEquals(kwargs.get("project"), project)
        self.assertEquals(kwargs.get("subject"), u"[Project Name] ERROR: hello world")
开发者ID:urbaniak,项目名称:sentry,代码行数:27,代码来源:tests.py

示例7: test_mail_members_renders_interfaces

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_mail_members_renders_interfaces(self, _send_mail):
        group = Mock(spec=Group)
        group.first_seen = datetime.datetime.now()
        group.get_absolute_url.return_value = '/example'
        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_string.return_value = 'foo bar'
        stacktrace.get_title.return_value = 'Stacktrace'
        event = Event()
        event.message = 'hello world'
        event.logger = 'root'
        event.site = None
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        with self.Settings(SENTRY_URL_PREFIX='http://example.com'):
            p = MailProcessor(send_to=['[email protected]'])
            p.mail_members(group, event)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_string.assert_called_once_with(event)
开发者ID:buriy,项目名称:django-sentry,代码行数:21,代码来源:tests.py

示例8: test_notify_users_renders_interfaces_with_utf8_fix_issue_422

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_renders_interfaces_with_utf8_fix_issue_422(self, _send_mail):
        group = Group(id=2, first_seen=timezone.now(), last_seen=timezone.now(), project=self.project)

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_email_html.return_value = u"רונית מגן"
        stacktrace.get_title.return_value = "Stacktrace"

        event = Event()
        event.group = group
        event.project = self.project
        event.message = "Soubor ji\xc5\xbe existuje"
        event.interfaces = {"sentry.interfaces.Stacktrace": stacktrace}

        notification = Notification(event=event)

        with self.settings(SENTRY_URL_PREFIX="http://example.com"):
            self.plugin.notify(notification)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_email_html.assert_called_once_with(event)
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:22,代码来源:tests.py

示例9: test_multiline_error

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_multiline_error(self, _send_mail):
        project = Project(id=1, name='Project Name')

        group = Mock(spec=Group)
        group.first_seen = datetime.datetime.now()
        group.project_id = project.id
        group.project = project
        group.id = 2

        event = Event()
        event.message = 'hello world\nfoo bar'
        event.logger = 'root'
        event.site = None
        event.project_id = project.id
        event.project = project

        with self.Settings(SENTRY_URL_PREFIX='http://example.com'):
            p = MailProcessor(send_to=['[email protected]'])
            p.notify_users(group, event)

        _send_mail.assert_called_once()
        args, kwargs = _send_mail.call_args
        self.assertEquals(kwargs.get('subject'), u"[Project Name] ERROR: hello world")
开发者ID:luiscar16,项目名称:sentry,代码行数:25,代码来源:tests.py

示例10: test_notify_users_renders_interfaces_with_utf8_fix_issue_422

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_renders_interfaces_with_utf8_fix_issue_422(self, _send_mail):
        group = Group()
        group.first_seen = timezone.now()
        group.last_seen = group.first_seen
        group.id = 2
        group.project_id = 1

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_string.return_value = u'רונית מגן'
        stacktrace.get_title.return_value = 'Stacktrace'

        event = Event()
        event.group = group
        event.message = 'Soubor ji\xc5\xbe existuje'
        event.logger = 'root'
        event.site = None
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        with self.Settings(SENTRY_URL_PREFIX='http://example.com'):
            p = MailProcessor(send_to=['[email protected]'])
            p.notify_users(group, event)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_string.assert_called_once_with(event)
开发者ID:Crowdbooster,项目名称:sentry,代码行数:26,代码来源:tests.py

示例11: test_notify_users_renders_interfaces

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_renders_interfaces(self, _send_mail):
        group = Group(
            id=2,
            first_seen=timezone.now(),
            last_seen=timezone.now(),
            project=self.project,
        )

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_email_html.return_value = 'foo bar'
        stacktrace.get_title.return_value = 'Stacktrace'

        event = Event()
        event.group = group
        event.message = 'hello world'
        event.logger = 'root'
        event.site = None
        event.interfaces = {'sentry.interfaces.Stacktrace': stacktrace}

        with self.Settings(SENTRY_URL_PREFIX='http://example.com'):
            self.plugin.notify_users(group, event)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_email_html.assert_called_once_with(event)
开发者ID:arty-name,项目名称:sentry,代码行数:26,代码来源:tests.py

示例12: test_notify_users_renders_interfaces_with_utf8

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def test_notify_users_renders_interfaces_with_utf8(self, _send_mail):
        group = Group()
        group.first_seen = datetime.datetime.now()
        group.last_seen = group.first_seen
        group.id = 2
        group.project_id = 1

        stacktrace = Mock(spec=Stacktrace)
        stacktrace.to_string.return_value = u"רונית מגן"
        stacktrace.get_title.return_value = "Stacktrace"

        event = Event()
        event.group = group
        event.message = "hello world"
        event.logger = "root"
        event.site = None
        event.interfaces = {"sentry.interfaces.Stacktrace": stacktrace}

        with self.Settings(SENTRY_URL_PREFIX="http://example.com"):
            p = MailProcessor(send_to=["[email protected]"])
            p.notify_users(group, event)

        stacktrace.get_title.assert_called_once_with()
        stacktrace.to_string.assert_called_once_with(event)
开发者ID:urbaniak,项目名称:sentry,代码行数:26,代码来源:tests.py

示例13: save

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def save(self, project, raw=False):
        from sentry.tasks.post_process import index_event_tags

        project = Project.objects.get_from_cache(id=project)

        data = self.data.copy()

        # First we pull out our top-level (non-data attr) kwargs
        event_id = data.pop('event_id')
        level = data.pop('level')

        culprit = data.pop('transaction', None)
        if not culprit:
            culprit = data.pop('culprit', None)
        logger_name = data.pop('logger', None)
        server_name = data.pop('server_name', None)
        site = data.pop('site', None)
        checksum = data.pop('checksum', None)
        fingerprint = data.pop('fingerprint', None)
        platform = data.pop('platform', None)
        release = data.pop('release', None)
        dist = data.pop('dist', None)
        environment = data.pop('environment', None)

        # unused
        time_spent = data.pop('time_spent', None)
        message = data.pop('message', '')

        if not culprit:
            # if we generate an implicit culprit, lets not call it a
            # transaction
            transaction_name = None
            culprit = generate_culprit(data, platform=platform)
        else:
            transaction_name = culprit

        date = datetime.fromtimestamp(data.pop('timestamp'))
        date = date.replace(tzinfo=timezone.utc)

        kwargs = {
            'platform': platform,
        }

        event = Event(
            project_id=project.id,
            event_id=event_id,
            data=data,
            time_spent=time_spent,
            datetime=date,
            **kwargs
        )
        event._project_cache = project

        # convert this to a dict to ensure we're only storing one value per key
        # as most parts of Sentry dont currently play well with multiple values
        tags = dict(data.get('tags') or [])
        tags['level'] = LOG_LEVELS[level]
        if logger_name:
            tags['logger'] = logger_name
        if server_name:
            tags['server_name'] = server_name
        if site:
            tags['site'] = site
        if environment:
            tags['environment'] = environment
        if transaction_name:
            tags['transaction'] = transaction_name

        if release:
            # dont allow a conflicting 'release' tag
            if 'release' in tags:
                del tags['release']
            release = Release.get_or_create(
                project=project,
                version=release,
                date_added=date,
            )

            tags['sentry:release'] = release.version

        if dist and release:
            dist = release.add_dist(dist, date)
            tags['sentry:dist'] = dist.name
        else:
            dist = None

        event_user = self._get_event_user(project, data)
        if event_user:
            # dont allow a conflicting 'user' tag
            if 'user' in tags:
                del tags['user']
            tags['sentry:user'] = event_user.tag_value

        # At this point we want to normalize the in_app values in case the
        # clients did not set this appropriately so far.
        normalize_in_app(data)

        for plugin in plugins.for_project(project, version=None):
            added_tags = safe_execute(plugin.get_tags, event, _with_transaction=False)
            if added_tags:
#.........这里部分代码省略.........
开发者ID:alshopov,项目名称:sentry,代码行数:103,代码来源:event_manager.py

示例14: save

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def save(self, project, raw=False):
        from sentry.tasks.post_process import index_event_tags
        data = self.data

        project = Project.objects.get_from_cache(id=project)

        # Check to make sure we're not about to do a bunch of work that's
        # already been done if we've processed an event with this ID. (This
        # isn't a perfect solution -- this doesn't handle ``EventMapping`` and
        # there's a race condition between here and when the event is actually
        # saved, but it's an improvement. See GH-7677.)
        try:
            event = Event.objects.get(
                project_id=project.id,
                event_id=data['event_id'],
            )
        except Event.DoesNotExist:
            pass
        else:
            self.logger.info(
                'duplicate.found',
                exc_info=True,
                extra={
                    'event_uuid': data['event_id'],
                    'project_id': project.id,
                    'model': Event.__name__,
                }
            )
            return event

        # First we pull out our top-level (non-data attr) kwargs
        event_id = data.pop('event_id')
        level = data.pop('level')
        transaction_name = data.pop('transaction', None)
        culprit = data.pop('culprit', None)
        logger_name = data.pop('logger', None)
        server_name = data.pop('server_name', None)
        site = data.pop('site', None)
        checksum = data.pop('checksum', None)
        fingerprint = data.pop('fingerprint', None)
        platform = data.pop('platform', None)
        release = data.pop('release', None)
        dist = data.pop('dist', None)
        environment = data.pop('environment', None)

        # unused
        time_spent = data.pop('time_spent', None)
        message = data.pop('message', '')

        if not culprit:
            if transaction_name:
                culprit = transaction_name
            else:
                culprit = generate_culprit(data, platform=platform)

        culprit = force_text(culprit)
        if transaction_name:
            transaction_name = force_text(transaction_name)

        recorded_timestamp = data.pop('timestamp')
        date = datetime.fromtimestamp(recorded_timestamp)
        date = date.replace(tzinfo=timezone.utc)

        kwargs = {
            'platform': platform,
        }

        event = Event(
            project_id=project.id,
            event_id=event_id,
            data=data,
            time_spent=time_spent,
            datetime=date,
            **kwargs
        )
        event._project_cache = project
        data = event.data.data

        # convert this to a dict to ensure we're only storing one value per key
        # as most parts of Sentry dont currently play well with multiple values
        tags = dict(data.get('tags') or [])
        tags['level'] = LOG_LEVELS[level]
        if logger_name:
            tags['logger'] = logger_name
        if server_name:
            tags['server_name'] = server_name
        if site:
            tags['site'] = site
        if environment:
            tags['environment'] = environment
        if transaction_name:
            tags['transaction'] = transaction_name

        if release:
            # dont allow a conflicting 'release' tag
            if 'release' in tags:
                del tags['release']
            release = Release.get_or_create(
                project=project,
                version=release,
#.........这里部分代码省略.........
开发者ID:mjumbewu,项目名称:sentry,代码行数:103,代码来源:event_manager.py

示例15: save

# 需要导入模块: from sentry.models import Event [as 别名]
# 或者: from sentry.models.Event import message [as 别名]
    def save(self, project, raw=False):
        from sentry.tasks.post_process import index_event_tags

        project = Project.objects.get_from_cache(id=project)

        data = self.data.copy()

        # First we pull out our top-level (non-data attr) kwargs
        event_id = data.pop('event_id')
        level = data.pop('level')

        culprit = data.pop('culprit', None)
        logger_name = data.pop('logger', None)
        server_name = data.pop('server_name', None)
        site = data.pop('site', None)
        checksum = data.pop('checksum', None)
        fingerprint = data.pop('fingerprint', None)
        platform = data.pop('platform', None)
        release = data.pop('release', None)
        environment = data.pop('environment', None)

        # unused
        time_spent = data.pop('time_spent', None)
        message = data.pop('message', '')

        if not culprit:
            culprit = generate_culprit(data, platform=platform)

        date = datetime.fromtimestamp(data.pop('timestamp'))
        date = date.replace(tzinfo=timezone.utc)

        kwargs = {
            'platform': platform,
        }

        event = Event(
            project_id=project.id,
            event_id=event_id,
            data=data,
            time_spent=time_spent,
            datetime=date,
            **kwargs
        )

        tags = data.get('tags') or []
        tags.append(('level', LOG_LEVELS[level]))
        if logger_name:
            tags.append(('logger', logger_name))
        if server_name:
            tags.append(('server_name', server_name))
        if site:
            tags.append(('site', site))
        if release:
            # TODO(dcramer): we should ensure we create Release objects
            tags.append(('sentry:release', release))
        if environment:
            tags.append(('environment', environment))

        for plugin in plugins.for_project(project, version=None):
            added_tags = safe_execute(plugin.get_tags, event,
                                      _with_transaction=False)
            if added_tags:
                tags.extend(added_tags)

        event_user = self._get_event_user(project, data)
        if event_user:
            tags.append(('sentry:user', event_user.tag_value))

        # XXX(dcramer): we're relying on mutation of the data object to ensure
        # this propagates into Event
        data['tags'] = tags

        data['fingerprint'] = fingerprint or ['{{ default }}']

        for path, iface in event.interfaces.iteritems():
            data['tags'].extend(iface.iter_tags())
            # Get rid of ephemeral interface data
            if iface.ephemeral:
                data.pop(iface.get_path(), None)

        # prioritize fingerprint over checksum as its likely the client defaulted
        # a checksum whereas the fingerprint was explicit
        if fingerprint:
            hashes = map(md5_from_hash, get_hashes_from_fingerprint(event, fingerprint))
        elif checksum:
            hashes = [checksum]
        else:
            hashes = map(md5_from_hash, get_hashes_for_event(event))

        # TODO(dcramer): temp workaround for complexity
        data['message'] = message
        event_type = eventtypes.get(data.get('type', 'default'))(data)
        event_metadata = event_type.get_metadata()
        # TODO(dcramer): temp workaround for complexity
        del data['message']

        data['type'] = event_type.key
        data['metadata'] = event_metadata

        # index components into ``Event.message``
#.........这里部分代码省略.........
开发者ID:davgit,项目名称:sentry,代码行数:103,代码来源:event_manager.py


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