Пример #1
0
func Start() {
	flag.Parse()
	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	conf := flux.BatchPointsConfig{
		Precision:        "",
		Database:         "",
		RetentionPolicy:  "",
		WriteConsistency: "",
	}

	stats := make(chan flux.BatchPoints, 10000)
	points := make(chan *flux.Point, 10000)

	targets := hitman.NewTargets()
	targets.AddOrPanic(reporter.NewFlusher(stats))
	targets.AddOrPanic(reporter.NewReporter(conf, stats, points))

	closer := NewCloser(targets).AddAll(Fire(points, 200))

	death.NewDeath(syscall.SIGINT, syscall.SIGTERM).WaitForDeath(closer)
}
Пример #2
0
func main() {
	w := logErrors(watchInput("input/"))

	go printStats(collect(
		runReadfile,
		decodeFile,
		whenCreation(w.watcher.Events),
		time.NewTicker(time.Second).C))

	death.NewDeath(SYS.SIGINT, SYS.SIGTERM).WaitForDeath(w)
}
Пример #3
0
func main() {
	route()
	log.Println("Listening at http://localhost:8000")
	http.ListenAndServe(":8000", nil)
	death.NewDeath(SYS.SIGINT, SYS.SIGTERM).WaitForDeath()
}