Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More detailed sentry reports #4457

merged 2 commits into from Aug 18, 2017
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -1,12 +1,27 @@
"""The module describes the ``sentry`` error plugin plugin."""
import logging

from galaxy.util import string_as_bool
from galaxy import web
from galaxy.util import string_as_bool, unicodify

from ..plugins import ErrorPlugin

log = logging.getLogger(__name__)

ERROR_TEMPLATE = u"""Galaxy Job Error: {tool_id} v{tool_version}
Command Line:
The user provided the following information:

class SentryPlugin(ErrorPlugin):
"""Send error report to Sentry.
@@ -22,29 +37,60 @@ def submit_report(self, dataset, job, tool, **kwargs):
"""Submit the error report to sentry
user = job.get_user()
extra = {
'info' :,
'id' :,
'command_line' : job.command_line,
'stderr' : job.stderr,
'traceback': job.traceback,
'command_line': unicodify(job.command_line),
'stderr': unicodify(job.stderr),
'traceback': unicodify(job.traceback),
'exit_code': job.exit_code,
'stdout': job.stdout,
'handler': job.handler,
'user': job.get_user(),
'tool_version': job.tool_version,
'tool_xml': tool.config_file if tool else None
'stdout': unicodify(job.stdout),
'handler': unicodify(job.handler),
'tool_id': unicodify(job.tool_id),
'tool_version': unicodify(job.tool_version),

This comment has been minimized.

Copy link

bgruening Aug 18, 2017


unicodify is probably not needed here but it guess if can not hurt either

'tool_xml': unicodify(tool.config_file) if tool else None
if 'email' in kwargs:
extra['email'] = kwargs['email']
extra['email'] = unicodify(kwargs['email'])

# User submitted message
if 'message' in kwargs:
extra['message'] = kwargs['message']
extra['message'] = unicodify(kwargs['message'])

# Construct the error message to send to sentry. The first line
# will be the issue title, everything after that becomes the
# "message"
error_message = ERROR_TEMPLATE.format(**extra)

# Update context with user information in a sentry-specific manner{
# User information here also places email links + allows seeing
# a list of affected users in the tags/filtering.
'user': {
'name': user.username,
# This allows us to link to the dataset info page in case
# anything is missing from this report.
'request': {
'url': web.url_for(
controller="dataset", action="show_params",,

# Send the message, using message because
response =
message="Galaxy Job Error: %s v.%s" % (job.tool_id, job.tool_version),
'tool_id': job.tool_id,
'tool_version': job.tool_version,
return ('Submitted bug report to Sentry. Your guru meditation number is %s' % response, 'success')

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.