func (w *IntWindow) Stats() Metrics {
	return Metrics{
		"avg": IntAverage(w.window[w.offset:w.end]),
	}
}
Stats is the implementation of Collector for IntWindow
package stats
type IntWindow struct {
	offset     uint32
	end        uint32
	maxSamples uint32
	window     []int64
}
func NewIntWindow(maxSamples uint32) *IntWindow {
	return &IntWindow{
		offset:     0,
		end:        0,
		maxSamples: maxSamples,
		window:     make([]int64, maxSamples<<1),
	}
}
func (w *IntWindow) Add(sample int64) {
	w.window[w.end] = sample
	w.end++
	winlen := len(w.window)
	if w.end == uint32(winlen) {
		index := uint32(winlen) - w.maxSamples
		copy(w.window, w.window[index:])
		w.offset = 0
		w.end = w.maxSamples
	}
	if w.end-w.offset > w.maxSamples {
		w.offset = w.end - w.maxSamples
	}
}