Skip to content

Instantly share code, notes, and snippets.

@bernerdschaefer
Created May 8, 2013 09:10
Show Gist options
  • Save bernerdschaefer/5539253 to your computer and use it in GitHub Desktop.
Save bernerdschaefer/5539253 to your computer and use it in GitHub Desktop.
package main
func main() {
config := MustLoadConfig(*configFile)
storage := MustNewStorage(
*memoryAppendQueueCapacity,
*diskAppendQueueCapacity,
100, // ?
time.Second*30, // ?
time.Second*1, // ?
time.Second*20, // ?
*metricsStoragePath,
)
resultProcessor := NewResultProcessor(*sampleResultQueueCapacity)
targetManager := MustNewTargetManager(config, resultProcessor.ch, *concurrentRetrievalAllowance)
ruleManager := MustNewRuleManager(config, resultProcessor.ch, storage)
web := MustNewWebService(config, targetManager, storage)
curators := &metric.Curators{
NewCurator("head", storage, *headCompactInterval, *headAge, *headGroupSize),
NewCurator("body", storage, *bodyCompactInterval, *bodyAge, *bodyGroupSize),
NewCurator("tail", storage, *tailCompactInterval, *tailAge, *tailGroupSize),
}
go storage.Start()
go resultProcessor.Start()
go targetManager.Start()
go ruleManager.Start()
go curators.Start()
go web.Start()
stop := make(chan os.Signal)
signal.Notify(stop, os.Interrupt)
<-stop
log.Println("Received SIGINT; Exiting Gracefully...")
web.Stop()
curators.Stop()
ruleManager.Stop()
targetManager.Stop()
resultProcessor.Stop()
storage.Stop()
os.Exit(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment