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:
@@ -344,9 +344,10 @@ SLOW_INGEST_SECONDS = 2.0
|
|||||||
# instance that did not finish inside the agent's 10 s, the rollback left the
|
# 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
|
# 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.
|
# 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
|
# Five matches the agent's MAX_SAMPLES_PER_POST (1.10+), so its backlog posts
|
||||||
# plugin_metrics got time-ordered ids; raise it once the new rate is known.
|
# land whole: ~1,000 metric rows at the 1,300-4,000 rows/s measured once
|
||||||
MAX_SAMPLES_PER_INGEST = 2
|
# 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]:
|
def newest_samples(samples: list, limit: int) -> tuple[list, int]:
|
||||||
|
|||||||
@@ -73,3 +73,11 @@ def test_a_full_backlog_is_cut_to_its_newest_samples():
|
|||||||
def test_a_small_post_is_left_alone():
|
def test_a_small_post_is_left_alone():
|
||||||
posted = [_s(3), _s(1)]
|
posted = [_s(3), _s(1)]
|
||||||
assert routes.newest_samples(posted, 5) == (posted, 0)
|
assert routes.newest_samples(posted, 5) == (posted, 0)
|
||||||
|
|
||||||
|
|
||||||
|
def test_the_server_writes_every_sample_an_agent_post_carries():
|
||||||
|
# An agent drains its backlog MAX_SAMPLES_PER_POST at a time; a server cap
|
||||||
|
# below that drops the oldest of every such post (#5181).
|
||||||
|
from plugins.host_agent import agent
|
||||||
|
|
||||||
|
assert routes.MAX_SAMPLES_PER_INGEST >= agent.MAX_SAMPLES_PER_POST
|
||||||
|
|||||||
Reference in New Issue
Block a user