metrics

package
v0.0.0-...-a5469ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2015 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

In memory request performance metrics

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNetworkError

func IsNetworkError(attempt request.Attempt) bool

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

func SplitRatios(values []float64) (good map[float64]bool, bad map[float64]bool)

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

type FailPredicate func(request.Attempt) bool

Predicate that helps to see if the attempt resulted in error

type FailRateMeter

type FailRateMeter interface {
	GetRate() float64
	IsReady() bool
	GetWindowSize() time.Duration
	middleware.Observer
}

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 Histogram

type Histogram interface {
	ValueAtQuantile(q float64) int64
	RecordValues(v, n int64) error
	// Merge updates this histogram with values of another histogram
	Merge(Histogram) error
	// Resets state of the histogram
	Reset()
}

type NewHistogramFn

type NewHistogramFn func() (Histogram, error)

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

type RollingHistogram interface {
	RecordValues(v, n int64) error
	Merged() (Histogram, error)
}

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

type TestMeter

type TestMeter struct {
	Rate       float64
	NotReady   bool
	WindowSize time.Duration
}

func (*TestMeter) GetRate

func (tm *TestMeter) GetRate() float64

func (*TestMeter) GetWindowSize

func (tm *TestMeter) GetWindowSize() time.Duration

func (*TestMeter) IsReady

func (tm *TestMeter) IsReady() bool

func (*TestMeter) ObserveRequest

func (em *TestMeter) ObserveRequest(r request.Request)

func (*TestMeter) ObserveResponse

func (em *TestMeter) ObserveResponse(r request.Request, lastAttempt request.Attempt)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL