func init() { server, pass, err := utils.ParseRedisUrl() if err != nil { log.Fatal(err) } rs = store.NewRedisStore(server, pass, numPartitions, maxRedisConn) }
func main() { concurrency := utils.EnvInt("LOCAL_WORKERS", 2) numPartitions := utils.EnvUint64("NUM_OUTLET_PARTITIONS", 1) server, pass, err := utils.ParseRedisUrl() if err != nil { log.Fatal(err) } rs := store.NewRedisStore(server, pass, numPartitions, concurrency*2) rdr := outlet.NewBucketReader(1000) rdr.NumScanners = concurrency rdr.NumOutlets = concurrency rdr.Store = rs rdr.Interval = time.Millisecond * 500 l := outlet.NewLibratoOutlet(1000, 1000, 1000) l.Reader = rdr l.NumOutlets = concurrency l.NumConverters = concurrency l.Retries = 2 l.User = utils.EnvString("LIBRATO_USER", "") l.Pass = utils.EnvString("LIBRATO_TOKEN", "") l.Start() select {} }
func main() { // The number of partitions that our backends support. numPartitions := utils.EnvUint64("NUM_OUTLET_PARTITIONS", 1) // The bucket.Store struct will initialize a redis pool for us. maxRedisConn := utils.EnvInt("OUTLET_C", 2) + 100 // We use the store to Put buckets into redis. server, pass, err := utils.ParseRedisUrl() if err != nil { log.Fatal(err) } rs := store.NewRedisStore(server, pass, numPartitions, maxRedisConn) reqBuf := utils.EnvInt("REQUEST_BUFFER", 1000) recv := receiver.NewReceiver(reqBuf, reqBuf) recv.FlushInterval = time.Millisecond * 200 recv.NumOutlets = utils.EnvInt("OUTLET_C", 100) recv.NumAcceptors = utils.EnvInt("ACCEPT_C", 100) recv.Store = rs recv.Start() go recv.Report() http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { healthCheck(w, r, rs) }) http.HandleFunc("/logs", func(w http.ResponseWriter, r *http.Request) { recvLogs(w, r, recv) }) httpOutlet := new(outlet.HttpOutlet) httpOutlet.Store = rs http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) { httpOutlet.ServeReadBucket(w, r) }) port := utils.EnvString("PORT", "8000") err = http.ListenAndServe(":"+port, nil) if err != nil { fmt.Printf("error=%s msg=%q\n", err, "Unable to start http server.") os.Exit(1) } fmt.Printf("at=l2met-initialized port=%s\n", port) }
func main() { // The number of partitions that our backends support. numPartitions := utils.EnvUint64("NUM_OUTLET_PARTITIONS", 1) // The bucket.Store struct will initialize a redis pool for us. maxRedisConn := utils.EnvInt("OUTLET_C", 2) + 100 // We use the store to Put buckets into redis. server, pass, err := utils.ParseRedisUrl() if err != nil { log.Fatal(err) } rs := store.NewRedisStore(server, pass, numPartitions, maxRedisConn) interval := time.Millisecond * 200 rdr := &outlet.BucketReader{Store: rs, Interval: interval} g := outlet.NewGraphiteOutlet() g.Reader = rdr g.ApiToken = utils.EnvString("GRAPHITE_API_TOKEN", "") g.Start() select {} }