-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclient.go
59 lines (43 loc) · 1019 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"log"
"github.com/Lamzin/go-ubm/client"
)
func main_example_client() {
example_MetricPush()
example_MetricGet()
example_LogPush()
}
func example_LogPush() {
client := bclient.NewClient("0.0.0.0:3001")
lonlat := struct {
Lon string `json:"lon"`
Lat string `json:"lat"`
TimeStamp int `json:"timestamp"`
}{"45.0321", "39.1654", 54645489}
err := client.LogPush("good_user", "signin.geo", lonlat)
if err != nil {
log.Print(err.Error())
} else {
log.Print("Done!")
}
}
func example_MetricPush() {
client := bclient.NewClient("0.0.0.0:3001")
err := client.MetricPush("good_user", "chat.text", 15)
if err != nil {
log.Print(err.Error())
} else {
log.Print("Done!")
}
}
func example_MetricGet() {
client := bclient.NewClient("0.0.0.0:3001")
metrics, err := client.MetricGet("good_user", []string{"chat.text", "chat.doc", "geo.kiev"})
if err != nil {
log.Print(err.Error())
} else {
log.Print("Done!")
log.Printf("%v\n", metrics)
}
}