mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 10:02:10 +03:00
Aggregate DBConnection.ConnectionError in Sentry (#2260)
This commit is contained in:
parent
054f7f7dbb
commit
3f7c1ce549
@ -224,7 +224,8 @@ config :sentry,
|
||||
root_source_code_path: [File.cwd!()],
|
||||
client: Plausible.Sentry.Client,
|
||||
send_max_attempts: 1,
|
||||
filter: Plausible.SentryFilter
|
||||
filter: Plausible.SentryFilter,
|
||||
before_send_event: {Plausible.SentryFilter, :before_send}
|
||||
|
||||
config :logger, Sentry.LoggerBackend,
|
||||
capture_log_messages: true,
|
||||
|
@ -1,4 +1,7 @@
|
||||
defmodule Plausible.SentryFilter do
|
||||
@moduledoc """
|
||||
Sentry callbacks for filtering and grouping events
|
||||
"""
|
||||
@behaviour Sentry.EventFilter
|
||||
|
||||
def exclude_exception?(%Sentry.CrashError{}, _source), do: true
|
||||
@ -7,4 +10,16 @@ defmodule Plausible.SentryFilter do
|
||||
def exclude_exception?(exception, source) do
|
||||
Sentry.DefaultEventFilter.exclude_exception?(exception, source)
|
||||
end
|
||||
|
||||
@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(event) do
|
||||
event
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user