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

Python event_manager.generate_culprit函数代码示例

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

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



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

示例1: test_truncation

def test_truncation():
    data = {
        'exception': {
            'values':
            [{
                'stacktrace': {
                    'frames': [{
                        'filename': 'x' * (MAX_CULPRIT_LENGTH + 1),
                    }],
                }
            }],
        }
    }
    assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH

    data = {
        'stacktrace': {
            'frames': [{
                'filename': 'x' * (MAX_CULPRIT_LENGTH + 1),
            }]
        }
    }
    assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH

    data = {
        'request': {
            'url': 'x' * (MAX_CULPRIT_LENGTH + 1),
        }
    }
    assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH
开发者ID:Kayle009,项目名称:sentry,代码行数:30,代码来源:test_generate_culprit.py


示例2: test_truncation

    def test_truncation(self):
        data = {
            'sentry.interfaces.Exception': {
                'values': [{
                    'stacktrace': {
                        'frames': [{
                            'filename': 'x' * (MAX_CULPRIT_LENGTH + 1),
                        }],
                    }
                }],
            }
        }
        assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH

        data = {
            'sentry.interfaces.Stacktrace': {
                'frames': [{
                    'filename': 'x' * (MAX_CULPRIT_LENGTH + 1),
                }]
            }
        }
        assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH

        data = {
            'sentry.interfaces.Http': {
                'url': 'x' * (MAX_CULPRIT_LENGTH + 1),
            }
        }
        assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH
开发者ID:AnjaneyuluBatta505,项目名称:sentry,代码行数:29,代码来源:test_event_manager.py


示例3: test_with_only_http_interface

    def test_with_only_http_interface(self):
        data = {
            'sentry.interfaces.Http': {
                'url': 'http://example.com'
            },
        }
        assert generate_culprit(data) == 'http://example.com'

        data = {
            'sentry.interfaces.Http': {},
        }
        assert generate_culprit(data) == ''
开发者ID:AnjaneyuluBatta505,项目名称:sentry,代码行数:12,代码来源:test_event_manager.py


示例4: test_truncation

    def test_truncation(self):
        data = {
            "sentry.interfaces.Exception": {
                "values": [{"stacktrace": {"frames": [{"filename": "x" * (MAX_CULPRIT_LENGTH + 1)}]}}]
            }
        }
        assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH

        data = {"sentry.interfaces.Stacktrace": {"frames": [{"filename": "x" * (MAX_CULPRIT_LENGTH + 1)}]}}
        assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH

        data = {"sentry.interfaces.Http": {"url": "x" * (MAX_CULPRIT_LENGTH + 1)}}
        assert len(generate_culprit(data)) == MAX_CULPRIT_LENGTH
开发者ID:haojiang1,项目名称:sentry,代码行数:13,代码来源:test_event_manager.py


示例5: fix_culprit

def fix_culprit(data):
    exc = data.get('sentry.interfaces.Exception')
    if not exc:
        return

    from sentry.event_manager import generate_culprit
    data['culprit'] = generate_culprit(data)
开发者ID:faulkner,项目名称:sentry,代码行数:7,代码来源:plugin.py


示例6: test_with_exception_interface

 def test_with_exception_interface(self):
     data = {
         'sentry.interfaces.Exception': {
             'values': [{
                 'stacktrace': {
                     'frames': [{
                         'lineno': 1,
                         'filename': 'foo.py',
                     }, {
                         'lineno': 1,
                         'filename': 'bar.py',
                         'in_app': True,
                     }],
                 }
             }]
         },
         'sentry.interfaces.Stacktrace': {
             'frames': [{
                 'lineno': 1,
                 'filename': 'NOTME.py',
             }, {
                 'lineno': 1,
                 'filename': 'PLZNOTME.py',
                 'in_app': True,
             }],
         },
         'sentry.interfaces.Http': {
             'url': 'http://example.com'
         },
     }
     assert generate_culprit(data) == 'bar.py in ?'
开发者ID:AnjaneyuluBatta505,项目名称:sentry,代码行数:31,代码来源:test_event_manager.py


示例7: test_with_empty_stacktrace

def test_with_empty_stacktrace():
    data = {
        'stacktrace': None,
        'request': {
            'url': 'http://example.com'
        },
    }
    assert generate_culprit(data) == 'http://example.com'
开发者ID:Kayle009,项目名称:sentry,代码行数:8,代码来源:test_generate_culprit.py


示例8: test_with_empty_stacktrace

 def test_with_empty_stacktrace(self):
     data = {
         'sentry.interfaces.Stacktrace': None,
         'sentry.interfaces.Http': {
             'url': 'http://example.com'
         },
     }
     assert generate_culprit(data) == 'http://example.com'
开发者ID:duanshuaimin,项目名称:sentry,代码行数:8,代码来源:test_event_manager.py


示例9: _generate_culprit

def _generate_culprit(event):
    # XXX(mitsuhiko): workaround: some old events do not have this data yet.
    # This should be save delete by end of 2019 even considering slow on-prem
    # releases.  Platform was added back to data in december 2018.
    data = event.data
    if data.get('platform') is None:
        data = dict(data.items())
        data['platform'] = event.platform
    return generate_culprit(data)
开发者ID:yaoqi,项目名称:sentry,代码行数:9,代码来源:unmerge.py


示例10: test_with_missing_stacktrace_frames

def test_with_missing_stacktrace_frames():
    data = {
        'stacktrace': {
            'frames': None,
        },
        'request': {
            'url': 'http://example.com'
        },
    }
    assert generate_culprit(data) == 'http://example.com'
开发者ID:Kayle009,项目名称:sentry,代码行数:10,代码来源:test_generate_culprit.py


示例11: test_with_missing_exception_interface

 def test_with_missing_exception_interface(self):
     data = {
         "sentry.interfaces.Stacktrace": {
             "frames": [
                 {"lineno": 1, "filename": "NOTME.py"},
                 {"lineno": 1, "filename": "PLZNOTME.py", "in_app": True},
             ]
         },
         "sentry.interfaces.Http": {"url": "http://example.com"},
     }
     assert generate_culprit(data) == "PLZNOTME.py in ?"
开发者ID:haojiang1,项目名称:sentry,代码行数:11,代码来源:test_event_manager.py


示例12: test_with_only_http_interface

def test_with_only_http_interface():
    data = {
        'request': {
            'url': 'http://example.com'
        },
    }
    assert generate_culprit(data) == 'http://example.com'

    data = {
        'request': {
            'url': None
        },
    }
    assert generate_culprit(data) == ''

    data = {
        'request': {},
    }
    assert generate_culprit(data) == ''

    data = {
        'request': None,
    }
    assert generate_culprit(data) == ''
开发者ID:Kayle009,项目名称:sentry,代码行数:24,代码来源:test_generate_culprit.py


示例13: _rehash_group_events

def _rehash_group_events(group, limit=100):
    from sentry.event_manager import (
        EventManager, get_hashes_from_fingerprint, generate_culprit, md5_from_hash
    )
    from sentry.models import Event, Group

    environment_cache = {}
    project = group.project
    event_list = list(Event.objects.filter(group_id=group.id)[:limit])
    Event.objects.bind_nodes(event_list, 'data')

    for event in event_list:
        fingerprint = event.data.get('fingerprint', ['{{ default }}'])
        if fingerprint and not isinstance(fingerprint, (list, tuple)):
            fingerprint = [fingerprint]
        elif not fingerprint:
            fingerprint = ['{{ default }}']

        manager = EventManager({})

        group_kwargs = {
            'message': event.message,
            'platform': event.platform,
            'culprit': generate_culprit(event.data),
            'logger': event.get_tag('logger') or group.logger,
            'level': group.level,
            'last_seen': event.datetime,
            'first_seen': event.datetime,
            'data': group.data,
        }

        # XXX(dcramer): doesnt support checksums as they're not stored
        hashes = map(md5_from_hash, get_hashes_from_fingerprint(event, fingerprint))
        for hash in hashes:
            new_group, _, _, _ = manager._save_aggregate(
                event=event, hashes=hashes, release=None, **group_kwargs
            )
            event.update(group_id=new_group.id)
            if event.data.get('tags'):
                Group.objects.add_tags(
                    new_group,
                    _get_event_environment(event, project, environment_cache),
                    event.data['tags'])

    return bool(event_list)
开发者ID:yogeshmangaj,项目名称:sentry,代码行数:45,代码来源:merge.py


示例14: test_with_stacktrace_interface

def test_with_stacktrace_interface():
    data = {
        'stacktrace': {
            'frames': [
                {
                    'lineno': 1,
                    'filename': 'NOTME.py',
                }, {
                    'lineno': 1,
                    'filename': 'PLZNOTME.py',
                    'in_app': True,
                }
            ],
        },
        'request': {
            'url': 'http://example.com'
        },
    }
    assert generate_culprit(data) == 'PLZNOTME.py in ?'
开发者ID:Kayle009,项目名称:sentry,代码行数:19,代码来源:test_generate_culprit.py


示例15: test_with_missing_exception_stacktrace

def test_with_missing_exception_stacktrace():
    data = {
        'exception': {
            'values': [
                {
                    'stacktrace': None,
                },
                {
                    'stacktrace': {
                        'frames': None,
                    }
                },
                {
                    'stacktrace': {
                        'frames': [None],
                    }
                },
            ]
        },
        'request': {
            'url': 'http://example.com'
        },
    }
    assert generate_culprit(data) == 'http://example.com'
开发者ID:Kayle009,项目名称:sentry,代码行数:24,代码来源:test_generate_culprit.py


示例16: merge_mappings

                version=version,
            ),
        ),
    }


def merge_mappings(values):
    result = {}
    for value in values:
        result.update(value)
    return result


initial_fields = {
    'culprit': lambda event: generate_culprit(
        event.data,
        event.platform,
    ),
    'data': lambda event: {
        'last_received': event.data.get('received') or float(event.datetime.strftime('%s')),
        'type': event.data['type'],
        'metadata': event.data['metadata'],
    },
    'last_seen': lambda event: event.datetime,
    'level': lambda event: LOG_LEVELS_MAP.get(
        event.get_tag('level'),
        logging.ERROR,
    ),
    'message': lambda event: event.message,
    'times_seen': lambda event: 0,
}
开发者ID:Kayle009,项目名称:sentry,代码行数:31,代码来源:unmerge.py


示例17: test_empty_data

 def test_empty_data(self):
     assert generate_culprit({}) == ''
开发者ID:AnjaneyuluBatta505,项目名称:sentry,代码行数:2,代码来源:test_event_manager.py


示例18: fix_culprit

 def fix_culprit(self, data, stacktraces):
     data['culprit'] = generate_culprit(data)
开发者ID:noah-lee,项目名称:sentry,代码行数:2,代码来源:processor.py


示例19: test_with_only_http_interface

    def test_with_only_http_interface(self):
        data = {"sentry.interfaces.Http": {"url": "http://example.com"}}
        assert generate_culprit(data) == "http://example.com"

        data = {"sentry.interfaces.Http": {}}
        assert generate_culprit(data) == ""
开发者ID:haojiang1,项目名称:sentry,代码行数:6,代码来源:test_event_manager.py


示例20: fix_culprit

def fix_culprit(data):
    if not get_path(data, 'exception', 'values', filter=True):
        return

    from sentry.event_manager import generate_culprit
    data['culprit'] = generate_culprit(data)
开发者ID:Kayle009,项目名称:sentry,代码行数:6,代码来源:plugin.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python event_manager.get_hashes_for_event函数代码示例发布时间:2022-05-27
下一篇:
Python notifications.event_to_record函数代码示例发布时间: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