Documentation ¶
Index ¶
- func Decrement(path string, value int64)
- func DecrementBy1(path string)
- func DecrementBy1WithTags(path string, tags map[string]string)
- func DecrementWithTags(path string, value int64, tags map[string]string)
- func Increment(path string, value int64)
- func IncrementBy1(path string)
- func IncrementBy1WithTags(path string, tags map[string]string)
- func IncrementWithTags(path string, value int64, tags map[string]string)
- func InfluxDB(r metrics.Registry, config ReporterConfig, logger *zap.Logger)
- func MarkMeter(path string, value int64)
- func MarkMeterWithTags(path string, value int64, tags map[string]string)
- func NewSlidingWindowSample(window time.Duration) metrics.Sample
- func StartSlidingWindowTrimmer()
- func Time(path string, f func())
- func TimeWithTags(path string, tags map[string]string, f func())
- func UpdateGauge(path string, value int64)
- func UpdateGaugeFloat64(path string, value float64)
- func UpdateGaugeFloat64WithTags(path string, value float64, tags map[string]string)
- func UpdateGaugeWithTags(path string, value int64, tags map[string]string)
- func UpdateHistogram(path string, value int64)
- func UpdateHistogramWithTags(path string, value int64, tags map[string]string)
- func UpdateTimer(path string, duration time.Duration)
- func UpdateTimerSince(path string, start time.Time)
- func UpdateTimerSinceWithTags(path string, start time.Time, tags map[string]string)
- func UpdateTimerWithTags(path string, duration time.Duration, tags map[string]string)
- type Config
- type ReporterConfig
- type SlidingWindowSample
- func (s *SlidingWindowSample) Clear()
- func (s *SlidingWindowSample) Count() int64
- func (s *SlidingWindowSample) Max() int64
- func (s *SlidingWindowSample) Mean() float64
- func (s *SlidingWindowSample) Min() int64
- func (s *SlidingWindowSample) Percentile(p float64) float64
- func (s *SlidingWindowSample) Percentiles(ps []float64) []float64
- func (s *SlidingWindowSample) Size() int
- func (s *SlidingWindowSample) Snapshot() metrics.Sample
- func (s *SlidingWindowSample) StdDev() float64
- func (s *SlidingWindowSample) Sum() int64
- func (s *SlidingWindowSample) Update(v int64)
- func (s *SlidingWindowSample) Values() []int64
- func (s *SlidingWindowSample) Variance() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrement ¶
Decrement the specified counter by the value Counters hold an int64 value that can be incremented and decremented
func DecrementBy1 ¶
func DecrementBy1(path string)
DecrementBy1 the specified counter Counters hold an int64 value that can be incremented and decremented
func DecrementBy1WithTags ¶
DecrementBy1WithTags the specified counter with the given tags Counters hold an int64 value that can be incremented and decremented
func DecrementWithTags ¶
DecrementWithTags the specified counter by the value with the given tags Counters hold an int64 value that can be incremented and decremented
func Increment ¶
Increment the specified counter by the value Counters hold an int64 value that can be incremented and decremented
func IncrementBy1 ¶
func IncrementBy1(path string)
IncrementBy1 the specified counter Counters hold an int64 value that can be incremented and decremented
func IncrementBy1WithTags ¶
IncrementBy1WithTags the specified counter with the given tags Counters hold an int64 value that can be incremented and decremented
func IncrementWithTags ¶
IncrementWithTags the specified counter by the value with the given tags Counters hold an int64 value that can be incremented and decremented
func InfluxDB ¶
func InfluxDB(r metrics.Registry, config ReporterConfig, logger *zap.Logger)
InfluxDB starts a InfluxDB reporter which will post the metrics from the given registry at each d interval with the specified tags
func MarkMeter ¶
MarkMeter records the value against the specified meter Meters count events to produce exponentially-weighted moving average rates at one-, five-, and fifteen-minutes and a mean rate
func MarkMeterWithTags ¶
MarkMeterWithTags records the value against the specified meter with the given tags Meters count events to produce exponentially-weighted moving average rates at one-, five-, and fifteen-minutes and a mean rate
func NewSlidingWindowSample ¶
NewSlidingWindowSample constructs a new sliding window sample with the given window
func StartSlidingWindowTrimmer ¶
func StartSlidingWindowTrimmer()
StartSlidingWindowTrimmer starts the regular trimming of sliding window samples
func Time ¶
func Time(path string, f func())
Time record the duration of execution of the given function Timers capture the duration and rate of events
func TimeWithTags ¶
TimeWithTags record the duration of execution of the given function with the given tags Timers capture the duration and rate of events
func UpdateGauge ¶
UpdateGauge records the value on the specified gauge Gauges hold an int64 value that can be set arbitrarily
func UpdateGaugeFloat64 ¶
UpdateGaugeFloat64 records the value on the specified gauge Gauges hold an float64 value that can be set arbitrarily
func UpdateGaugeFloat64WithTags ¶
UpdateGaugeFloat64WithTags records the value on the specified gauge with the given tags Gauges hold an float64 value that can be set arbitrarily
func UpdateGaugeWithTags ¶
UpdateGaugeWithTags records the value on the specified gauge with the given tags Gauges hold an int64 value that can be set arbitrarily
func UpdateHistogram ¶
UpdateHistogram records the value against the specified histogram Histograms calculate distribution statistics from a series of int64 values
func UpdateHistogramWithTags ¶
UpdateHistogramWithTags records the value against the specified histogram with the given tags Histograms calculate distribution statistics from a series of int64 values
func UpdateTimer ¶
UpdateTimer records the duration against the specified timer Timers capture the duration and rate of events
func UpdateTimerSince ¶
UpdateTimerSince records the elapsed time since <start> against the specified timer Timers capture the duration and rate of events
func UpdateTimerSinceWithTags ¶
UpdateTimerSinceWithTags records the elapsed time since <start> against the specified timer with the given tags Timers capture the duration and rate of events
Types ¶
type Config ¶
type Config struct { Type string `yaml:"type" json:"type"` ReporterConfig ReporterConfig `yaml:"config" json:"config"` }
Config represent the configuration of the metrics package
type ReporterConfig ¶
type ReporterConfig struct { URL string `yaml:"url" json:"url"` Username string `yaml:"username" json:"username"` Password string `yaml:"password" json:"password"` Database string `yaml:"database" json:"database"` Prefix string `yaml:"prefix" json:"prefix"` Interval int `yaml:"interval" json:"interval"` // in seconds Tags map[string]string `yaml:"tags" json:"tags"` }
ReporterConfig represents the configuration of the reporter
type SlidingWindowSample ¶
type SlidingWindowSample struct {
// contains filtered or unexported fields
}
SlidingWindowSample is an implementation of the sliding window algorithm
func (*SlidingWindowSample) Count ¶
func (s *SlidingWindowSample) Count() int64
Count returns the number of samples recorded.
func (*SlidingWindowSample) Max ¶
func (s *SlidingWindowSample) Max() int64
Max returns the maximum value in the sample, which may not be the maximum value ever to be part of the sample.
func (*SlidingWindowSample) Mean ¶
func (s *SlidingWindowSample) Mean() float64
Mean returns the mean of the values in the sample.
func (*SlidingWindowSample) Min ¶
func (s *SlidingWindowSample) Min() int64
Min returns the minimum value in the sample, which may not be the minimum value ever to be part of the sample.
func (*SlidingWindowSample) Percentile ¶
func (s *SlidingWindowSample) Percentile(p float64) float64
Percentile returns an arbitrary percentile of values in the sample.
func (*SlidingWindowSample) Percentiles ¶
func (s *SlidingWindowSample) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of values in the sample.
func (*SlidingWindowSample) Size ¶
func (s *SlidingWindowSample) Size() int
Size returns the size of the sample.
func (*SlidingWindowSample) Snapshot ¶
func (s *SlidingWindowSample) Snapshot() metrics.Sample
Snapshot returns a read-only copy of the sample.
func (*SlidingWindowSample) StdDev ¶
func (s *SlidingWindowSample) StdDev() float64
StdDev returns the standard deviation of the values in the sample.
func (*SlidingWindowSample) Sum ¶
func (s *SlidingWindowSample) Sum() int64
Sum returns the sum of the values in the sample.
func (*SlidingWindowSample) Update ¶
func (s *SlidingWindowSample) Update(v int64)
Update samples a new value.
func (*SlidingWindowSample) Values ¶
func (s *SlidingWindowSample) Values() []int64
Values returns a copy of the values in the sample.
func (*SlidingWindowSample) Variance ¶
func (s *SlidingWindowSample) Variance() float64
Variance returns the variance of the values in the sample.