Skip to content

Commit

Permalink
Including checks for Oban Pro
Browse files Browse the repository at this point in the history
  • Loading branch information
akoutmos committed Oct 24, 2024
1 parent 824b911 commit 4db5765
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/prom_ex/plugins/oban.ex
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,17 @@ if Code.ensure_loaded?(Oban) do
end

defp include_zeros_for_missing_queue_states(query_result) do
all_queues = Keyword.keys(Oban.config().queues)
{_, opts} =
Oban.config().plugins
|> Enum.find({nil, [queues: Oban.config().queues]}, fn {plugin, _} ->
plugin == Oban.Pro.Plugins.DynamicQueues
end)

all_queues =
opts
|> Keyword.get(:queues, [])
|> Keyword.keys()

all_states = Oban.Job.states()

zeros = for queue <- all_queues, state <- all_states, into: %{}, do: {{to_string(queue), to_string(state)}, 0}
Expand Down

0 comments on commit 4db5765

Please sign in to comment.