gosdk/metric/metric_test.go

37 lines
565 B
Go

package metric
import (
"math/rand"
"testing"
"time"
)
func TestName(t *testing.T) {
c := NewConfg()
c.Address = "http://influx.dev.batiao8.com"
c.Username = "batiao"
c.Password = "Batiao12B"
c.Interval = 1
Init(c)
for i := 0; i < 100; i++ {
Duration("test.test.a1", int64(rand.Int()%100), map[string]string{
"a": "b",
"c": "d",
})
time.Sleep(time.Second)
}
}
func TestMetric(t *testing.T) {
c := NewConfg()
c.Address = "https://monitor.batiao8.com"
Init(c)
Count("test.test.b", 12, map[string]string{
"a": "b",
"c": "d",
})
}