By default sentry uses the stack trace / error type / rough error
message, which ends up with many failures from different workunits
grouped together. Include the actual command run, the exit status, and
the optional label to group these more accurately. This will group
failures of the same workunit together, for example.
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
prefix=prefix,
)
+ def fingerprint(self):
+ """
+ Returns a list of strings to group failures with.
+ Used by sentry instead of grouping by backtrace.
+ """
+ return [
+ ' '.join(self.command),
+ 'exit status {}'.format(self.exitstatus),
+ self.label,
+ '{{ type }}',
+ ]
+
class AnsibleFailedError(Exception):
if job_id:
extras['logs'] = get_http_log_path(archive_path, job_id)
+ fingerprint = e.fingerprint() if hasattr(e, 'fingerprint') else None
exc_id = sentry_sdk.capture_exception(
error=e,
tags=tags,
extras=extras,
+ fingerprint=fingerprint,
)
event_url = "{server}/?query={id}".format(
server=teuth_config.sentry_server.strip('/'), id=exc_id)