1
0
Fork 0

Update tracing dependencies

This commit is contained in:
Ludovic Fernandez 2019-04-05 11:58:06 +02:00 committed by Traefiker Bot
parent 4919b638f9
commit ed12366d52
98 changed files with 3371 additions and 2808 deletions

View file

@ -14,14 +14,48 @@
package metrics
import (
"time"
)
// NSOptions defines the name and tags map associated with a factory namespace
type NSOptions struct {
Name string
Tags map[string]string
}
// Options defines the information associated with a metric
type Options struct {
Name string
Tags map[string]string
Help string
}
// TimerOptions defines the information associated with a metric
type TimerOptions struct {
Name string
Tags map[string]string
Help string
Buckets []time.Duration
}
// HistogramOptions defines the information associated with a metric
type HistogramOptions struct {
Name string
Tags map[string]string
Help string
Buckets []float64
}
// Factory creates new metrics
type Factory interface {
Counter(name string, tags map[string]string) Counter
Timer(name string, tags map[string]string) Timer
Gauge(name string, tags map[string]string) Gauge
Counter(metric Options) Counter
Timer(metric TimerOptions) Timer
Gauge(metric Options) Gauge
Histogram(metric HistogramOptions) Histogram
// Namespace returns a nested metrics factory.
Namespace(name string, tags map[string]string) Factory
Namespace(scope NSOptions) Factory
}
// NullFactory is a metrics factory that returns NullCounter, NullTimer, and NullGauge.
@ -29,7 +63,16 @@ var NullFactory Factory = nullFactory{}
type nullFactory struct{}
func (nullFactory) Counter(name string, tags map[string]string) Counter { return NullCounter }
func (nullFactory) Timer(name string, tags map[string]string) Timer { return NullTimer }
func (nullFactory) Gauge(name string, tags map[string]string) Gauge { return NullGauge }
func (nullFactory) Namespace(name string, tags map[string]string) Factory { return NullFactory }
func (nullFactory) Counter(options Options) Counter {
return NullCounter
}
func (nullFactory) Timer(options TimerOptions) Timer {
return NullTimer
}
func (nullFactory) Gauge(options Options) Gauge {
return NullGauge
}
func (nullFactory) Histogram(options HistogramOptions) Histogram {
return NullHistogram
}
func (nullFactory) Namespace(scope NSOptions) Factory { return NullFactory }