-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: EMAThroughput sampler #58
Conversation
3fb72a1
to
c143ded
Compare
var _ Sampler = (*EMAThroughput)(nil) | ||
|
||
func (e *EMAThroughput) Start() error { | ||
// apply defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be nice to have these defaults defined as constants where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're configuration default values; the only use of them is here. To me it seems counterproductive to invent a new set of names for the constants and move them to a block located elsewhere. I feel like that's why a Start() function exists.
This adds a new sampler type, an EMAThroughput sampler.
The EMASampleRate sampler requires specifying a desired sample rate. But more often, what someone would like to do is specify a given throughput. The WindowedThroughput sampler does that, but does so at the cost of maintaining a buffer of N previous sample rates, each of which is of equal weight.
The EMAThroughput sampler maintains a diminishing moving average of samples over time; older data is of less weight than current data. It also doesn't need to maintain any extra buffers.
Fixes #51.