yanic/respond/multi_collector.go

27 lines
587 B
Go
Raw Normal View History

2016-03-09 02:49:27 +00:00
package respond
import "time"
//MultiCollector struct
type MultiCollector struct {
collectors []*Collector
}
//NewMultiCollector create a list of collectors
2016-03-11 22:56:23 +00:00
func NewMultiCollector(interval time.Duration, parseFunc ParseFunc) *MultiCollector {
2016-03-09 02:49:27 +00:00
return &MultiCollector{
collectors: []*Collector{
2016-03-11 22:56:23 +00:00
NewCollector("statistics", interval, parseFunc),
NewCollector("nodeinfo", interval, parseFunc),
NewCollector("neighbours", interval, parseFunc),
2016-03-09 02:49:27 +00:00
},
}
}
//Close all Collections
func (multi *MultiCollector) Close() {
for _, col := range multi.collectors {
col.Close()
}
}