Documentation ¶
Overview ¶
In memory request performance metrics
Index ¶
- func IsNetworkError(attempt request.Attempt) bool
- func SplitFloat64(threshold, sentinel float64, values []float64) (good map[float64]bool, bad map[float64]bool)
- func SplitLatencies(values []time.Duration, precision time.Duration) (good map[time.Duration]bool, bad map[time.Duration]bool)
- func SplitRatios(values []float64) (good map[float64]bool, bad map[float64]bool)
- type FailPredicate
- type FailRateMeter
- type HDRHistogram
- type Histogram
- type NewHistogramFn
- type NewRollingCounterFn
- type RollingCounter
- type RollingHistogram
- type RollingMeter
- func (r *RollingMeter) Buckets() int
- func (r *RollingMeter) FailureCount() int64
- func (r *RollingMeter) GetRate() float64
- func (r *RollingMeter) GetWindowSize() time.Duration
- func (r *RollingMeter) IsReady() bool
- func (r *RollingMeter) ObserveRequest(request.Request)
- func (r *RollingMeter) ObserveResponse(req request.Request, lastAttempt request.Attempt)
- func (r *RollingMeter) ProcessedCount() int64
- func (r *RollingMeter) Reset()
- func (r *RollingMeter) Resolution() time.Duration
- func (r *RollingMeter) SuccessCount() int64
- type TestMeter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNetworkError ¶
func SplitFloat64 ¶
func SplitFloat64(threshold, sentinel float64, values []float64) (good map[float64]bool, bad map[float64]bool)
SplitFloat64 provides simple anomaly detection for skewed data sets with no particular distribution. In essense it applies the formula if(v > median(values) + threshold * medianAbsoluteDeviation) -> anomaly There's a corner case where there are just 2 values, so by definition there's no value that exceeds the threshold. This case is solved by introducing additional value that we know is good, e.g. 0. That helps to improve the detection results on such data sets.
func SplitLatencies ¶
func SplitLatencies(values []time.Duration, precision time.Duration) (good map[time.Duration]bool, bad map[time.Duration]bool)
SplitRatios provides simple anomaly detection for requests latencies. it splits values into good or bad category based on the threshold and the median value. If all values are not far from the median, it will return all values in 'good' set. Precision is the smallest value to consider, e.g. if set to millisecond, microseconds will be ignored.
func SplitRatios ¶
SplitRatios provides simple anomaly detection for ratio values, that are all in the range [0, 1] it splits values into good or bad category based on the threshold and the median value. If all values are not far from the median, it will return all values in 'good' set.
Types ¶
type FailPredicate ¶
Predicate that helps to see if the attempt resulted in error
type FailRateMeter ¶
type HDRHistogram ¶
type HDRHistogram struct {
// contains filtered or unexported fields
}
func NewHDRHistogram ¶
func NewHDRHistogram(low, high int64, sigfigs int) (h *HDRHistogram, err error)
func (*HDRHistogram) Merge ¶
func (h *HDRHistogram) Merge(o Histogram) error
func (*HDRHistogram) RecordValues ¶
func (h *HDRHistogram) RecordValues(v, n int64) error
func (*HDRHistogram) Reset ¶
func (h *HDRHistogram) Reset()
func (*HDRHistogram) ValueAtQuantile ¶
func (h *HDRHistogram) ValueAtQuantile(q float64) int64
type NewHistogramFn ¶
NewHistogramFn is a constructor that can be passed to NewRollingHistogram
func NewHDRHistogramFn ¶
func NewHDRHistogramFn(low, high int64, sigfigs int) NewHistogramFn
NewHDRHistogramFn creates a constructor of HDR histograms with predefined parameters.
type NewRollingCounterFn ¶
type NewRollingCounterFn func() (*RollingCounter, error)
NewRollingCounterFn is a constructor of rolling counters.
type RollingCounter ¶
type RollingCounter struct {
// contains filtered or unexported fields
}
Calculates in memory failure rate of an endpoint using rolling window of a predefined size
func NewRollingCounter ¶
func NewRollingCounter(buckets int, resolution time.Duration, timeProvider timetools.TimeProvider) (*RollingCounter, error)
NewRollingCounter creates a counter with fixed amount of buckets that are rotated every resolition period. E.g. 10 buckets with 1 second means that every new second the bucket is refreshed, so it maintains 10 second rolling window.
func (*RollingCounter) Buckets ¶
func (c *RollingCounter) Buckets() int
func (*RollingCounter) Count ¶
func (c *RollingCounter) Count() int64
func (*RollingCounter) CountedBuckets ¶
func (c *RollingCounter) CountedBuckets() int
func (*RollingCounter) GetWindowSize ¶
func (c *RollingCounter) GetWindowSize() time.Duration
func (*RollingCounter) Inc ¶
func (c *RollingCounter) Inc()
func (*RollingCounter) Reset ¶
func (c *RollingCounter) Reset()
func (*RollingCounter) Resolution ¶
func (c *RollingCounter) Resolution() time.Duration
type RollingHistogram ¶
RollingHistogram holds multiple histograms and rotates every period. It provides resulting histogram as a result of a call of 'Merged' function.
func NewRollingHistogram ¶
func NewRollingHistogram(maker NewHistogramFn, bucketCount int, period time.Duration, timeProvider timetools.TimeProvider) (RollingHistogram, error)
type RollingMeter ¶
type RollingMeter struct {
// contains filtered or unexported fields
}
Calculates various performance metrics about the endpoint using counters of the predefined size
func NewRollingMeter ¶
func NewRollingMeter(endpoint endpoint.Endpoint, buckets int, resolution time.Duration, timeProvider timetools.TimeProvider, isError FailPredicate) (*RollingMeter, error)
func (*RollingMeter) Buckets ¶
func (r *RollingMeter) Buckets() int
func (*RollingMeter) FailureCount ¶
func (r *RollingMeter) FailureCount() int64
func (*RollingMeter) GetRate ¶
func (r *RollingMeter) GetRate() float64
func (*RollingMeter) GetWindowSize ¶
func (r *RollingMeter) GetWindowSize() time.Duration
func (*RollingMeter) IsReady ¶
func (r *RollingMeter) IsReady() bool
func (*RollingMeter) ObserveRequest ¶
func (r *RollingMeter) ObserveRequest(request.Request)
func (*RollingMeter) ObserveResponse ¶
func (r *RollingMeter) ObserveResponse(req request.Request, lastAttempt request.Attempt)
func (*RollingMeter) ProcessedCount ¶
func (r *RollingMeter) ProcessedCount() int64
func (*RollingMeter) Reset ¶
func (r *RollingMeter) Reset()
func (*RollingMeter) Resolution ¶
func (r *RollingMeter) Resolution() time.Duration
func (*RollingMeter) SuccessCount ¶
func (r *RollingMeter) SuccessCount() int64