refactor: replace VividCortex/ewma with inline EWMA math - #22029
refactor: replace VividCortex/ewma with inline EWMA math#22029davdhacs wants to merge 2 commits into
Conversation
Single use in restore progress display. The exponentially weighted moving average with age=30 is: value += (2/31) * (sample - value). Three lines of arithmetic vs a whole dependency. Generated with AI assistance.
VividCortex/ewma stays as indirect — still needed by vbauerster/mpb which is used by the restore progress bar. Generated with AI assistance.
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe restore progress speed calculation no longer imports ChangesRestore speed estimation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Build Images ReadyImages are ready for commit 24fa0d5. To use with deploy scripts: export MAIN_IMAGE_TAG=4.12.x-622-g24fa0d5f29 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22029 +/- ##
==========================================
- Coverage 51.23% 51.19% -0.04%
==========================================
Files 2864 2865 +1
Lines 178713 178809 +96
==========================================
- Hits 91560 91550 -10
- Misses 79117 79198 +81
- Partials 8036 8061 +25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@janisz I am pursuing this because I have been looking for dependencies to remove. This looks like a good candidate for removal because it is only used here and doesn't do much (math we can inline that won't change (no external service)). What do you think? |
Description
Replace
github.com/VividCortex/ewmawith 3 lines of inline exponentially weighted moving average math. The library was used in a single file (roxctl/central/db/restore/v2_restorer.go) for a progress bar speed display.The EWMA formula with default age=30:
value += (2/31) * (sample - value). Three lines of arithmetic replacing a full module import.VividCortex/ewma demoted from direct to indirect (still needed transitively by vbauerster/mpb).
User-facing documentation
No user-facing behavior changes.
Testing and quality
Automated testing
How I validated my change
go build ./roxctl/...passes