fix(stats): prevent package download totals from resetting during aggregation - #666
Open
andrii-suse wants to merge 1 commit into
Open
fix(stats): prevent package download totals from resetting during aggregation#666andrii-suse wants to merge 1 commit into
andrii-suse wants to merge 1 commit into
Conversation
…regation The daily stat aggregator `_agg_total` was joining previous cumulative totals using the global maximum `'total'` date instead of the package-specific latest `'total'` date. If a package was not downloaded on the exact day of the last global run, it had no total record for that date. This resulted in a failed join, wiping out its entire historical statistics and resetting the cumulative count. This fix: 1. Refactors `_agg_total` to join previous totals on a package-specific basis using an optimized subquery. 2. Scopes WebAPI queries `cnt_total` and `cnt_today` to the requested package ID to correctly show cumulative totals even during inactive days. 3. Adds a time-boundary-immune integration test in `20-report-download.sh` that freezes time relative to a single point to verify the fixes and prevent regressions.
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 daily stat aggregator
_agg_totalwas joining previous cumulative totals using the global maximum'total'date instead of the package-specific latest'total'date. If a package was not downloaded on the exact day of the last global run, it had no total record for that date. This resulted in a failed join, wiping out its entire historical statistics and resetting the cumulative count.This fix:
_agg_totalto join previous totals on a package-specific basis using an optimized subquery.cnt_totalandcnt_todayto the requested package ID to correctly show cumulative totals even during inactive days.20-report-download.shthat freezes time relative to a single point to verify the fixes and prevent regressions.