fix(host_agent): the server writes all five samples an agent post carries (#5181)

MAX_SAMPLES_PER_INGEST was 2 while agent 1.10 drains a backlog five samples a
post, so the server dropped the oldest three of every such post. Posts now
answer in 0.4-1.3 s on dev, including the boot cleanup window, so five fit
the agent's 10 s. A test holds the server cap at or above the agent's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 21:05:22 -04:00
co-authored by Claude Opus 5.5
parent 326a9cd254
commit 2f208a84fb
2 changed files with 12 additions and 3 deletions
+4 -3
View File
@@ -344,9 +344,10 @@ SLOW_INGEST_SECONDS = 2.0
# instance that did not finish inside the agent's 10 s, the rollback left the
# buffer full, and every later post failed the same way. The newest samples
# are kept: the older ones would be lost to the agent's ring buffer anyway.
# Two (~400 rows) fits 10 s even at the ~110 rows/s measured before
# plugin_metrics got time-ordered ids; raise it once the new rate is known.
MAX_SAMPLES_PER_INGEST = 2
# Five matches the agent's MAX_SAMPLES_PER_POST (1.10+), so its backlog posts
# land whole: ~1,000 metric rows at the 1,300-4,000 rows/s measured once
# plugin_metrics got time-ordered ids, with posts answering in 0.4-1.3 s (#5181).
MAX_SAMPLES_PER_INGEST = 5
def newest_samples(samples: list, limit: int) -> tuple[list, int]: