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
|
|
|
|
|
2020-11-18 16:50:41 +03:00
|
|
|
import (
|
|
|
|
"time"
|
2020-08-18 10:27:50 +03:00
|
|
|
|
2020-11-18 16:50:41 +03:00
|
|
|
"github.com/unistack-org/micro/v3/metadata"
|
|
|
|
)
|
2020-08-18 10:27:50 +03:00
|
|
|
|
2020-08-28 11:52:51 +03:00
|
|
|
var (
|
2020-11-15 00:38:38 +03:00
|
|
|
DefaultReporter Reporter = NewReporter()
|
2020-08-28 11:52:51 +03:00
|
|
|
)
|
|
|
|
|
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-11-15 00:53:40 +03:00
|
|
|
Init(...Option) error
|
2020-11-18 16:50:41 +03:00
|
|
|
Count(id string, value int64, md metadata.Metadata) error
|
|
|
|
Gauge(id string, value float64, md metadata.Metadata) error
|
|
|
|
Timing(id string, value time.Duration, md metadata.Metadata) error
|
2020-11-15 00:38:38 +03:00
|
|
|
Options() Options
|
2020-08-18 10:27:50 +03:00
|
|
|
}
|