fix(dashboard): chart Avg windows flat-line at 0 on wide ranges (#168 downsampling regression)#228
Merged
Merged
Conversation
…sion) The chart downsampler (_downsample_history, used whenever a range exceeds its canvas point tier — i.e. the 24h / 1w / 1mo ranges) bucket-averaged only the legacy v / v_p2pool / v_xvb columns and dropped the per-window columns added in #168. So selecting any non-default Avg window (1m / 1h / 12h / 24h) on a wide range plotted a flat-zero line — the y-axis then auto-scaling to the Shares markers — even though the data was present. Only the default 10m window survived, because it reads v_p2pool/v_xvb (which were carried) plus the legacy `v` fallback. Confirmed on gouda: the last 24h held 1,896 non-zero v_p2pool_1m points (max 47.7 kH/s), yet the 24h/1Min chart rendered flat at 0. The downsampler now carries EVERY value column through, derived from HASHRATE_WINDOW_COLUMNS so a future averaging window can't regress the same way. - views.py: _DOWNSAMPLE_VALUE_COLUMNS (from the window map) + loop over it. - tests: direct _downsample_history column-preservation test + an end-to-end build_chart(24h, avg=1m) non-zero assertion (would fail before the fix); test-inventory regenerated. - CHANGELOG: Fixed entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
VijitSingh97
force-pushed
the
chart-downsample-perwindow
branch
from
June 12, 2026 14:11
cab81a5 to
d270baf
Compare
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.
The bug
On the 24h / 1w / 1mo ranges, selecting any Avg window other than the default 10 Min — i.e. 1 Min / 1 Hr / 12 Hr / 24 Hr — renders a flat line at zero (with the y-axis then auto-scaling to the tiny Shares-marker range, ~1.4). The 1h range works for all windows.
Reported from gouda:
Root cause
build_chartdownsamples whenever a range has more points than its canvas tier (_downsample_history, #47). The downsampler bucket-averaged only the legacyv/v_p2pool/v_xvbcolumns and silently dropped the per-window columns added in #168 (v_p2pool_1m,v_xvb_1m,v_*_1h,v_*_12h,v_*_24h)._split_valuesthen looks up e.g.v_p2pool_1mon the downsampled row, finds nothing →0, and thev-fallback only rescues the default 10m window. So every non-default Avg window collapses to 0 on any range wide enough to downsample. The 1h range (≤ point tier) keeps native rows, so it's unaffected — which is exactly the observed pattern.Not missing data — verified on gouda's DB: the last 24h holds 1,896 non-zero
v_p2pool_1mpoints (max 47,681 H/s), yet the chart drew zero.Fix
_downsample_historynow carries every value column through, derived fromHASHRATE_WINDOW_COLUMNSso a newly-added averaging window is averaged automatically and can't regress the same way:Display only — no change to data capture, the algorithm, or the default 10m series.
Tests
test_downsample_preserves_per_window_columns— asserts the bucket-averaged rows keep every per-window column.test_wide_range_keeps_nondefault_avg_nonzero— end-to-endbuild_chart(24h, avg=1m)over a downsampled series stays non-zero (fails before this fix).pytest518 passed;make test-inventoryregenerated; drift guard green. The Fake-daemon mini-stack CI job rebuilds + loads the dashboard.(Answers the "grey out empty selections?" question too: the selections aren't empty — the data was being dropped — so fixing the plot is the right call rather than disabling the buttons. The 12h/24h Avg windows still legitimately need that much uptime to fill, which #168 already signposts.)
🤖 Generated with Claude Code