Пример #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")
}
Пример #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)
}
Пример #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()
}
Пример #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()
}
Пример #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()
}
Пример #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()
}
Пример #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)
}
Пример #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()
}
Пример #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")
}