2024-01-21 18:12:39 +08:00
|
|
|
package metric
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math/rand"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestName(t *testing.T) {
|
|
|
|
c := NewConfg()
|
2024-01-21 18:49:51 +08:00
|
|
|
c.Address = "http://14.22.116.197:9305"
|
|
|
|
c.Interval = 1
|
2024-01-21 18:12:39 +08:00
|
|
|
Init(c)
|
|
|
|
for i := 0; i < 100; i++ {
|
2024-01-21 18:49:51 +08:00
|
|
|
Metric("test.test.b", float64(rand.Int()%100), map[string]string{
|
2024-01-21 18:12:39 +08:00
|
|
|
"a": "b",
|
|
|
|
"c": "d",
|
|
|
|
})
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMetric(t *testing.T) {
|
|
|
|
c := NewConfg()
|
|
|
|
c.Address = "https://monitor.batiao8.com"
|
|
|
|
Init(c)
|
|
|
|
|
|
|
|
Metric("test.test1.test2", 12, map[string]string{
|
|
|
|
"a": "b",
|
|
|
|
"c": "d",
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|