func main() { runtime.GOMAXPROCS(runtime.NumCPU()) configFilePath := flag.String("config", "config/opentsdb-firehose-nozzle.json", "Location of the nozzle config json file") flag.Parse() config, err := nozzleconfig.Parse(*configFilePath) if err != nil { log.Fatalf("Error parsing config: %s", err.Error()) } tokenFetcher := &uaatokenfetcher.UAATokenFetcher{ UaaUrl: config.UAAURL, Username: config.Username, Password: config.Password, InsecureSSLSkipVerify: config.InsecureSSLSkipVerify, } threadDumpChan := registerGoRoutineDumpSignalChannel() defer close(threadDumpChan) go dumpGoRoutine(threadDumpChan) opentsdbNozzle := opentsdbfirehosenozzle.NewOpenTSDBFirehoseNozzle(config, tokenFetcher) opentsdbNozzle.Start() }
tokenFetcher = &uaatokenfetcher.UAATokenFetcher{ UaaUrl: fakeUAA.URL(), } config = &nozzleconfig.NozzleConfig{ UAAURL: fakeUAA.URL(), OpenTSDBURL: fakeOpenTSDB.URL(), FlushDurationSeconds: 10, TrafficControllerURL: strings.Replace(fakeFirehose.URL(), "http:", "ws:", 1), DisableAccessControl: false, MetricPrefix: "opentsdb.nozzle.", } logOutput = gbytes.NewBuffer() log.SetOutput(logOutput) nozzle = opentsdbfirehosenozzle.NewOpenTSDBFirehoseNozzle(config, tokenFetcher) }) AfterEach(func() { fakeUAA.Close() fakeFirehose.Close() fakeOpenTSDB.Close() }) It("sends metrics when the FlushDurationTicker ticks", func(done Done) { defer close(done) fakeFirehose.KeepConnectionAlive() defer fakeFirehose.CloseAliveConnection() config.FlushDurationSeconds = 1 nozzle = opentsdbfirehosenozzle.NewOpenTSDBFirehoseNozzle(config, tokenFetcher)