-
Notifications
You must be signed in to change notification settings - Fork 3
/
report.go
executable file
·45 lines (40 loc) · 1.28 KB
/
report.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
package secret
import (
"crypto/sha1"
"encoding/hex"
"io"
uuid "github.com/nu7hatch/gouuid"
)
type ReportAttribute struct {
Type ReportType `json:"type"`
Host string `json:"host,omitempty"`
Level ReportLevel `json:"level,omitempty"`
Service string `json:"service,omitempty"`
SdkVer uint `json:"sdk_ver"`
Env string `json:"env,omitempty"`
Ts int64 `json:"ts"`
Code string `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
Heap string `json:"heap,omitempty"`
Enccnt uint `json:"enccnt,omitempty"`
Deccnt uint `json:"deccnt,omitempty"`
}
type ReportStatistcAttribute struct {
Type ReportType `json:"type"`
Host string `json:"host,omitempty"`
Level ReportLevel `json:"level,omitempty"`
Service string `json:"service,omitempty"`
SdkVer uint `json:"sdk_ver"`
Env string `json:"env,omitempty"`
Ts int64 `json:"ts"`
Enccnt uint `json:"enccnt"`
Deccnt uint `json:"deccnt"`
Encerrcnt uint `json:"encerrcnt"`
Decerrcnt uint `json:"decerrcnt"`
}
func NewBusinessId() string {
token, _ := uuid.NewV4()
h := sha1.New()
io.WriteString(h, token.String())
return hex.EncodeToString(h.Sum(nil))
}