Esempio n. 1
0
func startHandler(name string, globalConfig config.Config, config map[string]interface{}) handler.Handler {
	log.Debug("Starting handler ", name)
	handler := handler.New(name)

	// apply any global configs
	handler.SetInterval(globalConfig.Interval)
	handler.SetPrefix(globalConfig.Prefix)
	handler.SetDefaultDimensions(globalConfig.DefaultDimensions)

	// now apply the handler level configs
	handler.Configure(config)

	go handler.Run()
	return handler
}
Esempio n. 2
0
func startHandlers(c Config) (handlers []handler.Handler) {
	log.Info("Starting handlers...")
	for name, config := range c.Handlers {
		handler := handler.New(name)

		// apply any global configs
		handler.SetInterval(c.Interval)
		handler.SetPrefix(c.Prefix)
		handler.SetDefaultDimensions(c.DefaultDimensions)

		// now apply the handler level configs
		handler.Configure(&config)

		handlers = append(handlers, handler)

		log.Info("Running ", handler)
		go handler.Run()
	}
	return handlers
}