forked from tanitall/memo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
memo.go
40 lines (37 loc) · 856 Bytes
/
memo.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 metric
import (
"fmt"
"github.com/jchavannes/jgo/jerr"
"github.com/memocash/memo/app/bitcoin/memo"
)
func AddMemoBroadcast(outputType memo.OutputType) error {
c, err := getStatsd()
if err != nil {
return jerr.Get("error getting statsd", err)
}
if c == nil {
return nil
}
tags := []string{
fmt.Sprintf("%s:%s", TagOutputType, outputType.String()),
}
err = c.Incr(NameMemoBroadcast, tags, 1)
if err != nil {
return jerr.Get("error incrementing memo broadcast", err)
}
return nil
}
func AddMemoSave(code byte) error {
c, err := getStatsd()
if err != nil {
return jerr.Get("error getting statsd", err)
}
tags := []string{
fmt.Sprintf("%s:%s", TagOutputType, memo.GetCodeString(code)),
}
err = c.Incr(NameMemoSave, tags, 1)
if err != nil {
return jerr.Get("error incrementing memo broadcast", err)
}
return nil
}