Skip to content

Commit

Permalink
feat(unreal): Adds custom event payload files to unreal (#12660)
Browse files Browse the repository at this point in the history
This un-featuregates the custom event payload attachment files and adds support
for them to the unreal endpoint.
  • Loading branch information
mitsuhiko authored and jan-auer committed Apr 11, 2019
1 parent c78d79a commit ea073b1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ sqlparse>=0.1.16,<0.2.0
statsd>=3.1.0,<3.2.0
strict-rfc3339>=0.7
structlog==16.1.0
symbolic>=6.0.4,<7.0.0
symbolic>=6.0.6,<7.0.0
toronado>=0.0.11,<0.1.0
ua-parser>=0.6.1,<0.8.0
# for bitbucket client
Expand Down
44 changes: 28 additions & 16 deletions src/sentry/web/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
from sentry.event_manager import EventManager
from sentry.interfaces import schemas
from sentry.interfaces.base import get_interface
from sentry.lang.native.unreal import process_unreal_crash, merge_apple_crash_report, unreal_attachment_type, merge_unreal_context_event, merge_unreal_logs_event
from sentry.lang.native.minidump import merge_process_state_event, process_minidump, merge_attached_event, merge_attached_breadcrumbs, MINIDUMP_ATTACHMENT_TYPE
from sentry.lang.native.unreal import process_unreal_crash, merge_apple_crash_report, \
unreal_attachment_type, merge_unreal_context_event, merge_unreal_logs_event
from sentry.lang.native.minidump import merge_process_state_event, process_minidump, \
merge_attached_event, merge_attached_breadcrumbs, MINIDUMP_ATTACHMENT_TYPE
from sentry.models import Project, OrganizationOption, Organization
from sentry.signals import (
event_accepted, event_dropped, event_filtered, event_received)
Expand Down Expand Up @@ -698,23 +700,25 @@ def post(self, request, project, **kwargs):
attachments = []
minidump.seek(0)
attachments.append(CachedAttachment.from_upload(minidump, type=MINIDUMP_ATTACHMENT_TYPE))
has_event_attachments = features.has('organizations:event-attachments',
project.organization, actor=request.user)

# Append all other files as generic attachments. We can skip this if the
# feature is disabled since they won't be saved.
if features.has('organizations:event-attachments',
project.organization, actor=request.user):
for name, file in six.iteritems(request.FILES):
if name == 'upload_file_minidump':
continue
# Known attachment: msgpack event
if name == "__sentry-event":
merge_attached_event(file, data)
continue
if name == "__sentry-breadcrumb1" or name == "__sentry-breadcrumb2":
merge_attached_breadcrumbs(file, data)
continue

# Add any other file as attachment
for name, file in six.iteritems(request.FILES):
if name == 'upload_file_minidump':
continue

# Known attachment: msgpack event
if name == "__sentry-event":
merge_attached_event(file, data)
continue
if name in ("__sentry-breadcrumb1", "__sentry-breadcrumb2"):
merge_attached_breadcrumbs(file, data)
continue

# Add any other file as attachment
if has_event_attachments:
attachments.append(CachedAttachment.from_upload(file))

try:
Expand Down Expand Up @@ -808,6 +812,14 @@ def post(self, request, project, **kwargs):
minidumps_logger.exception(e)

for file in unreal.files():
# Known attachment: msgpack event
if file.name == "__sentry-event":
merge_attached_event(file.open_stream(), event)
continue
if file.name in ("__sentry-breadcrumb1", "__sentry-breadcrumb2"):
merge_attached_breadcrumbs(file.open_stream(), event)
continue

# Always store the minidump in attachments so we can access it during
# processing, regardless of the event-attachments feature. This will
# allow us to stack walk again with CFI once symbols are loaded.
Expand Down

0 comments on commit ea073b1

Please sign in to comment.