package metrics
import "github.com/uber/jaeger-lib/metrics"
Index ¶
- func GetKey(name string, tags map[string]string, tagsSep string, tagKVSep string) string
- func Init(metrics interface{}, factory Factory, globalTags map[string]string)
- type Counter
- type Factory
- type Gauge
- type LocalBackend
- func NewLocalBackend(collectionInterval time.Duration) *LocalBackend
- func (b *LocalBackend) Clear()
- func (b *LocalBackend) IncCounter(name string, tags map[string]string, delta int64)
- func (b *LocalBackend) RecordTimer(name string, tags map[string]string, d time.Duration)
- func (b *LocalBackend) Snapshot() (counters, gauges map[string]int64)
- func (b *LocalBackend) Stop()
- func (b *LocalBackend) UpdateGauge(name string, tags map[string]string, value int64)
- type LocalFactory
- func NewLocalFactory(collectionInterval time.Duration) *LocalFactory
- func (l *LocalFactory) Counter(name string, tags map[string]string) Counter
- func (l *LocalFactory) Gauge(name string, tags map[string]string) Gauge
- func (l *LocalFactory) Namespace(name string, tags map[string]string) Factory
- func (l *LocalFactory) Timer(name string, tags map[string]string) Timer
- type Stopwatch
- func StartStopwatch(timer Timer) Stopwatch
- func (s Stopwatch) ElapsedTime() time.Duration
- func (s Stopwatch) Stop()
- type Timer
Functions ¶
func GetKey ¶
GetKey converts name+tags into a single string of the form "name|tag1=value1|...|tagN=valueN", where tag names are sorted alphabetically.
func Init ¶
Init initializes the passed in metrics and initializes its fields using the passed in factory.
Types ¶
type Counter ¶
type Counter interface { // Inc adds the given value to the counter. Inc(int64) }
Counter tracks the number of times an event has occurred
var NullCounter Counter = nullCounter{}
NullCounter counter that does nothing
type Factory ¶
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 // Namespace returns a nested metrics factory. Namespace(name string, tags map[string]string) Factory }
Factory creates new metrics
var NullFactory Factory = nullFactory{}
NullFactory is a metrics factory that returns NullCounter, NullTimer, and NullGauge.
type Gauge ¶
type Gauge interface { // Update the gauge to the value passed in. Update(int64) }
Gauge returns instantaneous measurements of something as an int64 value
var NullGauge Gauge = nullGauge{}
NullGauge gauge that does nothing
type LocalBackend ¶
type LocalBackend struct { TagsSep string TagKVSep string // contains filtered or unexported fields }
A LocalBackend is a metrics provider which aggregates data in-vm, and allows exporting snapshots to shove the data into a remote collector
func NewLocalBackend ¶
func NewLocalBackend(collectionInterval time.Duration) *LocalBackend
NewLocalBackend returns a new LocalBackend. The collectionInterval is the histogram time window for each timer.
func (*LocalBackend) Clear ¶
func (b *LocalBackend) Clear()
Clear discards accumulated stats
func (*LocalBackend) IncCounter ¶
func (b *LocalBackend) IncCounter(name string, tags map[string]string, delta int64)
IncCounter increments a counter value
func (*LocalBackend) RecordTimer ¶
RecordTimer records a timing duration
func (*LocalBackend) Snapshot ¶
func (b *LocalBackend) Snapshot() (counters, gauges map[string]int64)
Snapshot captures a snapshot of the current counter and gauge values
func (*LocalBackend) Stop ¶
func (b *LocalBackend) Stop()
Stop cleanly closes the background goroutine spawned by NewLocalBackend.
func (*LocalBackend) UpdateGauge ¶
func (b *LocalBackend) UpdateGauge(name string, tags map[string]string, value int64)
UpdateGauge updates the value of a gauge
type LocalFactory ¶
type LocalFactory struct { *LocalBackend // contains filtered or unexported fields }
LocalFactory stats factory that creates metrics that are stored locally
func NewLocalFactory ¶
func NewLocalFactory(collectionInterval time.Duration) *LocalFactory
NewLocalFactory returns a new LocalMetricsFactory
func (*LocalFactory) Counter ¶
func (l *LocalFactory) Counter(name string, tags map[string]string) Counter
Counter returns a local stats counter
func (*LocalFactory) Gauge ¶
func (l *LocalFactory) Gauge(name string, tags map[string]string) Gauge
Gauge returns a local stats gauge.
func (*LocalFactory) Namespace ¶
func (l *LocalFactory) Namespace(name string, tags map[string]string) Factory
Namespace returns a new namespace.
func (*LocalFactory) Timer ¶
func (l *LocalFactory) Timer(name string, tags map[string]string) Timer
Timer returns a local stats timer.
type Stopwatch ¶
type Stopwatch struct {
// contains filtered or unexported fields
}
A Stopwatch tracks the execution time of a specific event
func StartStopwatch ¶
StartStopwatch begins recording the executing time of an event, returning a Stopwatch that should be used to stop the recording the time for that event. Multiple events can be occurring simultaneously each represented by different active Stopwatches
func (Stopwatch) ElapsedTime ¶
ElapsedTime returns the amount of elapsed time (in time.Duration)
func (Stopwatch) Stop ¶
func (s Stopwatch) Stop()
Stop stops executing of the stopwatch and records the amount of elapsed time
type Timer ¶
Timer accumulates observations about how long some operation took, and also maintains a historgam of percentiles.
var NullTimer Timer = nullTimer{}
NullTimer timer that does nothing
Source Files ¶
counter.go factory.go gauge.go local.go metrics.go stopwatch.go timer.go
Directories ¶
Path | Synopsis |
---|---|
metrics/go-kit | |
metrics/go-kit/expvar | |
metrics/go-kit/prometheus | |
metrics/multi | |
metrics/tally | |
metrics/testutils |
- Version
- v1.1.0
- Published
- Sep 10, 2017
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 2 weeks ago –
Tools for package owners.