Beispiel #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
}
Beispiel #2
0
func startHandlers(c Config) (handlers []handler.Handler) {
	log.Println("Starting handlers...")

	defaults := convertToDimensions(&c.DefaultDimensions)

	for name, config := range c.Handlers {
		handler := buildHandler(name)

		// apply any global configs
		handler.SetPrefix(c.Prefix)
		handler.SetDefaultDimensions(&defaults)

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

		handlers = append(handlers, handler)
		go handler.Run()
	}
	return handlers
}
Beispiel #3
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
}