Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Expand oban error tracking for plugins/notifiers (#1864)

Parker Selberta64cc84db267
diff --git a/lib/plausible/application.ex b/lib/plausible/application.ex
index 07f43d93bd..1f3faf6716 100644
--- a/lib/plausible/application.ex
+++ b/lib/plausible/application.ex
@@ -47,7 +47,7 @@ defmodule Plausible.Application do
:telemetry.attach_many(
"oban-errors",
- [[:oban, :job, :exception], [:oban, :circuit, :trip]],
+ [[:oban, :job, :exception], [:oban, :notifier, :exception], [:oban, :plugin, :exception]],
&ErrorReporter.handle_event/4,
%{}
)
diff --git a/lib/telemetry.ex b/lib/telemetry.ex
index e60a91366f..ea052ad173 100644
--- a/lib/telemetry.ex
+++ b/lib/telemetry.ex
@@ -7,11 +7,19 @@ defmodule ErrorReporter do
on_job_exception(job)
- Sentry.capture_exception(meta.error, stacktrace: meta.stacktrace, extra: extra)
+ Sentry.capture_exception(meta.reason, stacktrace: meta.stacktrace, extra: extra)
end
- def handle_event([:oban, :circuit, :trip], _measure, meta, _) do
- Sentry.capture_exception(meta.error, stacktrace: meta.stacktrace, extra: meta)
+ def handle_event([:oban, :notifier, :exception], _timing, meta, _) do
+ extra = Map.take(meta, ~w(channel payload)a)
+
+ Sentry.capture_exception(meta.reason, stacktrace: meta.stacktrace, extra: extra)
+ end
+
+ def handle_event([:oban, :plugin, :exception], _timing, meta, _) do
+ extra = Map.take(meta, ~w(plugin)a)
+
+ Sentry.capture_exception(meta.reason, stacktrace: meta.stacktrace, extra: extra)
end
defp on_job_exception(%Oban.Job{