Repository navigation
Keep the resource-monitor sparklines on a fixed 10-minute window - #36
Merged
Merged
Conversation
history arrays grew from length 1 toward HISTORY_LENGTH as samples came in, and the sparkline spaces points evenly across its full width regardless of how many it's given — so with only a few samples the line stretched edge to edge instead of representing a fixed time span. Left-pad the history to a constant length from the first sample: the line now starts short at the right edge and grows leftward as real samples fill the window, then slides once full. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
just get-openapi && just gen-client, picking up GET /protected/stats and
GET /protected/apps/{name}/stats (resource-monitor metrics, #155/#249).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
early samples across the full chart width instead of showing a short line near the
right edge.
js/metrics.js'spush()grows the history array from length 1 towardHISTORY_LENGTH(120), andfs-sparklinespaces its points evenly across the fullwidth based on however many values it's given — so a freshly-started shard's 2-3
samples got stretched edge to edge instead of representing their real ~15s span out
of a 10-minute window.
push()now left-pads the history to a constantHISTORY_LENGTHfrom the veryfirst sample, with
nullfor not-yet-collected slots. Per-sample spacing is thenalways fixed, so the line starts short at the right edge and grows leftward as real
samples fill the window, then behaves as a normal sliding window once full.
fs-sparklineitself needed no change — it already skipsnullpoints when drawing.Test plan
tests/unit/metrics.test.jscover: first-sample padding,right-anchored growth before the window fills, and sliding once full.
node --test tests/unit/— 86/86 pass.