Documentation ¶
Index ¶
- Constants
- Variables
- func AddSuccessCode(cm map[int]int)
- func ByteSlice2String(bs []byte) string
- func CounterDec(name string, tags ...interface{})
- func CounterInc(name string, tags ...interface{})
- func Falcon(r metrics.Registry, d time.Duration)
- func FalconWithTags(r metrics.Registry, d time.Duration, tags map[string]string)
- func Gauge(name string, value int, tags ...interface{})
- func GetOrRegisterTimer(name string, r metrics.Registry) metrics.Timer
- func Meter(name string, value int, tags ...interface{})
- func NewExpDecaySample(reservoirSize int, alpha float64, rescaleThreshold time.Duration) metrics.Sample
- func NewTimer() metrics.Timer
- func ReloadSuccessCode(cm map[int]int)
- func SampleMax(values []int64) int64
- func SampleMean(values []int64) float64
- func SampleMin(values []int64) int64
- func SamplePercentile(values int64Slice, p float64) float64
- func SamplePercentiles(values int64Slice, ps []float64) []float64
- func SampleStdDev(values []int64) float64
- func SampleSum(values []int64) int64
- func SampleVariance(values []int64) float64
- func SetDefaultRergistryTags(tags map[string]string)
- func SetStatOutput(name string)
- func Timer(name string, since time.Time, tags ...interface{})
- func TimerDuration(name string, duration time.Duration, tags ...interface{})
- type ExpDecaySample
- func (s *ExpDecaySample) Clear()
- func (s *ExpDecaySample) Count() int64
- func (s *ExpDecaySample) Max() int64
- func (s *ExpDecaySample) Mean() float64
- func (s *ExpDecaySample) Min() int64
- func (s *ExpDecaySample) Percentile(p float64) float64
- func (s *ExpDecaySample) Percentiles(ps []float64) []float64
- func (s *ExpDecaySample) Size() int
- func (s *ExpDecaySample) Snapshot() metrics.Sample
- func (s *ExpDecaySample) StdDev() float64
- func (s *ExpDecaySample) Sum() int64
- func (s *ExpDecaySample) Update(v int64)
- func (s *ExpDecaySample) Values() []int64
- func (s *ExpDecaySample) Variance() float64
- type FieldMetadata
- type StandardTimer
- func (t *StandardTimer) Count() int64
- func (t *StandardTimer) Max() int64
- func (t *StandardTimer) Mean() float64
- func (t *StandardTimer) Min() int64
- func (t *StandardTimer) Percentile(p float64) float64
- func (t *StandardTimer) Percentiles(ps []float64) []float64
- func (t *StandardTimer) Rate1() float64
- func (t *StandardTimer) Rate15() float64
- func (t *StandardTimer) Rate5() float64
- func (t *StandardTimer) RateMean() float64
- func (t *StandardTimer) Snapshot() metrics.Timer
- func (t *StandardTimer) StdDev() float64
- func (t *StandardTimer) Stop()
- func (t *StandardTimer) Sum() int64
- func (t *StandardTimer) Time(f func())
- func (t *StandardTimer) Update(d time.Duration)
- func (t *StandardTimer) UpdateSince(ts time.Time)
- func (t *StandardTimer) Variance() float64
- type TimerSnapshot
- func (t *TimerSnapshot) Count() int64
- func (t *TimerSnapshot) Max() int64
- func (t *TimerSnapshot) Mean() float64
- func (t *TimerSnapshot) Min() int64
- func (t *TimerSnapshot) Percentile(p float64) float64
- func (t *TimerSnapshot) Percentiles(ps []float64) []float64
- func (t *TimerSnapshot) Rate1() float64
- func (t *TimerSnapshot) Rate15() float64
- func (t *TimerSnapshot) Rate5() float64
- func (t *TimerSnapshot) RateMean() float64
- func (t *TimerSnapshot) Snapshot() metrics.Timer
- func (t *TimerSnapshot) StdDev() float64
- func (t *TimerSnapshot) Stop()
- func (t *TimerSnapshot) Sum() int64
- func (*TimerSnapshot) Time(func())
- func (*TimerSnapshot) Update(time.Duration)
- func (*TimerSnapshot) UpdateSince(time.Time)
- func (t *TimerSnapshot) Variance() float64
Constants ¶
const ( TagCode = "code" TagComment = "comment" )
Variables ¶
var (
DefBuckets []int
)
Functions ¶
func AddSuccessCode ¶
func ByteSlice2String ¶
ByteSlice2String bytes to string, copy from string.Builder
func CounterDec ¶
func CounterDec(name string, tags ...interface{})
func CounterInc ¶
func CounterInc(name string, tags ...interface{})
func Falcon ¶
Falcon starts a Falcon reporter which will post the metrics from the given registry at each d interval.
func FalconWithTags ¶
FalconWithTags starts a Falcon reporter which will post the metrics from the given registry at each d interval with the specified tags
func NewExpDecaySample ¶
func NewExpDecaySample(reservoirSize int, alpha float64, rescaleThreshold time.Duration) metrics.Sample
NewExpDecaySample constructs a new exponentially-decaying sample with the given reservoir size and alpha.
func ReloadSuccessCode ¶
func SampleMean ¶
SampleMean returns the mean value of the slice of int64.
func SamplePercentile ¶
SamplePercentiles returns an arbitrary percentile of the slice of int64.
func SamplePercentiles ¶
SamplePercentiles returns a slice of arbitrary percentiles of the slice of int64.
func SampleStdDev ¶
SampleStdDev returns the standard deviation of the slice of int64.
func SampleVariance ¶
SampleVariance returns the variance of the slice of int64.
func SetDefaultRergistryTags ¶
func SetStatOutput ¶
func SetStatOutput(name string)
func TimerDuration ¶
Types ¶
type ExpDecaySample ¶
type ExpDecaySample struct {
// contains filtered or unexported fields
}
ExpDecaySample is an exponentially-decaying sample using a forward-decaying priority reservoir. See Cormode et al's "Forward Decay: A Practical Time Decay Model for Streaming Systems".
<http://dimacs.rutgers.edu/~graham/pubs/papers/fwddecay.pdf>
func (*ExpDecaySample) Count ¶
func (s *ExpDecaySample) Count() int64
Count returns the number of samples recorded, which may exceed the reservoir size.
func (*ExpDecaySample) Max ¶
func (s *ExpDecaySample) 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 (*ExpDecaySample) Mean ¶
func (s *ExpDecaySample) Mean() float64
Mean returns the mean of the values in the sample.
func (*ExpDecaySample) Min ¶
func (s *ExpDecaySample) 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 (*ExpDecaySample) Percentile ¶
func (s *ExpDecaySample) Percentile(p float64) float64
Percentile returns an arbitrary percentile of values in the sample.
func (*ExpDecaySample) Percentiles ¶
func (s *ExpDecaySample) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of values in the sample.
func (*ExpDecaySample) Size ¶
func (s *ExpDecaySample) Size() int
Size returns the size of the sample, which is at most the reservoir size.
func (*ExpDecaySample) Snapshot ¶
func (s *ExpDecaySample) Snapshot() metrics.Sample
Snapshot returns a read-only copy of the sample.
func (*ExpDecaySample) StdDev ¶
func (s *ExpDecaySample) StdDev() float64
StdDev returns the standard deviation of the values in the sample.
func (*ExpDecaySample) Sum ¶
func (s *ExpDecaySample) Sum() int64
Sum returns the sum of the values in the sample.
func (*ExpDecaySample) Update ¶
func (s *ExpDecaySample) Update(v int64)
Update samples a new value.
func (*ExpDecaySample) Values ¶
func (s *ExpDecaySample) Values() []int64
Values returns a copy of the values in the sample.
func (*ExpDecaySample) Variance ¶
func (s *ExpDecaySample) Variance() float64
Variance returns the variance of the values in the sample.
type FieldMetadata ¶
type FieldMetadata struct { Name string `json:"n"` Tags map[string]string `json:"t"` Comment map[int]string }
func (*FieldMetadata) String ¶
func (f *FieldMetadata) String() string
type StandardTimer ¶
type StandardTimer struct {
// contains filtered or unexported fields
}
StandardTimer is the standard implementation of a Timer and uses a Histogram and Meter.
func (*StandardTimer) Count ¶
func (t *StandardTimer) Count() int64
Count returns the number of events recorded.
func (*StandardTimer) Max ¶
func (t *StandardTimer) Max() int64
Max returns the maximum value in the sample.
func (*StandardTimer) Mean ¶
func (t *StandardTimer) Mean() float64
Mean returns the mean of the values in the sample.
func (*StandardTimer) Min ¶
func (t *StandardTimer) Min() int64
Min returns the minimum value in the sample.
func (*StandardTimer) Percentile ¶
func (t *StandardTimer) Percentile(p float64) float64
Percentile returns an arbitrary percentile of the values in the sample.
func (*StandardTimer) Percentiles ¶
func (t *StandardTimer) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of the values in the sample.
func (*StandardTimer) Rate1 ¶
func (t *StandardTimer) Rate1() float64
Rate1 returns the one-minute moving average rate of events per second.
func (*StandardTimer) Rate15 ¶
func (t *StandardTimer) Rate15() float64
Rate15 returns the fifteen-minute moving average rate of events per second.
func (*StandardTimer) Rate5 ¶
func (t *StandardTimer) Rate5() float64
Rate5 returns the five-minute moving average rate of events per second.
func (*StandardTimer) RateMean ¶
func (t *StandardTimer) RateMean() float64
RateMean returns the meter's mean rate of events per second.
func (*StandardTimer) Snapshot ¶
func (t *StandardTimer) Snapshot() metrics.Timer
Snapshot returns a read-only copy of the timer.
func (*StandardTimer) StdDev ¶
func (t *StandardTimer) StdDev() float64
StdDev returns the standard deviation of the values in the sample.
func (*StandardTimer) Time ¶
func (t *StandardTimer) Time(f func())
Record the duration of the execution of the given function.
func (*StandardTimer) Update ¶
func (t *StandardTimer) Update(d time.Duration)
Record the duration of an event.
func (*StandardTimer) UpdateSince ¶
func (t *StandardTimer) UpdateSince(ts time.Time)
Record the duration of an event that started at a time and ends now.
func (*StandardTimer) Variance ¶
func (t *StandardTimer) Variance() float64
Variance returns the variance of the values in the sample.
type TimerSnapshot ¶
type TimerSnapshot struct {
// contains filtered or unexported fields
}
TimerSnapshot is a read-only copy of another Timer.
func (*TimerSnapshot) Count ¶
func (t *TimerSnapshot) Count() int64
Count returns the number of events recorded at the time the snapshot was taken.
func (*TimerSnapshot) Max ¶
func (t *TimerSnapshot) Max() int64
Max returns the maximum value at the time the snapshot was taken.
func (*TimerSnapshot) Mean ¶
func (t *TimerSnapshot) Mean() float64
Mean returns the mean value at the time the snapshot was taken.
func (*TimerSnapshot) Min ¶
func (t *TimerSnapshot) Min() int64
Min returns the minimum value at the time the snapshot was taken.
func (*TimerSnapshot) Percentile ¶
func (t *TimerSnapshot) Percentile(p float64) float64
Percentile returns an arbitrary percentile of sampled values at the time the snapshot was taken.
func (*TimerSnapshot) Percentiles ¶
func (t *TimerSnapshot) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of sampled values at the time the snapshot was taken.
func (*TimerSnapshot) Rate1 ¶
func (t *TimerSnapshot) Rate1() float64
Rate1 returns the one-minute moving average rate of events per second at the time the snapshot was taken.
func (*TimerSnapshot) Rate15 ¶
func (t *TimerSnapshot) Rate15() float64
Rate15 returns the fifteen-minute moving average rate of events per second at the time the snapshot was taken.
func (*TimerSnapshot) Rate5 ¶
func (t *TimerSnapshot) Rate5() float64
Rate5 returns the five-minute moving average rate of events per second at the time the snapshot was taken.
func (*TimerSnapshot) RateMean ¶
func (t *TimerSnapshot) RateMean() float64
RateMean returns the meter's mean rate of events per second at the time the snapshot was taken.
func (*TimerSnapshot) Snapshot ¶
func (t *TimerSnapshot) Snapshot() metrics.Timer
Snapshot returns the snapshot.
func (*TimerSnapshot) StdDev ¶
func (t *TimerSnapshot) StdDev() float64
StdDev returns the standard deviation of the values at the time the snapshot was taken.
func (*TimerSnapshot) Sum ¶
func (t *TimerSnapshot) Sum() int64
Sum returns the sum at the time the snapshot was taken.
func (*TimerSnapshot) Update ¶
func (*TimerSnapshot) Update(time.Duration)
Update panics. nolint:iklint
func (*TimerSnapshot) UpdateSince ¶
func (*TimerSnapshot) UpdateSince(time.Time)
UpdateSince panics. nolint:iklint
func (*TimerSnapshot) Variance ¶
func (t *TimerSnapshot) Variance() float64
Variance returns the variance of the values at the time the snapshot was taken.