зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1678668: print sentry error report number on mach command failure r=firefox-build-system-reviewers,mhentges
When mach errors out, an error report is sent to Sentry. This error report contains information about the state of the interpreter during the failure, details about the environment, installed packages and more. Having this information available immediately when attempting to resolve a bug report is generally desirable, instead of going through a back-and-forth needinfo tag on Bugzilla or spending time asking the reporter questions on Matrix. This commit captures the Sentry ID returned from `sentry_sdk.capture_exception` and prints it to the screen. If a user adds this line to their bug report (as the error messages suggest) a build team member can enter this number into Sentry to identify the exact report and debug the error. At minimum this will reduce the amount of back-and-forth between the reporter and the assignee required to resolve a bug. Optimally it should make bugs easier to spot and reduce the time spent on end user support requests. To use the Sentry ID to identify information about a specific bug report, the bug assignee should open the Mozilla Sentry page for the `mach` project and paste the ID into the search box, which will produce the full stack trace with all submitted information. Differential Revision: https://phabricator.services.mozilla.com/D100247
This commit is contained in:
Родитель
0c10fa6898
Коммит
813445ccd8
|
@ -388,8 +388,10 @@ To see more help for a specific command, run:
|
|||
exc_type, exc_value, exc_tb = sys.exc_info()
|
||||
stack = traceback.extract_tb(exc_tb)
|
||||
|
||||
self._print_exception(sys.stdout, exc_type, exc_value, stack)
|
||||
sentry.report_exception(exc_value)
|
||||
sentry_event_id = sentry.report_exception(exc_value)
|
||||
self._print_exception(
|
||||
sys.stdout, exc_type, exc_value, stack, sentry_event_id=sentry_event_id
|
||||
)
|
||||
|
||||
return 1
|
||||
|
||||
|
@ -497,7 +499,7 @@ To see more help for a specific command, run:
|
|||
return 1
|
||||
except Exception:
|
||||
exc_type, exc_value, exc_tb = sys.exc_info()
|
||||
sentry.report_exception(exc_value)
|
||||
sentry_event_id = sentry.report_exception(exc_value)
|
||||
|
||||
# The first two frames are us and are never used.
|
||||
stack = traceback.extract_tb(exc_tb)[2:]
|
||||
|
@ -511,7 +513,11 @@ To see more help for a specific command, run:
|
|||
if not len(stack):
|
||||
print(COMMAND_ERROR_TEMPLATE % handler.name)
|
||||
self._print_exception(
|
||||
sys.stdout, exc_type, exc_value, traceback.extract_tb(exc_tb)
|
||||
sys.stdout,
|
||||
exc_type,
|
||||
exc_value,
|
||||
traceback.extract_tb(exc_tb),
|
||||
sentry_event_id=sentry_event_id,
|
||||
)
|
||||
return 1
|
||||
|
||||
|
@ -539,7 +545,9 @@ To see more help for a specific command, run:
|
|||
else:
|
||||
print(COMMAND_ERROR_TEMPLATE % handler.name)
|
||||
|
||||
self._print_exception(sys.stdout, exc_type, exc_value, stack)
|
||||
self._print_exception(
|
||||
sys.stdout, exc_type, exc_value, stack, sentry_event_id=sentry_event_id
|
||||
)
|
||||
|
||||
return 1
|
||||
|
||||
|
@ -553,7 +561,7 @@ To see more help for a specific command, run:
|
|||
fh.write(repr(argv))
|
||||
fh.write("\n\n")
|
||||
|
||||
def _print_exception(self, fh, exc_type, exc_value, stack):
|
||||
def _print_exception(self, fh, exc_type, exc_value, stack, sentry_event_id=None):
|
||||
fh.write(ERROR_FOOTER)
|
||||
fh.write("\n")
|
||||
|
||||
|
@ -564,6 +572,11 @@ To see more help for a specific command, run:
|
|||
for l in traceback.format_list(stack):
|
||||
fh.write(l)
|
||||
|
||||
if not sentry_event_id:
|
||||
return
|
||||
|
||||
fh.write("\nSentry event ID: {}\n".format(sentry_event_id))
|
||||
|
||||
def load_settings(self, paths):
|
||||
"""Load the specified settings files.
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class SentryErrorReporter(ErrorReporter):
|
|||
"""Reports errors using Sentry."""
|
||||
|
||||
def report_exception(self, exception):
|
||||
sentry_sdk.capture_exception(exception)
|
||||
return sentry_sdk.capture_exception(exception)
|
||||
|
||||
|
||||
class NoopErrorReporter(ErrorReporter):
|
||||
|
@ -56,7 +56,7 @@ class NoopErrorReporter(ErrorReporter):
|
|||
"""
|
||||
|
||||
def report_exception(self, exception):
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def register_sentry(argv, settings, topsrcdir=None):
|
||||
|
|
Загрузка…
Ссылка в новой задаче