diff --git a/config/test.exs b/config/test.exs index 36cd48fc..8aad59e8 100644 --- a/config/test.exs +++ b/config/test.exs @@ -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] diff --git a/lib/microwaveprop_web/telemetry.ex b/lib/microwaveprop_web/telemetry.ex index f53615bb..38493f05 100644 --- a/lib/microwaveprop_web/telemetry.ex +++ b/lib/microwaveprop_web/telemetry.ex @@ -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