Exemple #1
0
func (cmd *GuardianCommand) wireMetronNotifier(log lager.Logger, metricsProvider metrics.Metrics) *metrics.PeriodicMetronNotifier {
	return metrics.NewPeriodicMetronNotifier(
		log, metricsProvider, cmd.Metrics.EmissionInterval, clock.NewClock(),
	)
}
		fakeMetrics = new(fakes.FakeMetrics)
		fakeMetrics.LoopDevicesReturns(33)
		fakeMetrics.BackingStoresReturns(12)
		fakeMetrics.DepotDirsReturns(3)

		fakeClock = fakeclock.NewFakeClock(time.Unix(123, 456))

		sender = fake.NewFakeMetricSender()
		dropsonde_metrics.Initialize(sender, nil)
	})

	JustBeforeEach(func() {
		pmn = metrics.NewPeriodicMetronNotifier(
			lagertest.NewTestLogger("test"),
			fakeMetrics,
			reportInterval,
			fakeClock,
		)
		pmn.Start()
	})

	AfterEach(func() {
		pmn.Stop()
	})

	Context("when the report interval elapses", func() {
		It("emits metrics", func() {
			fakeClock.Increment(reportInterval)

			Eventually(func() fake.Metric {
				return sender.GetValue("LoopDevices")