Documentation ¶
Index ¶
- Constants
- type Detector
- type EwmaDetector
- func (e *EwmaDetector) Add(data TimedData)
- func (e *EwmaDetector) AddAll(vals []TimedData)
- func (e *EwmaDetector) IsAnomaly() (bool, error)
- func (e *EwmaDetector) Mean() float64
- func (e *EwmaDetector) Metrics() []string
- func (e *EwmaDetector) Name() string
- func (e *EwmaDetector) Reason() string
- func (e *EwmaDetector) SampleCount() int
- func (e *EwmaDetector) SampleDuration() time.Duration
- func (e *EwmaDetector) StdDev() float64
- type ExpressionDetector
- func (e *ExpressionDetector) Add(data TimedData)
- func (e *ExpressionDetector) AddAll(vals []TimedData)
- func (e *ExpressionDetector) IsAnomaly() (bool, error)
- func (e *ExpressionDetector) Metrics() []string
- func (e *ExpressionDetector) Name() string
- func (e *ExpressionDetector) Reason() string
- func (e *ExpressionDetector) SampleCount() int
- func (e *ExpressionDetector) SampleDuration() time.Duration
- type ExpressionOption
- type TimedData
Constants ¶
const MinData = 11
MinData is the minimum length of data for AnomalyDetector to work
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector interface { // Name show detector name Name() string // Add add detect data Add(data TimedData) // AddAll add detect data array AddAll(vals []TimedData) // IsAnomaly checks if current values is anomaly IsAnomaly() (bool, error) // Metrics return current detector metrics Metrics() []string // SampleCount get current data count SampleCount() int // SampleDuration get current data time range SampleDuration() time.Duration // Reason get anomaly reason Reason() string }
Detector defines detector methods
func NewUnionDetector ¶
NewUnionDetector union multiple detectors
type EwmaDetector ¶
type EwmaDetector struct {
// contains filtered or unexported fields
}
EwmaDetector using ewma alg to detect anomaly values
func NewEwmaDetector ¶
func NewEwmaDetector(metric string, n int) *EwmaDetector
NewEwmaDetector returns a AnomalyDetector which keeps n data. Note: please initialize the detector with at lease 10 data using Add() method. It is required by the EWMA library to be "ready" for producing value. AnomalyDetector is not thread safe
func (*EwmaDetector) AddAll ¶
func (e *EwmaDetector) AddAll(vals []TimedData)
AddAll add detect data array
func (*EwmaDetector) IsAnomaly ¶
func (e *EwmaDetector) IsAnomaly() (bool, error)
IsAnomaly checks if current values is anomaly
func (*EwmaDetector) Metrics ¶
func (e *EwmaDetector) Metrics() []string
Metrics return current detector metrics
func (*EwmaDetector) SampleCount ¶
func (e *EwmaDetector) SampleCount() int
SampleCount get current data count
func (*EwmaDetector) SampleDuration ¶
func (e *EwmaDetector) SampleDuration() time.Duration
SampleDuration get current data time range
func (*EwmaDetector) StdDev ¶
func (e *EwmaDetector) StdDev() float64
StdDev returns the standard deviation
type ExpressionDetector ¶
type ExpressionDetector struct {
// contains filtered or unexported fields
}
ExpressionDetector using expressions to detect anomaly metrics
func NewExpressionDetector ¶
func NewExpressionDetector(metrics []string, exp *govaluate.EvaluableExpression, options ...ExpressionOption) *ExpressionDetector
NewExpressionDetector new an expression detector
func (*ExpressionDetector) Add ¶
func (e *ExpressionDetector) Add(data TimedData)
Add add detect data
func (*ExpressionDetector) AddAll ¶
func (e *ExpressionDetector) AddAll(vals []TimedData)
AddAll add detect data array
func (*ExpressionDetector) IsAnomaly ¶
func (e *ExpressionDetector) IsAnomaly() (bool, error)
IsAnomaly checks if current values is anomaly
func (*ExpressionDetector) Metrics ¶
func (e *ExpressionDetector) Metrics() []string
Metrics return current detector metrics
func (*ExpressionDetector) Name ¶
func (e *ExpressionDetector) Name() string
Name show detector name
func (*ExpressionDetector) Reason ¶
func (e *ExpressionDetector) Reason() string
Reason get anomaly reason
func (*ExpressionDetector) SampleCount ¶
func (e *ExpressionDetector) SampleCount() int
SampleCount get current data count
func (*ExpressionDetector) SampleDuration ¶
func (e *ExpressionDetector) SampleDuration() time.Duration
SampleDuration get current data time range
type ExpressionOption ¶
type ExpressionOption func(*ExpressionDetector) error
func ExpressionWarningArgs ¶
func ExpressionWarningArgs(args *types.ExpressionArgs) ExpressionOption
ExpressionWarningArgs is used to set some expression args