Beispiel #1
0
func getCollectorBatchSize(collectorName string,
	globalConfig config.Config,
	defaultBufSize int) (result int) {
	conf, err := globalConfig.GetCollectorConfig(collectorName)
	result = defaultBufSize
	if err != nil {
		return
	}

	if bufferSize, exists := conf["max_buffer_size"]; exists {
		result = config.GetAsInt(bufferSize, defaultBufSize)
	}
	return
}
Beispiel #2
0
func startCollectors(c config.Config) (collectors []collector.Collector) {
	log.Info("Starting collectors...")

	for _, name := range c.Collectors {
		conf, err := c.GetCollectorConfig(name)
		if err != nil {
			log.Error("Collector config failed to load for: ", name)
			continue
		}

		collectorInst := startCollector(name, c, conf)
		if collectorInst != nil {
			collectors = append(collectors, collectorInst)
		}
	}
	return collectors
}