Ejemplo n.º 1
0
func TestSetMetricsGlobal(t *testing.T) {
	metrics.IncrementCount("countMetric") // doesn't blow up when no global set

	tr := TestRecorder{metrics: map[string]interface{}{}}
	metrics.SetMetricsGlobal(&tr)
	metrics.IncrementCount("countMetric")
	if want, have := 1, tr.metrics["countMetric"]; want != have {
		t.Errorf("want %#v, have %#v", want, have)
	}

	metrics.IncrementCountBy("countMetric", 3)
	if want, have := 4, tr.metrics["countMetric"]; want != have {
		t.Errorf("want %#v, have %#v", want, have)
	}
}
Ejemplo n.º 2
0
func TestGetDatadogStatsdMetric(t *testing.T) {
	dd, _ := metrics.NewDatadogStatsdRecorder("127.0.0.1:8888", "namespace", "hostname")
	dd.IncrementCount("countMetric")
	metrics.SetMetricsGlobal(dd)
	metrics.IncrementCount("countMetric")
}
Ejemplo n.º 3
0
func TestGetStatsdMetric(t *testing.T) {
	sd, _ := metrics.NewStatsdRecorder("127.0.0.1:8888", "namespace")
	sd.IncrementCount("countMetric") // doesn't panic
	metrics.SetMetricsGlobal(sd)
	metrics.IncrementCount("countMetric")
}