Example #1
0
func main() {
	var (
		plugins = collect.NewPool(cfg.CollectPath)
		self    = stats.Self("tsp.forwarder.")
		joined  = tsdb.Join(plugins.C, self)
		final   = filter.Series(cfg.Filter, joined)
		relays  = relay.NewPool(cfg.Relay, final)
	)
	go Restart(func() {
		plugins.Kill()
	})
	relays.Broadcast()
}
Example #2
0
// SelfStats is like stats.Self except the returned tsdb.Chan is filtered using
// the given rules.
func SelfStats(prefix string, rules []filter.Rule) tsdb.Chan {
	var (
		self     = stats.Self(prefix)
		filtered = filter.Series(rules, self)
		out      = make(chan *tsdb.Point)
	)
	go func() {
		for {
			out <- filtered.Next()
		}
	}()
	return out
}