Improve error reporting and add test
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -28,6 +28,16 @@ defmodule Mobilizon.Service.ErrorReporting.Sentry do
|
||||
end
|
||||
end
|
||||
|
||||
@impl ErrorReporting
|
||||
def attach do
|
||||
:telemetry.attach(
|
||||
"oban-errors",
|
||||
[:oban, :job, :exception],
|
||||
&handle_event/4,
|
||||
[]
|
||||
)
|
||||
end
|
||||
|
||||
@impl ErrorReporting
|
||||
def handle_event([:oban, :job, :exception], measure, %{job: job} = meta, _) do
|
||||
extra =
|
||||
@@ -42,4 +52,6 @@ defmodule Mobilizon.Service.ErrorReporting.Sentry do
|
||||
def handle_event([:oban, :circuit, :trip], _measure, meta, _) do
|
||||
Sentry.capture_exception(meta.error, stacktrace: meta.stacktrace, extra: meta)
|
||||
end
|
||||
|
||||
def handle_event(_, _, _, _), do: :ok
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user