コード例 #1
0
	. "github.com/onsi/gomega"
)

const timeout = 15 * time.Second

type Stopper interface {
	Stop()
}

var _ = Describe("End to end benchmarks", func() {
	benchmarkEndToEnd := func() {
		Measure("dropsonde metrics being passed from metron to the firehose nozzle", func(b Benchmarker) {
			const writeRatePerSecond = 1000
			metronStreamWriter := endtoend.NewMetronStreamWriter()

			firehoseReader := endtoend.NewFirehoseReader()

			generator := messagegenerator.NewValueMetricGenerator()

			writeStrategy := writestrategies.NewConstantWriteStrategy(generator, metronStreamWriter, writeRatePerSecond)
			ex := experiment.NewExperiment(firehoseReader)
			ex.AddWriteStrategy(writeStrategy)

			ex.Warmup()

			go stopExperimentAfterTimeout(ex)
			b.Time("runtime", func() {
				ex.Start()
			})

			reportResults(firehoseReader, metronStreamWriter.Writes, b)
コード例 #2
0
			etcdCleanup, etcdClientURL := integration_tests.SetupEtcd()
			defer etcdCleanup()
			metronCleanup, metronPort, metronReady := integration_tests.SetupMetron(etcdClientURL, "udp")
			defer metronCleanup()
			dopplerCleanup, dopplerOutgoingPort := integration_tests.SetupDoppler(etcdClientURL, metronPort)
			defer dopplerCleanup()
			trafficcontrollerCleanup, tcPort := integration_tests.SetupTrafficcontroller(etcdClientURL, dopplerOutgoingPort, metronPort)
			defer trafficcontrollerCleanup()
			metronReady()

			const writeRatePerSecond = 10
			metronStreamWriter := endtoend.NewMetronStreamWriter(metronPort)
			generator := messagegenerator.NewLogMessageGenerator("custom-app-id")
			writeStrategy := writestrategies.NewConstantWriteStrategy(generator, metronStreamWriter, writeRatePerSecond)

			firehoseReader := endtoend.NewFirehoseReader(tcPort)
			ex := experiment.NewExperiment(firehoseReader)
			ex.AddWriteStrategy(writeStrategy)

			ex.Warmup()
			go func() {
				defer ex.Stop()
				time.Sleep(2 * time.Second)
			}()
			ex.Start()

			Eventually(firehoseReader.LogMessages).Should(Receive(ContainSubstring("custom-app-id")))
		}, 10)
	})
})