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(m interface{}, factory Factory, globalTags map[string]string) error
- func MustInit(metrics interface{}, factory Factory, globalTags map[string]string)
- type Counter
- type Factory
- type Gauge
- type Histogram
- type HistogramOptions
- type NSOptions
- type Options
- type Stopwatch
- func StartStopwatch(timer Timer) Stopwatch
- func (s Stopwatch) ElapsedTime() time.Duration
- func (s Stopwatch) Stop()
- type Timer
- type TimerOptions
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 does the same as MustInit, but returns an error instead of panicking.
func MustInit ¶
MustInit initializes the passed in metrics and initializes its fields using the passed in factory.
It uses reflection to initialize a struct containing metrics fields by assigning new Counter/Gauge/Timer values with the metric name retrieved from the `metric` tag and stats tags retrieved from the `tags` tag.
Note: all fields of the struct must be exported, have a `metric` tag, and be of type Counter or Gauge or Timer.
Errors during Init lead to a panic.
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(metric Options) Counter Timer(metric TimerOptions) Timer Gauge(metric Options) Gauge Histogram(metric HistogramOptions) Histogram // Namespace returns a nested metrics factory. Namespace(scope NSOptions) 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 Histogram ¶
type Histogram interface { // Records the value passed in. Record(float64) }
Histogram that keeps track of a distribution of values.
var NullHistogram Histogram = nullHistogram{}
NullHistogram that does nothing
type HistogramOptions ¶
HistogramOptions defines the information associated with a metric
type NSOptions ¶
NSOptions defines the name and tags map associated with a factory namespace
type Options ¶
Options defines the information associated with a metric
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
type TimerOptions ¶
TimerOptions defines the information associated with a metric
Source Files ¶
counter.go factory.go gauge.go histogram.go keys.go metrics.go stopwatch.go timer.go
Directories ¶
Path | Synopsis |
---|---|
metrics/adapters | |
metrics/expvar | |
metrics/fork | |
metrics/go-kit | |
metrics/go-kit/expvar | |
metrics/go-kit/influx | |
metrics/metricstest | |
metrics/multi | |
metrics/prometheus | |
metrics/tally |
- Version
- v2.4.1+incompatible (latest)
- Published
- Mar 29, 2021
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 4 days ago –
Tools for package owners.