gosdk/metric/metric.go

35 lines
538 B
Go

package metric
import (
"time"
)
func Count(name string, value int64, tag map[string]string) {
if serv == nil {
return
}
serv.add(&metric{
Type: TypeCount,
Metric: name,
Value: value,
Count: 1,
Tags: tag,
Timestamp: time.Now().Unix(),
})
}
func Duration(name string, costMs int64, tag map[string]string) {
if serv == nil {
return
}
serv.add(&metric{
Type: TypeDuration,
Metric: name,
Value: costMs,
Count: 1,
Tags: tag,
Timestamp: time.Now().Unix(),
})
}