Ejemplo n.º 1
0
				fake.Metric{
					Value: 2000,
					Unit:  "ms",
				}))
		})
	})

	Context("sends route metrics", func() {
		var endpoint *route.Endpoint

		BeforeEach(func() {
			endpoint = new(route.Endpoint)
		})

		It("sends number of nats messages received from each component", func() {
			endpoint.Tags = map[string]string{"component": "uaa"}
			metricsReporter.CaptureRegistryMessage(endpoint)

			endpoint.Tags = map[string]string{"component": "route-emitter"}
			metricsReporter.CaptureRegistryMessage(endpoint)

			Eventually(func() uint64 { return sender.GetCounter("registry_message.route-emitter") }).Should(BeEquivalentTo(1))
			Eventually(func() uint64 { return sender.GetCounter("registry_message.uaa") }).Should(BeEquivalentTo(1))
		})

		It("sends the total routes", func() {
			metricsReporter.CaptureRouteStats(12, 5)
			Eventually(func() fake.Metric { return sender.GetValue("total_routes") }).Should(Equal(
				fake.Metric{
					Value: 12,
					Unit:  "",