fix(metrics): defer ETS cron flusher on /metrics scrape
Without the deferral the cron-driven ETS flush GenServer fires every 7.5s alongside Prometheus scrapes, calls PromEx.get_metrics in a Task, and dies with `Task.await ... time out` (hardcoded 10s) under contention. Mirrors upstream PromEx.Plug, which calls defer_ets_flush after a successful render specifically to suppress the cron while scraping is healthy.
This commit is contained in:
parent
af08e72816
commit
6c5d066121
1 changed files with 6 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue