Beispiel #1
0
func expvarLoop() {
	tick := tsdb.Tick(10 * time.Second)
	for {
		t := <-tick
		tsdbutil.ExportVars(t, func(p *tsdb.Point) {
			metric := []byte("tsp.collect-netscaler.")
			metric = append(metric, p.Metric()...)
			if err := p.SetMetric(metric); err != nil {
				panic(err)
			}
			tsdbChan <- p
		})
	}
}
Beispiel #2
0
func expvarLoop() {
	tick := tsdb.Tick(varInterval)
	for {
		now := <-tick
		metric := make([]byte, 0, 1024)
		tsdbutil.ExportVars(now, func(p *tsdb.Point) {
			metric = append(metric[:0], "tsp.collect-statse."...)
			metric = append(metric, p.Metric()...)
			err := p.SetMetric(metric)
			if err != nil {
				log.Panic(err)
			}
			tsdbChan <- p
		})
	}
}
Beispiel #3
0
// Self returns a tsdb.Chan that carries complete dump of expvar variables.
// Refreshed according to Interval.
func Self(prefix string) tsdb.Chan {
	ch := make(chan *tsdb.Point)
	go func() {
		tick := tsdb.Tick(Interval)
		for {
			now := <-tick
			metric := make([]byte, 0, 1024)
			tsdbutil.ExportVars(now, func(p *tsdb.Point) {
				metric = append(metric[:0], prefix...)
				metric = append(metric, p.Metric()...)
				err := p.SetMetric(metric)
				if err != nil {
					log.Panic(err)
				}
				ch <- p
			})
		}
	}()
	return ch
}