Skip to content

fix: use oban name to retrieve config#260

Open
aleagnelli wants to merge 1 commit intoakoutmos:masterfrom
aleagnelli:fix-config
Open

fix: use oban name to retrieve config#260
aleagnelli wants to merge 1 commit intoakoutmos:masterfrom
aleagnelli:fix-config

Conversation

@aleagnelli
Copy link
Contributor

Change description

Retrieve Oban's config with the correct name

What problem does this solve?

Setting up an Oban instance with a custom name like this:

config :my_app, Oban,
  name: MyCustom.Oban,
  repo: MyApp.Repo,
  queues: [default: 10]

results in the following error

16:09:42.585 [error] Error when calling MFA defined by measurement: PromEx.Plugins.Oban :execute_queue_metrics [MapSet.new([MyCustom.Oban])]
Class=:error
Reason=%RuntimeError{
  message: "No Oban instance named `Oban` is running and config isn't available.\n"
}
Stacktrace=[
  {Oban.Registry, :config, 1, [file: ~c"lib/oban/registry.ex", line: 37]},
  {PromEx.Plugins.Oban, :include_zeros_for_missing_queue_states, 1,
   [file: ~c"lib/prom_ex/plugins/oban.ex", line: 454]},
  {PromEx.Plugins.Oban, :handle_oban_queue_polling_metrics, 2,
   [file: ~c"lib/prom_ex/plugins/oban.ex", line: 443]},
  {Enum, :"-each/2-fun-0-", 3, [file: ~c"lib/enum.ex", line: 992]},
  {Enum, :"-each/2-anonymous-3-", 3, [file: ~c"lib/enum.ex", line: 4511]},
  {Enumerable.List, :reduce, 3, [file: ~c"lib/enum.ex", line: 4964]},
  {Enum, :each, 2, [file: ~c"lib/enum.ex", line: 4511]},
  {:telemetry_poller, :make_measurement, 1,
   [
     file: ~c"/Users/ale/workspace/customoban/deps/telemetry_poller/src/telemetry_poller.erl",
     line: 336
   ]}
]

@aleagnelli
Copy link
Contributor Author

aleagnelli commented Apr 2, 2025

Hi @akoutmos , just checking in on this PR whenever you get a chance.
Let me know if you need anything from me.

@snackycracky
Copy link

snackycracky commented Jul 21, 2025

This solution has also a test: #271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments