test: gate Oban queue-depth poller on :start_telemetry_poller flag
MicrowavepropWeb.Telemetry's :telemetry_poller fires dispatch_oban_queue_depth/0 every 30 s. In test env it runs outside any Ecto sandbox owner, so its `Repo.all` against oban_jobs holds a pool connection long enough to starve LiveView `render_async` tests with 100 ms async windows — repro'd as flaky SkewtLive failures. Same shape as the PromEx Oban plugin we already disable in test via :prom_ex_include_oban_plugin. Add :start_telemetry_poller (defaults to true) and toggle it off in config/test.exs. Production keeps the 30-second per-(queue,state) gauge.
This commit is contained in:
parent
b8eea1bd45
commit
be1ebdc035
2 changed files with 20 additions and 9 deletions
|
|
@ -113,6 +113,13 @@ config :microwaveprop, nexrad_req_options: [plug: {Req.Test, Microwaveprop.Weath
|
|||
config :microwaveprop, solar_req_options: [plug: {Req.Test, Microwaveprop.Weather.SolarClient}]
|
||||
config :microwaveprop, srtm_req_options: [plug: {Req.Test, Microwaveprop.Terrain.Srtm}, retry: false]
|
||||
config :microwaveprop, start_freshness_monitor: false
|
||||
|
||||
# The Oban queue-depth poller (`MicrowavepropWeb.Telemetry`) runs every
|
||||
# 30 s outside any sandbox owner. Its query against `oban_jobs` holds a
|
||||
# pool connection long enough to race LiveView `start_async` tests with
|
||||
# 100 ms async windows (e.g. SkewtLive). Off in tests; the same
|
||||
# poll-once-per-pod metric is irrelevant inside a single-process suite.
|
||||
config :microwaveprop, start_telemetry_poller: false
|
||||
config :microwaveprop, swpc_req_options: [plug: {Req.Test, Microwaveprop.SpaceWeather.SwpcClient}, retry: false]
|
||||
config :microwaveprop, uwyo_req_options: [plug: {Req.Test, Microwaveprop.Weather.UwyoSoundingClient}, retry: false]
|
||||
|
||||
|
|
|
|||
|
|
@ -10,15 +10,19 @@ defmodule MicrowavepropWeb.Telemetry do
|
|||
|
||||
@impl true
|
||||
def init(_arg) do
|
||||
children = [
|
||||
# Oban queue-depth is the only poller measurement and each replica
|
||||
# issues the same GROUP-BY over oban_jobs. 30s gives enough fidelity
|
||||
# for dashboard trends without burning ~3/min of identical queries
|
||||
# per extra replica.
|
||||
{:telemetry_poller, measurements: periodic_measurements(), period: 30_000}
|
||||
# Add reporters as children of your supervision tree.
|
||||
# {Telemetry.Metrics.ConsoleReporter, metrics: metrics()}
|
||||
]
|
||||
# Oban queue-depth is the only poller measurement and each replica
|
||||
# issues the same GROUP-BY over oban_jobs. 30s gives enough fidelity
|
||||
# for dashboard trends without burning ~3/min of identical queries
|
||||
# per extra replica. Skipped in test (no sandbox owner → connection
|
||||
# contention with LiveView async tests; identical pattern to the
|
||||
# PromEx Oban plugin we already disable via
|
||||
# `:prom_ex_include_oban_plugin`).
|
||||
children =
|
||||
if Application.get_env(:microwaveprop, :start_telemetry_poller, true) do
|
||||
[{:telemetry_poller, measurements: periodic_measurements(), period: 30_000}]
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
Supervisor.init(children, strategy: :one_for_one)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue