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


Python EventManager.get_data方法代码示例

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


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

示例1: test_returns_cannonical_dict

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_returns_cannonical_dict():
    from sentry.utils.canonical import CanonicalKeyDict

    event = make_event()

    manager = EventManager(event)
    assert isinstance(manager.get_data(), CanonicalKeyDict)
    manager.normalize()
    assert isinstance(manager.get_data(), CanonicalKeyDict)
开发者ID:yaoqi,项目名称:sentry,代码行数:11,代码来源:test_normalization.py

示例2: test_invalid_tags

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
 def test_invalid_tags(self):
     manager = EventManager(make_event(**{
         'tags': [42],
     }))
     manager.normalize()
     assert None in manager.get_data().get('tags', [])
     assert 42 not in manager.get_data().get('tags', [])
     event = manager.save(self.project.id)
     assert 42 not in event.tags
     assert None not in event.tags
开发者ID:yaoqi,项目名称:sentry,代码行数:12,代码来源:test_event_manager.py

示例3: test_logger

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_logger():
    manager = EventManager(make_event(logger="foo\nbar"))
    manager.normalize()
    data = manager.get_data()
    assert data['logger'] == DEFAULT_LOGGER_NAME

    manager = EventManager(make_event(logger=""))
    manager.normalize()
    data = manager.get_data()
    assert data['logger'] == DEFAULT_LOGGER_NAME
开发者ID:yaoqi,项目名称:sentry,代码行数:12,代码来源:test_normalization.py

示例4: test_logger

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_logger():
    manager = EventManager(make_event(logger="foo\nbar"))
    manager.normalize()
    data = manager.get_data()
    assert data['logger'] == DEFAULT_LOGGER_NAME

    manager = EventManager(make_event(logger=""))
    manager.normalize()
    data = manager.get_data()
    assert data['logger'] == DEFAULT_LOGGER_NAME
    assert not any(e.get('name') == 'logger' for e in data['errors'])
开发者ID:Kayle009,项目名称:sentry,代码行数:13,代码来源:test_normalization.py

示例5: get

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
    def get(self, request):
        org = Organization(
            id=1,
            slug='organization',
            name='My Company',
        )
        project = Project(
            id=1,
            organization=org,
            slug='project',
            name='My Project',
        )

        group = next(
            make_group_generator(
                get_random(request),
                project,
            ),
        )

        data = dict(load_data('python'))
        data['message'] = group.message
        data.pop('logentry', None)

        event_manager = EventManager(data)
        event_manager.normalize()
        data = event_manager.get_data()
        event_type = event_manager.get_event_type()

        group.message = event_manager.get_search_message()
        group.data = {
            'type': event_type.key,
            'metadata': event_type.get_metadata(data),
        }

        event = Event(
            id=1,
            project=project,
            message=event_manager.get_search_message(),
            group=group,
            datetime=datetime(2016, 6, 13, 3, 8, 24, tzinfo=timezone.utc),
            data=event_manager.get_data()
        )

        activity = Activity(
            group=event.group, project=event.project, **self.get_activity(request, event)
        )

        return render_to_response(
            'sentry/debug/mail/preview.html', {
                'preview': ActivityMailPreview(request, activity),
                'format': request.GET.get('format'),
            }
        )
开发者ID:yaoqi,项目名称:sentry,代码行数:56,代码来源:mail.py

示例6: test_event_id_lowercase

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_event_id_lowercase():
    manager = EventManager(make_event(event_id='1234ABCD' * 4))
    manager.normalize()
    data = manager.get_data()

    assert data['event_id'] == '1234abcd' * 4

    manager = EventManager(make_event(event_id=u'1234ABCD' * 4))
    manager.normalize()
    data = manager.get_data()

    assert data['event_id'] == '1234abcd' * 4
开发者ID:Kayle009,项目名称:sentry,代码行数:14,代码来源:test_normalization.py

示例7: test_long_culprit

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_long_culprit():
    manager = EventManager(make_event(
        culprit='x' * (MAX_CULPRIT_LENGTH + 1),
    ))
    manager.normalize()
    data = manager.get_data()
    assert len(data['culprit']) == MAX_CULPRIT_LENGTH
开发者ID:Kayle009,项目名称:sentry,代码行数:9,代码来源:test_normalization.py

示例8: test_long_transaction

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_long_transaction():
    manager = EventManager(make_event(
        transaction='x' * (MAX_CULPRIT_LENGTH + 1),
    ))
    manager.normalize()
    data = manager.get_data()
    assert len(data['transaction']) == MAX_CULPRIT_LENGTH
开发者ID:Kayle009,项目名称:sentry,代码行数:9,代码来源:test_normalization.py

示例9: test_moves_stacktrace_to_exception

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_moves_stacktrace_to_exception():
    manager = EventManager(
        make_event(
            exception={
                'type': 'MyException',
            },
            stacktrace={
                'frames': [
                    {
                        'lineno': 1,
                        'filename': 'foo.py',
                    }, {
                        'lineno': 1,
                        'filename': 'bar.py',
                    }
                ]
            }
        )
    )
    manager.normalize()
    data = manager.get_data()

    frames = data['exception']['values'][0]['stacktrace']['frames']
    assert frames[0]['lineno'] == 1
    assert frames[0]['filename'] == 'foo.py'
    assert frames[1]['lineno'] == 1
    assert frames[1]['filename'] == 'bar.py'
    assert 'stacktrace' not in data
开发者ID:Kayle009,项目名称:sentry,代码行数:30,代码来源:test_normalization.py

示例10: create_event

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
    def create_event(group, event_id=None, normalize=True, **kwargs):
        # XXX: Do not use this method for new tests! Prefer `store_event`.
        if event_id is None:
            event_id = uuid4().hex
        kwargs.setdefault('project', group.project)
        kwargs.setdefault('data', copy.deepcopy(DEFAULT_EVENT_DATA))
        kwargs.setdefault('platform', kwargs['data'].get('platform', 'python'))
        kwargs.setdefault('message', kwargs['data'].get('message', 'message'))
        if kwargs.get('tags'):
            tags = kwargs.pop('tags')
            if isinstance(tags, dict):
                tags = list(tags.items())
            kwargs['data']['tags'] = tags
        if kwargs.get('stacktrace'):
            stacktrace = kwargs.pop('stacktrace')
            kwargs['data']['stacktrace'] = stacktrace

        user = kwargs.pop('user', None)
        if user is not None:
            kwargs['data']['user'] = user

        kwargs['data'].setdefault(
            'errors', [{
                'type': EventError.INVALID_DATA,
                'name': 'foobar',
            }]
        )

        # maintain simple event Factories by supporting the legacy message
        # parameter just like our API would
        if 'logentry' not in kwargs['data']:
            kwargs['data']['logentry'] = {
                'message': kwargs['message'] or '<unlabeled event>',
            }

        if normalize:
            manager = EventManager(CanonicalKeyDict(kwargs['data']))
            manager.normalize()
            kwargs['data'] = manager.get_data()
            kwargs['data'].update(manager.materialize_metadata())
            kwargs['message'] = manager.get_search_message()

        # This is needed so that create_event saves the event in nodestore
        # under the correct key. This is usually dont in EventManager.save()
        kwargs['data'].setdefault(
            'node_id',
            Event.generate_node_id(kwargs['project'].id, event_id)
        )

        event = Event(event_id=event_id, group=group, **kwargs)
        EventMapping.objects.create(
            project_id=event.project.id,
            event_id=event_id,
            group=group,
        )
        # emulate EventManager refs
        event.data.bind_ref(event)
        event.save()
        return event
开发者ID:yaoqi,项目名称:sentry,代码行数:61,代码来源:factories.py

示例11: inner

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
 def inner(data):
     mgr = EventManager(data={"sdk": data})
     mgr.normalize()
     evt = Event(data=mgr.get_data())
     insta_snapshot({
         'errors': evt.data.get('errors'),
         'to_json': evt.interfaces.get('sdk').to_json()
     })
开发者ID:yaoqi,项目名称:sentry,代码行数:10,代码来源:test_sdk.py

示例12: test_removes_some_empty_containers

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_removes_some_empty_containers(key, value):
    event = make_event()
    event[key] = value

    manager = EventManager(event)
    manager.normalize()
    data = manager.get_data()
    assert key not in data
开发者ID:Kayle009,项目名称:sentry,代码行数:10,代码来源:test_normalization.py

示例13: inner

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
 def inner(data):
     mgr = EventManager(data={"debug_meta": data})
     mgr.normalize()
     evt = Event(data=mgr.get_data())
     interface = evt.interfaces.get('debug_meta')
     insta_snapshot({
         'errors': evt.data.get('errors'),
         'to_json': interface and interface.to_json()
     })
开发者ID:yaoqi,项目名称:sentry,代码行数:11,代码来源:test_debug_meta.py

示例14: create_event

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
    def create_event(self, event_id=None, normalize=True, **kwargs):
        if event_id is None:
            event_id = uuid4().hex
        if 'group' not in kwargs:
            kwargs['group'] = self.group
        kwargs.setdefault('project', kwargs['group'].project)
        kwargs.setdefault('data', copy.deepcopy(DEFAULT_EVENT_DATA))
        kwargs.setdefault('platform', kwargs['data'].get('platform', 'python'))
        kwargs.setdefault('message', kwargs['data'].get('message', 'message'))
        if kwargs.get('tags'):
            tags = kwargs.pop('tags')
            if isinstance(tags, dict):
                tags = list(tags.items())
            kwargs['data']['tags'] = tags
        if kwargs.get('stacktrace'):
            stacktrace = kwargs.pop('stacktrace')
            kwargs['data']['stacktrace'] = stacktrace

        user = kwargs.pop('user', None)
        if user is not None:
            kwargs['data']['user'] = user

        kwargs['data'].setdefault(
            'errors', [{
                'type': EventError.INVALID_DATA,
                'name': 'foobar',
            }]
        )

        # maintain simple event fixtures by supporting the legacy message
        # parameter just like our API would
        if 'logentry' not in kwargs['data']:
            kwargs['data']['logentry'] = {
                'message': kwargs.get('message') or '<unlabeled event>',
            }

        if normalize:
            manager = EventManager(CanonicalKeyDict(kwargs['data']),
                                   for_store=False)
            manager.normalize()
            kwargs['data'] = manager.get_data()
            kwargs['message'] = manager.get_search_message()

        else:
            assert 'message' not in kwargs, 'do not pass message this way'

        event = Event(event_id=event_id, **kwargs)
        EventMapping.objects.create(
            project_id=event.project.id,
            event_id=event_id,
            group=event.group,
        )
        # emulate EventManager refs
        event.data.bind_ref(event)
        event.save()
        return event
开发者ID:Kayle009,项目名称:sentry,代码行数:58,代码来源:fixtures.py

示例15: test_deprecated_attrs

# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import get_data [as 别名]
def test_deprecated_attrs(key):
    event = make_event()
    event[key] = "some value"

    manager = EventManager(event)
    manager.normalize()
    data = manager.get_data()

    assert key not in data
    assert not data.get('errors')
开发者ID:yaoqi,项目名称:sentry,代码行数:12,代码来源:test_normalization.py


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