diff --git a/lib/microwaveprop_web/metrics_plug.ex b/lib/microwaveprop_web/metrics_plug.ex index eaf8a654..440bdaf4 100644 --- a/lib/microwaveprop_web/metrics_plug.ex +++ b/lib/microwaveprop_web/metrics_plug.ex @@ -18,6 +18,12 @@ defmodule MicrowavepropWeb.MetricsPlug do :ok -> body = PromEx.get_metrics(Microwaveprop.PromEx) + # Defer the ETS cron flusher; otherwise it runs every + # `ets_flush_interval` (7.5s) concurrently with scrapes and its + # `Task.await` (hardcoded 10s) trips under contention, killing + # the GenServer. Upstream `PromEx.Plug` does the same. + PromEx.ETSCronFlusher.defer_ets_flush(Microwaveprop.PromEx.__ets_cron_flusher_name__()) + conn |> put_resp_content_type("text/plain; version=0.0.4") |> send_resp(200, body)