yanic/respond/multi_collector.go

27 lines
587 B
Go
Raw Normal View History

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