func (self *chainSamplerFactory) NewSampler(param *StatsParameter) (sampling.Sampler, error) { s := sampling.NewChainSampler(param.NumSamples, param.WindowSize) if param.ResetPeriod.Seconds() > 1.0 { s = sampling.NewPeriodcallyResetSampler(param.ResetPeriod, s) } return s, nil }
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 }
func (self *esSamplerFactory) NewSampler(param *StatsParameter) (sampling.Sampler, error) { s := sampling.NewESSampler(param.NumSamples, func(d interface{}) float64 { stats := d.(*info.ContainerStats) delta := self.startTime.Sub(stats.Timestamp) return delta.Seconds() }) if param.ResetPeriod.Seconds() > 1.0 { s = sampling.NewPeriodcallyResetSampler(param.ResetPeriod, s) } return s, nil }