Skip to content

Commit

Permalink
More tags when logging errors to Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Jul 16, 2018
1 parent dfdf4df commit b1a28c9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
19 changes: 16 additions & 3 deletions readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,16 @@ def handle_exception(self, exc_type, exc_value, _):
.format(project=self.project.slug,
version=self.version.slug,
msg=exc_value),
exc_info=True)
exc_info=True,
extra={
'stack': True,
'tags': {
'build': self.build.get('id'),
'project': self.project.slug,
'version': self.version.slug,
},
},
)
self.failure = exc_value
return True

Expand Down Expand Up @@ -546,8 +555,12 @@ def update_build(self, state=None):
str(self.failure),
extra={
'stack': True,
'tags': {'build': self.build['id']},
}
'tags': {
'build': self.build.get('id'),
'project': self.project.slug,
'version': self.version.slug,
},
},
)
self.failure = BuildEnvironmentError(
BuildEnvironmentError.GENERIC_WITH_BUILD_ID.format(
Expand Down
18 changes: 16 additions & 2 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,14 @@ def run(self, pk, version_pk=None, build_pk=None, record=True,
except Exception as e: # noqa
log.exception(
'An unhandled exception was raised during build setup',
extra={'tags': {'build': build_pk}}
extra={
'stack': True,
'tags': {
'build': build_pk,
'project': self.project.slug,
'version': self.version.slug,
},
},
)
self.setup_env.failure = BuildEnvironmentError(
BuildEnvironmentError.GENERIC_WITH_BUILD_ID.format(
Expand All @@ -363,7 +370,14 @@ def run(self, pk, version_pk=None, build_pk=None, record=True,
except Exception as e: # noqa
log.exception(
'An unhandled exception was raised during project build',
extra={'tags': {'build': build_pk}}
extra={
'stack': True,
'tags': {
'build': build_pk,
'project': self.project.slug,
'version': self.version.slug,
},
},
)
self.build_env.failure = BuildEnvironmentError(
BuildEnvironmentError.GENERIC_WITH_BUILD_ID.format(
Expand Down

0 comments on commit b1a28c9

Please sign in to comment.