merics: add Init func to interface

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-11-15 00:53:40 +03:00
parent f6c914c1e4
commit e0ef8b2953
2 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,14 @@ func NewReporter(opts ...Option) Reporter {
}
}
// Init initialize options
func (r *noopReporter) Init(opts ...Option) error {
for _, o := range opts {
o(&r.opts)
}
return nil
}
// Count implements the Reporter interface Count method:
func (r *noopReporter) Count(metricName string, value int64, tags Tags) error {
return nil

View File

@ -12,6 +12,7 @@ var (
// Reporter is an interface for collecting and instrumenting metrics
type Reporter interface {
Init(...Option) error
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