-
Notifications
You must be signed in to change notification settings - Fork 0
/
send.go
40 lines (35 loc) · 837 Bytes
/
send.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
package main
import (
"fmt"
"github.com/baishan-development-guizhou/golang-library/report"
"sync"
"time"
)
var wg sync.WaitGroup
func send() {
report.WithAfter(func(_ report.Point, success bool) {
fmt.Printf("Finished report, result is: %v. \n", success)
wg.Done()
})
// Send once.
report.Send(report.Point{Value: 100})
// Send Reporter
report.SendReporterPayLoad(func() report.Point {
return report.Point{Value: 100}
}, time.Hour*24)
report.SendReporter(report.Reporter{
Point: func() report.Point {
return report.Point{}
},
Interval: time.Second,
})
// Send Point.
report.SendPayLoad(report.Fields{"a": "1"}, report.Tags{"b": "1"}, 15)
report.SendPayLoadWithPoint(report.Point{Value: 100})
report.SendReporter(*report.ApplicationReporter(time.Hour))
}
func main() {
wg.Add(5)
send()
wg.Wait()
}