2020-08-18 10:30:29 +03:00
|
|
|
// Package metrics is for instrumentation and debugging
|
2020-08-18 10:27:50 +03:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
// Tags is a map of fields to add to a metric:
|
|
|
|
type Tags map[string]string
|
|
|
|
|
2020-08-28 11:52:51 +03:00
|
|
|
var (
|
|
|
|
Defaultreporter Reporter
|
|
|
|
)
|
|
|
|
|
2020-08-18 10:30:29 +03:00
|
|
|
// Reporter is an interface for collecting and instrumenting metrics
|
2020-08-18 10:27:50 +03:00
|
|
|
type Reporter interface {
|
2020-08-18 10:29:26 +03:00
|
|
|
Count(id string, value int64, tags Tags) error
|
|
|
|
Gauge(id string, value float64, tags Tags) error
|
|
|
|
Timing(id string, value time.Duration, tags Tags) error
|
2020-08-18 10:27:50 +03:00
|
|
|
}
|