feat(admin): decouple metric retention window from scrape interval#93
Merged
Conversation
The per-instance ring buffer was sized at a fixed 360 samples, so lowering scraper.interval silently shrank the visible history (3s interval gave ~18 min instead of the 1h target). Add scraper.retention_window (default 1h, env CHAPERONE_ADMIN_SCRAPER_RETENTION_WINDOW) and compute ring capacity at startup so it actually spans the requested window — ceil(window/interval) + 1, since N snapshots span (N-1)*interval. Floor at 2 so degenerate inputs always leave a usable rate pair. Validation rejects retention_window < interval so the mismatch surfaces at load. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
victor-cuevas
previously approved these changes
May 8, 2026
qarlosh
requested changes
May 8, 2026
Collaborator
qarlosh
left a comment
There was a problem hiding this comment.
Two findings — see inline.
Add retention_window to the YAML example and env var table, and rewrite the history-retention bullet to reflect that capacity is now computed from scraper.retention_window and scraper.interval at startup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
historicalPair previously hardcoded a 50-minute readiness threshold and a 1-hour lookback. With retention_window now configurable, this caused trends to silently never render under 1h and to ignore the configured window above 1h. Plumb the trend window through Collector and derive both the threshold and the lookback from it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
qarlosh
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bumps the admin metric ring buffer to actually span the configured retention window. Adds a
scraper.retention_windowconfig (defaults to 1h) and sizes the ring from window/interval at startup so changing the scrape interval no longer silently shrinks the chart history.