@ -6,6 +6,8 @@ defmodule Plausible.SentryFilter do
def exclude_exception? ( % Sentry.CrashError { } , _source ) , do : true
def exclude_exception? ( % Phoenix.NotAcceptableError { } , _ ) , do : true
def exclude_exception? ( % Plug.CSRFProtection.InvalidCSRFTokenError { } , _ ) , do : true
def exclude_exception? ( % Plug.Static.InvalidPathError { } , _ ) , do : true
def exclude_exception? ( exception , source ) do
Sentry.DefaultEventFilter . exclude_exception? ( exception , source )
@ -14,11 +16,6 @@ defmodule Plausible.SentryFilter do
@spec before_send ( Sentry.Event . t ( ) ) :: Sentry.Event . t ( )
def before_send ( event )
# https://hexdocs.pm/sentry/readme.html#fingerprinting
def before_send ( %{ exception : [ %{ type : DBConnection.ConnectionError } ] } = event ) do
%{ event | fingerprint : [ " ecto " , " db_connection " , " timeout " ] }
end
def before_send (
%{ exception : [ %{ type : " Clickhousex.Error " } ] , original_exception : %{ code : code } } = event
)
@ -26,6 +23,10 @@ defmodule Plausible.SentryFilter do
%{ event | fingerprint : [ " clickhouse " , " db_connection " , to_string ( code ) ] }
end
def before_send ( %{ event_source : :logger , message : " Clickhousex.Protocol " <> _ } = event ) do
%{ event | fingerprint : [ " clickhouse " , " db_connection " , " protocol_error " ] }
end
def before_send ( event ) do
event
end