-
Couldn't load subscription status.
- Fork 86
Closed
Labels
bugConfirmed and unconfirmed bugs reported by us and customers.Confirmed and unconfirmed bugs reported by us and customers.
Description
Describe the bug
When Oban jobs are configured with an execution timeout (see docs):
@impl Oban.Worker
def timeout(_job), do: :timer.seconds(1)And the jobs fail due to a timeout with an Oban.TimeoutError, the discarded jobs are not reported to AppSignal.
To Reproduce
deps:
:appsignalversion2.15.9:obanversion2.19.4
config:
config :appsignal, :config,
otp_app: :tp,
name: "Tp",
push_api_key: env."TP_APPSIGNAL_API_KEY",
# Report errors when the job is discarded due to the error. Not for every attempt.
report_oban_errors: :discard,
ignore_errors: [
# Should be ignored, as this is an internal error type for Bandit
# https://github.com/mtrudel/bandit/issues/456#issuecomment-2740929245
"Bandit.TransportError"
],
env: config_env(),
active: truecode:
defmodule TpData.ObanWorkers.DiscardTest do
use Oban.Worker, queue: :default, max_attempts: 2
@impl Oban.Worker
def perform(_oban_job) do
Process.sleep(2000)
end
@impl Oban.Worker
def timeout(_job), do: :timer.seconds(1)
enddefmodule TpData.ObanWorkers.DiscardTest2 do
use Oban.Worker, queue: :default, max_attempts: 2
@impl Oban.Worker
def perform(_oban_job) do
raise "DiscardTest2"
end
endIn the shell, inserting both jobs:
iex([email protected])1> ObanWorkers.DiscardTest.new(%{}) |> Oban.insert()
{:ok,
%Oban.Job{
...
}
iex([email protected])1> ObanWorkers.DiscardTest2.new(%{}) |> Oban.insert()
{:ok,
%Oban.Job{
...
}
Logs for 2nd attempt of both jobs:
10:54:12.114 [info] {"args":{},"id":3660,"meta":{"orig_scheduled_at":1758279233948088},"system_time":1758279252113866667,"max_attempts":2,"queue":"default","worker":"TpData.ObanWorkers.DiscardTest","source":"oban","tags":[],"attempt":2,"event":"job:start"}
10:54:13.125 [error] {"error":"** (Oban.TimeoutError) TpData.ObanWorkers.DiscardTest timed out after 1000ms","args":{},"id":3660,"meta":{"orig_scheduled_at":1758279233948088},"state":"discard","max_attempts":2,"queue":"default","worker":"TpData.ObanWorkers.DiscardTest","source":"oban","tags":[],"duration":1002374,"attempt":2,"event":"job:exception","queue_time":122020}
10:54:15.139 [info] {"args":{},"id":3661,"meta":{"orig_scheduled_at":1758279236611976},"system_time":1758279255139528750,"max_attempts":2,"queue":"default","worker":"TpData.ObanWorkers.DiscardTest2","source":"oban","tags":[],"attempt":2,"event":"job:start"}
10:54:15.143 [error] {"error":"** (RuntimeError) DiscardTest2","args":{},"id":3661,"meta":{"orig_scheduled_at":1758279236611976},"state":"discard","max_attempts":2,"queue":"default","worker":"TpData.ObanWorkers.DiscardTest2","source":"oban","tags":[],"duration":565,"attempt":2,"event":"job:exception","queue_time":506112}
Meanwhile in the AppSignal dashboard there's only a report for TpData.ObanWorkers.DiscardTest2:

EDIT: changed from Oban.Pro.Worker to Oban.Worker with the same results
Metadata
Metadata
Assignees
Labels
bugConfirmed and unconfirmed bugs reported by us and customers.Confirmed and unconfirmed bugs reported by us and customers.