Example #1
0
func (self *reservoirSamplerFactory) NewSampler(param *StatsParameter) (sampling.Sampler, error) {
	s := sampling.NewReservoirSampler(param.NumSamples)
	if param.ResetPeriod.Seconds() > 1.0 {
		s = sampling.NewPeriodcallyResetSampler(param.ResetPeriod, s)
	}
	return s, nil
}
Example #2
0
func newContainerStore(ref info.ContainerReference, maxNumSamples, maxNumStats int) *containerStorage {
	s := sampling.NewReservoirSampler(maxNumSamples)
	return &containerStorage{
		ref:         ref,
		recentStats: list.New(),
		sampler:     s,
		maxNumStats: maxNumStats,
	}
}