本文整理汇总了Python中sentry.event_manager.get_hashes_for_event函数的典型用法代码示例。如果您正苦于以下问题:Python get_hashes_for_event函数的具体用法?Python get_hashes_for_event怎么用?Python get_hashes_for_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_hashes_for_event函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_stacktrace_wins_over_http
def test_stacktrace_wins_over_http(self, http_comp_hash, stack_comp_hash):
# this was a regression, and a very important one
http_comp_hash.return_value = [['baz']]
stack_comp_hash.return_value = [['foo', 'bar']]
event = Event(
data={
'sentry.interfaces.Stacktrace': {
'frames': [{
'lineno': 1,
'filename': 'foo.py',
}],
},
'sentry.interfaces.Http': {
'url': 'http://example.com'
},
},
platform='python',
message='Foo bar',
)
hashes = get_hashes_for_event(event)
assert len(hashes) == 1
hash_one = hashes[0]
stack_comp_hash.assert_called_once_with('python')
assert not http_comp_hash.called
assert hash_one == ['foo', 'bar']
开发者ID:AnjaneyuluBatta505,项目名称:sentry,代码行数:25,代码来源:test_event_manager.py
示例2: test_custom_values
def test_custom_values(self):
event = Event(
data={
'sentry.interfaces.Stacktrace': {
'frames': [
{
'lineno': 1,
'filename': 'foo.py',
}, {
'lineno': 1,
'filename': 'foo.py',
'in_app': True,
}
],
},
'sentry.interfaces.Http': {
'url': 'http://example.com'
},
},
platform='python',
message='Foo bar',
)
fp_checksums = get_hashes_from_fingerprint(event, ["{{default}}", "custom"])
def_checksums = get_hashes_for_event(event)
assert len(fp_checksums) == len(def_checksums)
assert def_checksums != fp_checksums
开发者ID:hosmelq,项目名称:sentry,代码行数:26,代码来源:test_event_manager.py
示例3: test_default_value
def test_default_value(self):
event = Event(
data={
"sentry.interfaces.Stacktrace": {
"frames": [{"lineno": 1, "filename": "foo.py"}, {"lineno": 1, "filename": "foo.py", "in_app": True}]
},
"sentry.interfaces.Http": {"url": "http://example.com"},
},
platform="python",
message="Foo bar",
)
fp_checksums = get_hashes_from_fingerprint(event, ["{{default}}"])
def_checksums = get_hashes_for_event(event)
assert def_checksums == fp_checksums
开发者ID:haojiang1,项目名称:sentry,代码行数:14,代码来源:test_event_manager.py
示例4: test_stacktrace_wins_over_http
def test_stacktrace_wins_over_http(self, http_comp_hash, stack_comp_hash):
# this was a regression, and a very important one
http_comp_hash.return_value = [["baz"]]
stack_comp_hash.return_value = [["foo", "bar"]]
event = Event(
data={
"sentry.interfaces.Stacktrace": {"frames": [{"lineno": 1, "filename": "foo.py"}]},
"sentry.interfaces.Http": {"url": "http://example.com"},
},
platform="python",
message="Foo bar",
)
hashes = get_hashes_for_event(event)
assert len(hashes) == 1
hash_one = hashes[0]
stack_comp_hash.assert_called_once_with("python")
assert not http_comp_hash.called
assert hash_one == ["foo", "bar"]
开发者ID:haojiang1,项目名称:sentry,代码行数:18,代码来源:test_event_manager.py
示例5: test_stacktrace_wins_over_http
def test_stacktrace_wins_over_http(self, http_comp_hash, stack_comp_hash):
# this was a regression, and a very important one
http_comp_hash.return_value = [['baz']]
stack_comp_hash.return_value = [['foo', 'bar']]
event = Event(
data={
'sentry.interfaces.Stacktrace': {
'frames': [{
'lineno': 1,
'filename': 'foo.py',
}],
},
'sentry.interfaces.Http': {
'url': 'http://example.com'
},
},
message='Foo bar',
)
checksums = get_hashes_for_event(event)
assert len(checksums) == 1
checksum = checksums[0]
stack_comp_hash.assert_called_once_with()
assert not http_comp_hash.called
assert checksum == '3858f62230ac3c915f300c664312c63f'
开发者ID:botp,项目名称:sentry,代码行数:24,代码来源:test_event_manager.py
示例6: serialize
def serialize(self, obj, attrs, user):
errors = []
error_set = set()
for error in obj.data.get('errors', []):
message = EventError.get_message(error)
if message in error_set:
continue
error_set.add(message)
error_result = {
'type': error['type'],
'message': message,
'data': {
k: v for k, v in six.iteritems(error)
if k != 'type'
},
}
errors.append(error_result)
tags = sorted([
{
'key': k.split('sentry:', 1)[-1],
'value': v
} for k, v in obj.get_tags()
], key=lambda x: x['key'])
received = obj.data.get('received')
if received:
# Sentry at one point attempted to record invalid types here.
# Remove after June 2 2016
try:
received = datetime.utcfromtimestamp(received).replace(
tzinfo=timezone.utc,
)
except TypeError:
received = None
from sentry.event_manager import (
get_hashes_for_event,
md5_from_hash,
)
# TODO(dcramer): move release serialization here
d = {
'id': six.text_type(obj.id),
'groupID': six.text_type(obj.group_id),
'eventID': six.text_type(obj.event_id),
'size': obj.size,
'entries': attrs['entries'],
'dist': obj.dist,
# See GH-3248
'message': obj.get_legacy_message(),
'user': attrs['user'],
'contexts': attrs['contexts'],
'sdk': attrs['sdk'],
# TODO(dcramer): move into contexts['extra']
'context': obj.data.get('extra', {}),
'packages': obj.data.get('modules', {}),
'type': obj.get_event_type(),
'metadata': obj.get_event_metadata(),
'tags': tags,
'platform': obj.platform,
'dateCreated': obj.datetime,
'dateReceived': received,
'errors': errors,
'fingerprints': [md5_from_hash(h) for h in get_hashes_for_event(obj)],
}
return d
开发者ID:duanshuaimin,项目名称:sentry,代码行数:67,代码来源:event.py
示例7: get_fingerprint
def get_fingerprint(event):
# TODO: This *might* need to be protected from an IndexError?
primary_hash = get_hashes_for_event(event)[0]
return md5_from_hash(primary_hash)
开发者ID:alshopov,项目名称:sentry,代码行数:4,代码来源:unmerge.py
注:本文中的sentry.event_manager.get_hashes_for_event函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论