Open linqueta opened 1 year ago
Suggesting a possible solution:
After fetching all queue states from the database, using the function Oban.states()
for each queue we can set as 0 for states didn't find, for example, for the queue create_order
we se the state executing
as 0 after don't have any job executing.
I can open a PR if it's reasonable.
Describe the bug At my company when creating a chart for when some queue gets zero jobs executing after some time I faced that Oban is not sending when a queue state reaches the number 0
Running the same query that we run to fetch queues grouped by state I could see a pattern like this:
Example: Queues: create_order and deliver_order
After creating an order the job gets completed and triggered to deliver, so the response of the query will be:
After some time my program will finish the creation and I'll have:
So, I'm interested to understand when the queue
create_order
in the stateexecuting
gets 0 but it's not possible since this metric is implemented aslast_value
(implementation) and we are keeping the last value of the last pooling round (ex: 5 seconds before finishing the creation the value was 10).To Reproduce Steps to reproduce the behavior:
default
)/metrics
about the state of the queuedefault
for the stateexecuting
and you will see the value 1 even the job has the statecompleted
Expected behavior I expected that for all possible Oban Job states (
[:scheduled, :available, :executing, :retryable, :cancelled, :completed, :discarded]
) the PromEx Oban plugin sets as 0 if the state wasn't found into the database, avoiding the wrong value set into thelast_value
metric.Environment
23.2.3
1.13.1-otp-23
Additional context