Exemplo n.º 1
0
func (t *ATestSuite) TestSetNamespace(c *C) {
	var g *godspeed.AsyncGodspeed
	g, err := godspeed.NewDefaultAsync()
	c.Assert(err, IsNil)
	c.Check(g.Godspeed.Namespace, Equals, "")
	g.SetNamespace("heckman")
	c.Check(g.Godspeed.Namespace, Equals, "heckman")
}
Exemplo n.º 2
0
func (t *ATestSuite) TestNewDefaultAsync(c *C) {
	var g *godspeed.AsyncGodspeed
	g, err := godspeed.NewDefaultAsync()
	c.Assert(err, IsNil)

	defer g.Godspeed.Conn.Close()

	testAsyncBasicFunc(t, c, g)
}
Exemplo n.º 3
0
func ExampleAsyncGodspeed_Gauge() {
	a, _ := godspeed.NewDefaultAsync()

	defer a.Godspeed.Conn.Close()

	a.W.Add(1)

	go a.Gauge("example.gauge", 1, nil, a.W)

	a.W.Wait()
}
Exemplo n.º 4
0
func ExampleAsyncGodspeed_Count() {
	a, _ := godspeed.NewDefaultAsync()

	defer a.Godspeed.Conn.Close()

	a.W.Add(1)

	go a.Count("example.count", 42, nil, a.W)

	a.W.Wait()
}
Exemplo n.º 5
0
func ExampleAsyncGodspeed_Send() {
	a, _ := godspeed.NewDefaultAsync()

	defer a.Godspeed.Conn.Close()

	a.W.Add(1)

	go a.Send("example.stat", "g", 1, 1, nil, a.W)

	a.W.Wait()
}
Exemplo n.º 6
0
func ExampleAsyncGodspeed_Event() {
	a, _ := godspeed.NewDefaultAsync()

	defer a.Godspeed.Conn.Close()

	a.W.Add(1)

	go a.Event("example event", "something happened", nil, nil, a.W)

	a.W.Wait()
}
Exemplo n.º 7
0
func (t *ATestSuite) SetUpTest(c *C) {
	gs, err := godspeed.NewDefaultAsync()
	c.Assert(err, IsNil)
	t.g = gs

	t.g.SetNamespace("godspeed")
	t.g.AddTags([]string{"test0", "test1"})

	t.l, t.c, t.o = gspdtest.BuildListener(8125)
	go gspdtest.Listener(t.l, t.c, t.o)
}
Exemplo n.º 8
0
func ExampleNewDefaultAsync() {
	a, err := godspeed.NewDefaultAsync()

	if err != nil {
		// handle error
	}

	defer a.Godspeed.Conn.Close()

	a.W.Add(1)

	go a.Gauge("example.gauge", 1, nil, a.W)

	a.W.Wait()
}
Exemplo n.º 9
0
func (t *ATestSuite) TestAsyncAddTags(c *C) {
	var g *godspeed.AsyncGodspeed
	g, err := godspeed.NewDefaultAsync()
	c.Assert(err, IsNil)

	c.Assert(len(g.Godspeed.Tags), Equals, 0)

	g.AddTag("testing0")
	c.Assert(len(g.Godspeed.Tags), Equals, 1)
	c.Check(g.Godspeed.Tags[0], Equals, "testing0")

	g.AddTags([]string{"testing1", "testing2", "testing0"})
	c.Assert(len(g.Godspeed.Tags), Equals, 3)
	c.Check(g.Godspeed.Tags[0], Equals, "testing0")
	c.Check(g.Godspeed.Tags[1], Equals, "testing1")
	c.Check(g.Godspeed.Tags[2], Equals, "testing2")
}