sentry-elixir icon indicating copy to clipboard operation
sentry-elixir copied to clipboard

Filtering Sentry.CrashErrors via Sentry.EventFilter

Open dimitridewit opened this issue 6 years ago • 2 comments

Will support for filtering these be something on the agenda? We have handle_sasl_reports: true together with:

      config :logger,
        backends: [:console, Sentry.LoggerBackend]

This gives us for example NoRouter errors from Phoenix in the form of Sentry.CrashErrors

I have been poking around in Sentry.LoggerBackend and it seems as the :crash_reason is available with for example the Phoenix.Router.NoRouteError. Adding it to the Sentry.CrashError struct would make it way nicer to filter on than looking up stuff in the general message string.

dimitridewit avatar Sep 29 '20 13:09 dimitridewit

Thanks for opening an issue!

The Erlang logger has deprecated SASL as of OTP 21, so it's unlikely specific handling of SASL logs will be added.

If you're unable to disable SASL, one less than ideal option is to search for specific errors in the message along the lines of:

  def exclude_exception?(event, :logger) do
    if Regex.match?(~r/Phoenix\.Router\.NoRouteError/, event.message) do
      true
    else
      false
    end
  end

Since the structure of SASL metadata is different, Sentry.LoggerBackend wraps it in a Sentry.CrashError with a message from the original error.

mitchellhenke avatar Oct 04 '20 15:10 mitchellhenke

Closing this issue for now 🙂

mitchellhenke avatar Nov 01 '20 15:11 mitchellhenke