+
Skip to content

Conversation

snackycracky
Copy link

@snackycracky snackycracky commented Jul 21, 2025

Issue:

Oban is hardcoded, but the default instance is in some cases not available because a named supervisor is used.
see #260

Change description

What problem does this solve?

Exception when named functions are used:

[error] Error when calling MFA defined by measurement: PromEx.Plugins.Oban :execute_queue_metrics [MapSet.new([Oban, GridState.Jobs.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: 452]},
  {PromEx.Plugins.Oban, :handle_oban_queue_polling_metrics, 2,
   [file: ~c"lib/prom_ex/plugins/oban.ex", line: 441]},
  {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"/workdir/deps/telemetry_poller/src/telemetry_poller.erl",
     line: 471
   ]},
  {:telemetry_poller, :"-make_measurements_and_filter_misbehaving/1-lc$^0/1-0-",
   1,
   [
     file: ~c"/workdir/deps/telemetry_poller/src/telemetry_poller.erl",
     line: 467
   ]},
  {:telemetry_poller, :"-make_measurements_and_filter_misbehaving/1-lc$^0/1-0-",
   1,
   [
     file: ~c"/workdir/deps/telemetry_poller/src/telemetry_poller.erl",
     line: 467
   ]},
  {:telemetry_poller, :handle_info, 2,
   [
     file: ~c"/workdir/deps/telemetry_poller/src/telemetry_poller.erl",
     line: 492
   ]},
  {:gen_server, :try_handle_info, 3, [file: ~c"gen_server.erl", line: 2345]},
  {:gen_server, :handle_msg, 6, [file: ~c"gen_server.erl", line: 2433]},
  {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 329]}
]

Example usage

see testcase

Additional details and screenshots

Checklist

  • I have added unit tests to cover my changes.
  • I have added documentation to cover my changes.
  • My changes have passed unit tests and have been tested E2E in an example project.

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.

1 participant

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载