Documentation ¶
Index ¶
- Variables
- func Init()
- 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
- type Counter
- type EWMA
- type EWMASnapshot
- 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() 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 Gauge
- type GaugeSnapshot
- type GraphitePublisher
- type Histogram
- type HistogramSnapshot
- func (*HistogramSnapshot) Clear()
- func (h *HistogramSnapshot) Count() int64
- func (h *HistogramSnapshot) Max() int64
- func (h *HistogramSnapshot) Mean() float64
- func (h *HistogramSnapshot) Min() int64
- func (h *HistogramSnapshot) Percentile(p float64) float64
- func (h *HistogramSnapshot) Percentiles(ps []float64) []float64
- func (h *HistogramSnapshot) Sample() Sample
- func (h *HistogramSnapshot) Snapshot() Metric
- func (h *HistogramSnapshot) StdDev() float64
- func (h *HistogramSnapshot) Sum() int64
- func (*HistogramSnapshot) Update(int64)
- func (h *HistogramSnapshot) Variance() float64
- type Meter
- type MeterSnapshot
- type Metric
- type MetricMeta
- type MetricPublisher
- type MetricSettings
- type NilEWMA
- type NilGauge
- type NilHistogram
- func (NilHistogram) Clear()
- func (NilHistogram) Count() int64
- func (NilHistogram) Max() int64
- func (NilHistogram) Mean() float64
- func (NilHistogram) Min() int64
- func (NilHistogram) Percentile(p float64) float64
- func (NilHistogram) Percentiles(ps []float64) []float64
- func (NilHistogram) Sample() Sample
- func (n NilHistogram) Snapshot() Metric
- func (NilHistogram) StdDev() float64
- func (NilHistogram) Sum() int64
- func (NilHistogram) Update(v int64)
- func (NilHistogram) Variance() float64
- type NilMeter
- type NilSample
- func (NilSample) Clear()
- func (NilSample) Count() int64
- func (NilSample) Max() int64
- func (NilSample) Mean() float64
- func (NilSample) Min() int64
- func (NilSample) Percentile(p float64) float64
- func (NilSample) Percentiles(ps []float64) []float64
- func (NilSample) Size() int
- func (NilSample) Snapshot() Sample
- func (NilSample) StdDev() float64
- func (NilSample) Sum() int64
- func (NilSample) Update(v int64)
- func (NilSample) Values() []int64
- func (NilSample) Variance() float64
- type NilTimer
- func (NilTimer) Count() int64
- func (NilTimer) Max() int64
- func (NilTimer) Mean() float64
- func (NilTimer) Min() int64
- func (NilTimer) Percentile(p float64) float64
- func (NilTimer) Percentiles(ps []float64) []float64
- func (NilTimer) Rate1() float64
- func (NilTimer) Rate15() float64
- func (NilTimer) Rate5() float64
- func (NilTimer) RateMean() float64
- func (n NilTimer) Snapshot() Metric
- func (NilTimer) StdDev() float64
- func (NilTimer) Sum() int64
- func (NilTimer) Time(func())
- func (NilTimer) Update(time.Duration)
- func (NilTimer) UpdateSince(time.Time)
- func (NilTimer) Variance() float64
- type Registry
- type Sample
- type SampleSnapshot
- func (*SampleSnapshot) Clear()
- func (s *SampleSnapshot) Count() int64
- func (s *SampleSnapshot) Max() int64
- func (s *SampleSnapshot) Mean() float64
- func (s *SampleSnapshot) Min() int64
- func (s *SampleSnapshot) Percentile(p float64) float64
- func (s *SampleSnapshot) Percentiles(ps []float64) []float64
- func (s *SampleSnapshot) Size() int
- func (s *SampleSnapshot) Snapshot() Sample
- func (s *SampleSnapshot) StdDev() float64
- func (s *SampleSnapshot) Sum() int64
- func (*SampleSnapshot) Update(int64)
- func (s *SampleSnapshot) Values() []int64
- func (s *SampleSnapshot) Variance() float64
- type StandardCounter
- type StandardEWMA
- type StandardGauge
- type StandardHistogram
- func (h *StandardHistogram) Clear()
- func (h *StandardHistogram) Count() int64
- func (h *StandardHistogram) Max() int64
- func (h *StandardHistogram) Mean() float64
- func (h *StandardHistogram) Min() int64
- func (h *StandardHistogram) Percentile(p float64) float64
- func (h *StandardHistogram) Percentiles(ps []float64) []float64
- func (h *StandardHistogram) Sample() Sample
- func (h *StandardHistogram) Snapshot() Metric
- func (h *StandardHistogram) StdDev() float64
- func (h *StandardHistogram) Sum() int64
- func (h *StandardHistogram) Update(v int64)
- func (h *StandardHistogram) Variance() float64
- type StandardMeter
- type StandardRegistry
- 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() Metric
- func (t *StandardTimer) StdDev() float64
- 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 Timer
- 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() Metric
- func (t *TimerSnapshot) StdDev() float64
- func (t *TimerSnapshot) Sum() int64
- func (*TimerSnapshot) Time(func())
- func (*TimerSnapshot) Update(time.Duration)
- func (*TimerSnapshot) UpdateSince(time.Time)
- func (t *TimerSnapshot) Variance() float64
- type UniformSample
- func (s *UniformSample) Clear()
- func (s *UniformSample) Count() int64
- func (s *UniformSample) Max() int64
- func (s *UniformSample) Mean() float64
- func (s *UniformSample) Min() int64
- func (s *UniformSample) Percentile(p float64) float64
- func (s *UniformSample) Percentiles(ps []float64) []float64
- func (s *UniformSample) Size() int
- func (s *UniformSample) Snapshot() Sample
- func (s *UniformSample) StdDev() float64
- func (s *UniformSample) Sum() int64
- func (s *UniformSample) Update(v int64)
- func (s *UniformSample) Values() []int64
- func (s *UniformSample) Variance() float64
Constants ¶
This section is empty.
Variables ¶
var ( M_Instance_Start Counter M_Page_Status_200 Counter M_Page_Status_500 Counter M_Page_Status_404 Counter M_Page_Status_Unknown Counter M_Api_Status_200 Counter M_Api_Status_404 Counter M_Api_Status_500 Counter M_Api_Status_Unknown Counter M_Proxy_Status_200 Counter M_Proxy_Status_404 Counter M_Proxy_Status_500 Counter M_Proxy_Status_Unknown Counter M_Api_User_SignUpStarted Counter M_Api_User_SignUpCompleted Counter M_Api_User_SignUpInvite Counter M_Api_Dashboard_Save Timer M_Api_Dashboard_Get Timer M_Api_Dashboard_Search Timer M_Api_Admin_User_Create Counter M_Api_Login_Post Counter M_Api_Login_OAuth Counter M_Api_Org_Create Counter M_Api_Dashboard_Snapshot_Create Counter M_Api_Dashboard_Snapshot_External Counter M_Api_Dashboard_Snapshot_Get Counter M_Models_Dashboard_Insert Counter M_Alerting_Result_State_Alerting Counter M_Alerting_Result_State_Ok Counter M_Alerting_Result_State_Paused Counter M_Alerting_Result_State_NoData Counter M_Alerting_Result_State_Pending Counter M_Alerting_Notification_Sent_Slack Counter M_Alerting_Notification_Sent_Email Counter M_Alerting_Notification_Sent_Webhook Counter M_Alerting_Notification_Sent_PagerDuty Counter M_Alerting_Notification_Sent_LINE Counter M_Alerting_Notification_Sent_Victorops Counter M_Alerting_Notification_Sent_OpsGenie Counter M_Alerting_Notification_Sent_Telegram Counter M_Alerting_Notification_Sent_Threema Counter M_Alerting_Notification_Sent_Sensu Counter M_Alerting_Notification_Sent_Pushover Counter M_Aws_CloudWatch_GetMetricStatistics Counter M_Aws_CloudWatch_ListMetrics Counter // Timers M_DataSource_ProxyReq_Timer Timer M_Alerting_Execution_Time Timer // StatTotals M_Alerting_Active_Alerts Gauge M_StatTotal_Dashboards Gauge M_StatTotal_Users Gauge M_StatTotal_Orgs Gauge M_StatTotal_Playlists Gauge )
var UseNilMetrics bool
Functions ¶
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.
Types ¶
type Counter ¶
Counters hold an int64 value that can be incremented and decremented.
func NewCounter ¶
func NewCounter(meta *MetricMeta) Counter
NewCounter constructs a new StandardCounter.
func RegCounter ¶
type EWMA ¶
EWMAs continuously calculate an exponentially-weighted moving average based on an outside source of clock ticks.
func NewEWMA1 ¶
func NewEWMA1() EWMA
NewEWMA1 constructs a new EWMA for a one-minute moving average.
type EWMASnapshot ¶
type EWMASnapshot float64
EWMASnapshot is a read-only copy of another EWMA.
func (EWMASnapshot) Rate ¶
func (a EWMASnapshot) Rate() float64
Rate returns the rate of events per second at the time the snapshot was taken.
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".
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() 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 Gauge ¶
Gauges hold an int64 value that can be set arbitrarily.
func NewGauge ¶
func NewGauge(meta *MetricMeta) Gauge
type GaugeSnapshot ¶
type GaugeSnapshot struct { *MetricMeta // contains filtered or unexported fields }
GaugeSnapshot is a read-only copy of another Gauge.
func (GaugeSnapshot) Snapshot ¶
func (g GaugeSnapshot) Snapshot() Metric
Snapshot returns the snapshot.
func (GaugeSnapshot) Value ¶
func (g GaugeSnapshot) Value() int64
Value returns the value at the time the snapshot was taken.
type GraphitePublisher ¶
type GraphitePublisher struct {
// contains filtered or unexported fields
}
func CreateGraphitePublisher ¶
func CreateGraphitePublisher() (*GraphitePublisher, error)
func (*GraphitePublisher) Publish ¶
func (this *GraphitePublisher) Publish(metrics []Metric)
type Histogram ¶
type Histogram interface { Metric Clear() Count() int64 Max() int64 Mean() float64 Min() int64 Percentile(float64) float64 Percentiles([]float64) []float64 StdDev() float64 Sum() int64 Update(int64) Variance() float64 }
Histograms calculate distribution statistics from a series of int64 values.
func NewHistogram ¶
func NewHistogram(meta *MetricMeta, s Sample) Histogram
type HistogramSnapshot ¶
type HistogramSnapshot struct { *MetricMeta // contains filtered or unexported fields }
HistogramSnapshot is a read-only copy of another Histogram.
func (*HistogramSnapshot) Count ¶
func (h *HistogramSnapshot) Count() int64
Count returns the number of samples recorded at the time the snapshot was taken.
func (*HistogramSnapshot) Max ¶
func (h *HistogramSnapshot) Max() int64
Max returns the maximum value in the sample at the time the snapshot was taken.
func (*HistogramSnapshot) Mean ¶
func (h *HistogramSnapshot) Mean() float64
Mean returns the mean of the values in the sample at the time the snapshot was taken.
func (*HistogramSnapshot) Min ¶
func (h *HistogramSnapshot) Min() int64
Min returns the minimum value in the sample at the time the snapshot was taken.
func (*HistogramSnapshot) Percentile ¶
func (h *HistogramSnapshot) Percentile(p float64) float64
Percentile returns an arbitrary percentile of values in the sample at the time the snapshot was taken.
func (*HistogramSnapshot) Percentiles ¶
func (h *HistogramSnapshot) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of values in the sample at the time the snapshot was taken.
func (*HistogramSnapshot) Sample ¶
func (h *HistogramSnapshot) Sample() Sample
Sample returns the Sample underlying the histogram.
func (*HistogramSnapshot) Snapshot ¶
func (h *HistogramSnapshot) Snapshot() Metric
Snapshot returns the snapshot.
func (*HistogramSnapshot) StdDev ¶
func (h *HistogramSnapshot) StdDev() float64
StdDev returns the standard deviation of the values in the sample at the time the snapshot was taken.
func (*HistogramSnapshot) Sum ¶
func (h *HistogramSnapshot) Sum() int64
Sum returns the sum in the sample at the time the snapshot was taken.
func (*HistogramSnapshot) Variance ¶
func (h *HistogramSnapshot) Variance() float64
Variance returns the variance of inputs at the time the snapshot was taken.
type Meter ¶
type Meter interface { Metric Count() int64 Mark(int64) Rate1() float64 Rate5() float64 Rate15() float64 RateMean() float64 }
Meters count events to produce exponentially-weighted moving average rates at one-, five-, and fifteen-minutes and a mean rate.
func NewMeter ¶
func NewMeter(meta *MetricMeta) Meter
NewMeter constructs a new StandardMeter and launches a goroutine.
type MeterSnapshot ¶
type MeterSnapshot struct { *MetricMeta // contains filtered or unexported fields }
func (*MeterSnapshot) Count ¶
func (m *MeterSnapshot) Count() int64
Count returns the count of events at the time the snapshot was taken.
func (*MeterSnapshot) Rate1 ¶
func (m *MeterSnapshot) Rate1() float64
Rate1 returns the one-minute moving average rate of events per second at the time the snapshot was taken.
func (*MeterSnapshot) Rate15 ¶
func (m *MeterSnapshot) Rate15() float64
Rate15 returns the fifteen-minute moving average rate of events per second at the time the snapshot was taken.
func (*MeterSnapshot) Rate5 ¶
func (m *MeterSnapshot) Rate5() float64
Rate5 returns the five-minute moving average rate of events per second at the time the snapshot was taken.
func (*MeterSnapshot) RateMean ¶
func (m *MeterSnapshot) RateMean() float64
RateMean returns the meter's mean rate of events per second at the time the snapshot was taken.
func (*MeterSnapshot) Snapshot ¶
func (m *MeterSnapshot) Snapshot() Metric
Snapshot returns the snapshot.
type MetricMeta ¶
type MetricMeta struct {
// contains filtered or unexported fields
}
func NewMetricMeta ¶
func NewMetricMeta(name string, tagStrings []string) *MetricMeta
func (*MetricMeta) GetTagsCopy ¶
func (m *MetricMeta) GetTagsCopy() map[string]string
func (*MetricMeta) Name ¶
func (m *MetricMeta) Name() string
func (*MetricMeta) StringifyTags ¶
func (m *MetricMeta) StringifyTags() string
type MetricPublisher ¶
type MetricPublisher interface {
Publish(metrics []Metric)
}
type MetricSettings ¶
type MetricSettings struct { Enabled bool IntervalSeconds int64 Publishers []MetricPublisher }
type NilHistogram ¶
type NilHistogram struct {
*MetricMeta
}
NilHistogram is a no-op Histogram.
func (NilHistogram) Percentile ¶
func (NilHistogram) Percentile(p float64) float64
Percentile is a no-op.
func (NilHistogram) Percentiles ¶
func (NilHistogram) Percentiles(ps []float64) []float64
Percentiles is a no-op.
type NilSample ¶
type NilSample struct{}
NilSample is a no-op Sample.
func (NilSample) Percentiles ¶
Percentiles is a no-op.
type NilTimer ¶
type NilTimer struct { *MetricMeta // contains filtered or unexported fields }
NilTimer is a no-op Timer.
func (NilTimer) Percentiles ¶
Percentiles is a no-op.
type Sample ¶
type Sample interface { Clear() Count() int64 Max() int64 Mean() float64 Min() int64 Percentile(float64) float64 Percentiles([]float64) []float64 Size() int Snapshot() Sample StdDev() float64 Sum() int64 Update(int64) Values() []int64 Variance() float64 }
Samples maintain a statistically-significant selection of values from a stream.
func NewExpDecaySample ¶
NewExpDecaySample constructs a new exponentially-decaying sample with the given reservoir size and alpha.
func NewUniformSample ¶
NewUniformSample constructs a new uniform sample with the given reservoir size.
type SampleSnapshot ¶
type SampleSnapshot struct {
// contains filtered or unexported fields
}
SampleSnapshot is a read-only copy of another Sample.
func (*SampleSnapshot) Count ¶
func (s *SampleSnapshot) Count() int64
Count returns the count of inputs at the time the snapshot was taken.
func (*SampleSnapshot) Max ¶
func (s *SampleSnapshot) Max() int64
Max returns the maximal value at the time the snapshot was taken.
func (*SampleSnapshot) Mean ¶
func (s *SampleSnapshot) Mean() float64
Mean returns the mean value at the time the snapshot was taken.
func (*SampleSnapshot) Min ¶
func (s *SampleSnapshot) Min() int64
Min returns the minimal value at the time the snapshot was taken.
func (*SampleSnapshot) Percentile ¶
func (s *SampleSnapshot) Percentile(p float64) float64
Percentile returns an arbitrary percentile of values at the time the snapshot was taken.
func (*SampleSnapshot) Percentiles ¶
func (s *SampleSnapshot) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of values at the time the snapshot was taken.
func (*SampleSnapshot) Size ¶
func (s *SampleSnapshot) Size() int
Size returns the size of the sample at the time the snapshot was taken.
func (*SampleSnapshot) Snapshot ¶
func (s *SampleSnapshot) Snapshot() Sample
Snapshot returns the snapshot.
func (*SampleSnapshot) StdDev ¶
func (s *SampleSnapshot) StdDev() float64
StdDev returns the standard deviation of values at the time the snapshot was taken.
func (*SampleSnapshot) Sum ¶
func (s *SampleSnapshot) Sum() int64
Sum returns the sum of values at the time the snapshot was taken.
func (*SampleSnapshot) Values ¶
func (s *SampleSnapshot) Values() []int64
Values returns a copy of the values in the sample.
func (*SampleSnapshot) Variance ¶
func (s *SampleSnapshot) Variance() float64
Variance returns the variance of values at the time the snapshot was taken.
type StandardCounter ¶
type StandardCounter struct { *MetricMeta // contains filtered or unexported fields }
StandardCounter is the standard implementation of a Counter and uses the sync/atomic package to manage a single int64 value.
func (*StandardCounter) Count ¶
func (c *StandardCounter) Count() int64
Count returns the current count.
func (*StandardCounter) Dec ¶
func (c *StandardCounter) Dec(i int64)
Dec decrements the counter by the given amount.
func (*StandardCounter) Inc ¶
func (c *StandardCounter) Inc(i int64)
Inc increments the counter by the given amount.
func (*StandardCounter) Snapshot ¶
func (c *StandardCounter) Snapshot() Metric
type StandardEWMA ¶
type StandardEWMA struct {
// contains filtered or unexported fields
}
StandardEWMA is the standard implementation of an EWMA and tracks the number of uncounted events and processes them on each tick. It uses the sync/atomic package to manage uncounted events.
func (*StandardEWMA) Rate ¶
func (a *StandardEWMA) Rate() float64
Rate returns the moving average rate of events per second.
func (*StandardEWMA) Snapshot ¶
func (a *StandardEWMA) Snapshot() EWMA
Snapshot returns a read-only copy of the EWMA.
func (*StandardEWMA) Tick ¶
func (a *StandardEWMA) Tick()
Tick ticks the clock to update the moving average. It assumes it is called every five seconds.
func (*StandardEWMA) Update ¶
func (a *StandardEWMA) Update(n int64)
Update adds n uncounted events.
type StandardGauge ¶
type StandardGauge struct { *MetricMeta // contains filtered or unexported fields }
StandardGauge is the standard implementation of a Gauge and uses the sync/atomic package to manage a single int64 value. atomic needs 64-bit aligned memory which is ensure for first word
func (*StandardGauge) Snapshot ¶
func (g *StandardGauge) Snapshot() Metric
Snapshot returns a read-only copy of the gauge.
func (*StandardGauge) Update ¶
func (g *StandardGauge) Update(v int64)
Update updates the gauge's value.
func (*StandardGauge) Value ¶
func (g *StandardGauge) Value() int64
Value returns the gauge's current value.
type StandardHistogram ¶
type StandardHistogram struct { *MetricMeta // contains filtered or unexported fields }
StandardHistogram is the standard implementation of a Histogram and uses a Sample to bound its memory use.
func (*StandardHistogram) Clear ¶
func (h *StandardHistogram) Clear()
Clear clears the histogram and its sample.
func (*StandardHistogram) Count ¶
func (h *StandardHistogram) Count() int64
Count returns the number of samples recorded since the histogram was last cleared.
func (*StandardHistogram) Max ¶
func (h *StandardHistogram) Max() int64
Max returns the maximum value in the sample.
func (*StandardHistogram) Mean ¶
func (h *StandardHistogram) Mean() float64
Mean returns the mean of the values in the sample.
func (*StandardHistogram) Min ¶
func (h *StandardHistogram) Min() int64
Min returns the minimum value in the sample.
func (*StandardHistogram) Percentile ¶
func (h *StandardHistogram) Percentile(p float64) float64
Percentile returns an arbitrary percentile of the values in the sample.
func (*StandardHistogram) Percentiles ¶
func (h *StandardHistogram) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of the values in the sample.
func (*StandardHistogram) Sample ¶
func (h *StandardHistogram) Sample() Sample
Sample returns the Sample underlying the histogram.
func (*StandardHistogram) Snapshot ¶
func (h *StandardHistogram) Snapshot() Metric
Snapshot returns a read-only copy of the histogram.
func (*StandardHistogram) StdDev ¶
func (h *StandardHistogram) StdDev() float64
StdDev returns the standard deviation of the values in the sample.
func (*StandardHistogram) Sum ¶
func (h *StandardHistogram) Sum() int64
Sum returns the sum in the sample.
func (*StandardHistogram) Update ¶
func (h *StandardHistogram) Update(v int64)
Update samples a new value.
func (*StandardHistogram) Variance ¶
func (h *StandardHistogram) Variance() float64
Variance returns the variance of the values in the sample.
type StandardMeter ¶
type StandardMeter struct { *MetricMeta // contains filtered or unexported fields }
StandardMeter is the standard implementation of a Meter.
func (*StandardMeter) Count ¶
func (m *StandardMeter) Count() int64
Count returns the number of events recorded.
func (*StandardMeter) Mark ¶
func (m *StandardMeter) Mark(n int64)
Mark records the occurance of n events.
func (*StandardMeter) Rate1 ¶
func (m *StandardMeter) Rate1() float64
Rate1 returns the one-minute moving average rate of events per second.
func (*StandardMeter) Rate15 ¶
func (m *StandardMeter) Rate15() float64
Rate15 returns the fifteen-minute moving average rate of events per second.
func (*StandardMeter) Rate5 ¶
func (m *StandardMeter) Rate5() float64
Rate5 returns the five-minute moving average rate of events per second.
func (*StandardMeter) RateMean ¶
func (m *StandardMeter) RateMean() float64
RateMean returns the meter's mean rate of events per second.
func (*StandardMeter) Snapshot ¶
func (m *StandardMeter) Snapshot() Metric
Snapshot returns a read-only copy of the meter.
type StandardRegistry ¶
type StandardRegistry struct {
// contains filtered or unexported fields
}
The standard implementation of a Registry is a mutex-protected map of names to metrics.
func (*StandardRegistry) GetSnapshots ¶
func (r *StandardRegistry) GetSnapshots() []Metric
Call the given function for each registered metric.
func (*StandardRegistry) Register ¶
func (r *StandardRegistry) Register(metric Metric)
type StandardTimer ¶
type StandardTimer struct { *MetricMeta // 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() Metric
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 Timer ¶
type Timer interface { Metric Count() int64 Max() int64 Mean() float64 Min() int64 Percentile(float64) float64 Percentiles([]float64) []float64 Rate1() float64 Rate5() float64 Rate15() float64 RateMean() float64 StdDev() float64 Sum() int64 Time(func()) Update(time.Duration) UpdateSince(time.Time) Variance() float64 }
Timers capture the duration and rate of events.
func NewCustomTimer ¶
func NewCustomTimer(meta *MetricMeta, h Histogram, m Meter) Timer
NewCustomTimer constructs a new StandardTimer from a Histogram and a Meter.
func NewTimer ¶
func NewTimer(meta *MetricMeta) Timer
NewTimer constructs a new StandardTimer using an exponentially-decaying sample with the same reservoir size and alpha as UNIX load averages.
type TimerSnapshot ¶
type TimerSnapshot struct { *MetricMeta // 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() Metric
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) UpdateSince ¶
func (*TimerSnapshot) UpdateSince(time.Time)
UpdateSince panics.
func (*TimerSnapshot) Variance ¶
func (t *TimerSnapshot) Variance() float64
Variance returns the variance of the values at the time the snapshot was taken.
type UniformSample ¶
type UniformSample struct {
// contains filtered or unexported fields
}
A uniform sample using Vitter's Algorithm R.
<http://www.cs.umd.edu/~samir/498/vitter.pdf>
func (*UniformSample) Count ¶
func (s *UniformSample) Count() int64
Count returns the number of samples recorded, which may exceed the reservoir size.
func (*UniformSample) Max ¶
func (s *UniformSample) 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 (*UniformSample) Mean ¶
func (s *UniformSample) Mean() float64
Mean returns the mean of the values in the sample.
func (*UniformSample) Min ¶
func (s *UniformSample) 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 (*UniformSample) Percentile ¶
func (s *UniformSample) Percentile(p float64) float64
Percentile returns an arbitrary percentile of values in the sample.
func (*UniformSample) Percentiles ¶
func (s *UniformSample) Percentiles(ps []float64) []float64
Percentiles returns a slice of arbitrary percentiles of values in the sample.
func (*UniformSample) Size ¶
func (s *UniformSample) Size() int
Size returns the size of the sample, which is at most the reservoir size.
func (*UniformSample) Snapshot ¶
func (s *UniformSample) Snapshot() Sample
Snapshot returns a read-only copy of the sample.
func (*UniformSample) StdDev ¶
func (s *UniformSample) StdDev() float64
StdDev returns the standard deviation of the values in the sample.
func (*UniformSample) Sum ¶
func (s *UniformSample) Sum() int64
Sum returns the sum of the values in the sample.
func (*UniformSample) Values ¶
func (s *UniformSample) Values() []int64
Values returns a copy of the values in the sample.
func (*UniformSample) Variance ¶
func (s *UniformSample) Variance() float64
Variance returns the variance of the values in the sample.