Simplify sliding window collapse. (#1802)

* Simplify sliding window collapse.

Keep the same value collapsing simple.
Add it to sliding window as long as same value is received for longer
than collapse threshold.
But, add a prune with three conditions to process the siliding window
to ensure only valid samples are kept.

* flip the order of validity window and same value pruning

* increase collapse threshold to 0.5 seconds during non-probe
This commit is contained in:
Raja Subramanian
2023-06-17 18:56:38 +05:30
committed by GitHub
parent 395f403132
commit 2383234f6e
3 changed files with 71 additions and 40 deletions
@@ -60,6 +60,7 @@ type ChannelObserverParams struct {
EstimateRequiredSamples int
EstimateDownwardTrendThreshold float64
EstimateCollapseThreshold time.Duration
EstimateValidityWindow time.Duration
NackWindowMinDuration time.Duration
NackWindowMaxDuration time.Duration
NackRatioThreshold float64
@@ -87,6 +88,7 @@ func NewChannelObserver(params ChannelObserverParams, logger logger.Logger) *Cha
RequiredSamples: params.EstimateRequiredSamples,
DownwardTrendThreshold: params.EstimateDownwardTrendThreshold,
CollapseThreshold: params.EstimateCollapseThreshold,
ValidityWindow: params.EstimateValidityWindow,
}),
nackTracker: NewNackTracker(NackTrackerParams{
Name: params.Name + "-nack",