本文整理汇总了Python中sentry.event_manager.EventManager._save_aggregate方法的典型用法代码示例。如果您正苦于以下问题:Python EventManager._save_aggregate方法的具体用法?Python EventManager._save_aggregate怎么用?Python EventManager._save_aggregate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentry.event_manager.EventManager
的用法示例。
在下文中一共展示了EventManager._save_aggregate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _rehash_group_events
# 需要导入模块: from sentry.event_manager import EventManager [as 别名]
# 或者: from sentry.event_manager.EventManager import _save_aggregate [as 别名]
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)