Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions sentry_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,18 @@ def _is_ignored_error(self, event, hint):
if exc_info is None:
return False

type_name = get_type_name(exc_info[0])
full_name = "%s.%s" % (exc_info[0].__module__, type_name)
error = exc_info[0]
error_type_name = get_type_name(exc_info[0])
error_full_name = "%s.%s" % (exc_info[0].__module__, error_type_name)

for errcls in self.options["ignore_errors"]:
for ignored_error in self.options["ignore_errors"]:
# String types are matched against the type name in the
# exception only
if isinstance(errcls, string_types):
if errcls == full_name or errcls == type_name:
if isinstance(ignored_error, string_types):
if ignored_error == error_full_name or ignored_error == error_type_name:
return True
else:
if issubclass(exc_info[0], errcls):
if issubclass(error, ignored_error):
return True

return False
Expand All @@ -246,23 +247,28 @@ def _should_capture(
scope=None, # type: Optional[Scope]
):
# type: (...) -> bool
if event.get("type") == "transaction":
# Transactions are sampled independent of error events.
# Transactions are sampled independent of error events.
is_transaction = event.get("type") == "transaction"
if is_transaction:
return True

if scope is not None and not scope._should_capture:
ignoring_prevents_recursion = scope is not None and not scope._should_capture
if ignoring_prevents_recursion:
return False

if (
ignored_by_config_option = self._is_ignored_error(event, hint)
if ignored_by_config_option:
return False

not_in_sample_rate = (
self.options["sample_rate"] < 1.0
and random.random() >= self.options["sample_rate"]
):
# record a lost event if we did not sample this.
)
if not_in_sample_rate:
# because we will not sample this event, record a "lost event".
if self.transport:
self.transport.record_lost_event("sample_rate", data_category="error")
return False

if self._is_ignored_error(event, hint):
return False

return True
Expand Down