Skip to content

Commit 79160b6

Browse files
committed
Capture Oban errors
1 parent ab3ba77 commit 79160b6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • lib/error_tracker/integrations
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
defmodule ErrorTracker.Integrations.Oban do
2+
def attach do
3+
:telemetry.attach(__MODULE__, [:oban, :job, :exception], &handle_event/4, :no_config)
4+
end
5+
6+
def handle_event([:oban, :job, :exception], _measurements, metadata, :no_config) do
7+
%{job: job, reason: exception, stacktrace: stacktrace} = metadata
8+
9+
ErrorTracker.report(exception, stacktrace, %{
10+
job_id: job.id,
11+
job_attempt: job.attempt,
12+
job_queue: job.queue,
13+
job_worker: job.worker
14+
})
15+
end
16+
end

0 commit comments

Comments
 (0)