Exemplo n.º 1
1
func BenchmarkAlexcesaro(b *testing.B) {
	s := newServer()
	c, err := alexcesaro.New(addr, alexcesaro.WithPrefix(prefix), alexcesaro.WithFlushPeriod(flushPeriod))
	if err != nil {
		b.Fatal(err)
	}
	b.StartTimer()
	for i := 0; i < b.N; i++ {
		c.Increment(counterKey)
		c.Gauge(gaugeKey, gaugeValue)
		c.Timing(timingKey, tValInt, 1)
	}
	c.Close()
	b.StopTimer()
	s.Close()
}
Exemplo n.º 2
0
func ExampleWithPrefix() {
	c, err := statsd.New(":8125", statsd.WithPrefix("my_app."))
	if err != nil {
		panic(err)
	}
	c.Increment("foo.bar") // Increments "my_app.foo.bar".
}