prediction

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0, BSD-2-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	HistoryProvider  = "__history"
	RealtimeProvider = "__realtime"
)

Variables

This section is empty.

Functions

func AggregateSignalKey

func AggregateSignalKey(labels []common.Label) string

Types

type GenericPrediction

type GenericPrediction struct {
	WithCh chan QueryExprWithCaller
	DelCh  chan QueryExprWithCaller
	// contains filtered or unexported fields
}

func NewGenericPrediction

func NewGenericPrediction(realtimeProvider providers.RealTime, historyProvider providers.History, withCh, delCh chan QueryExprWithCaller) GenericPrediction

func (*GenericPrediction) DeleteQuery added in v0.3.0

func (p *GenericPrediction) DeleteQuery(namer metricnaming.MetricNamer, caller string) error

func (*GenericPrediction) GetHistoryProvider

func (p *GenericPrediction) GetHistoryProvider() providers.History

func (*GenericPrediction) GetRealtimeProvider

func (p *GenericPrediction) GetRealtimeProvider() providers.RealTime

func (*GenericPrediction) WithQuery

func (p *GenericPrediction) WithQuery(namer metricnaming.MetricNamer, caller string, config config.Config) error

type Interface

type Interface interface {
	// Run performs the prediction routine.
	Run(stopCh <-chan struct{})

	// WithQuery registers a PromQL like query expression, so that the prediction will involve the time series that
	// are selected and aggregated through the specified 'queryExpr'.
	WithQuery(metricNamer metricnaming.MetricNamer, caller string, config config.Config) error

	DeleteQuery(metricNamer metricnaming.MetricNamer, caller string) error

	// QueryPredictionStatus return the metricNamer prediction status. it is predictable only when it is ready
	QueryPredictionStatus(ctx context.Context, metricNamer metricnaming.MetricNamer) (Status, error)

	// QueryRealtimePredictedValues returns predicted values based on the specified query expression
	QueryRealtimePredictedValues(ctx context.Context, metricNamer metricnaming.MetricNamer) ([]*common.TimeSeries, error)

	// QueryPredictedTimeSeries returns predicted time series based on the specified query expression
	QueryPredictedTimeSeries(ctx context.Context, metricNamer metricnaming.MetricNamer, startTime time.Time, endTime time.Time) ([]*common.TimeSeries, error)

	// A analysis task function
	QueryRealtimePredictedValuesOnce(ctx context.Context, namer metricnaming.MetricNamer, config config.Config) ([]*common.TimeSeries, error)

	Name() string
}

type QueryExprWithCaller added in v0.3.0

type QueryExprWithCaller struct {
	MetricNamer metricnaming.MetricNamer
	Config      config.Config
	Caller      string
}

func (QueryExprWithCaller) String added in v0.3.0

func (q QueryExprWithCaller) String() string

type Status added in v0.3.0

type Status string
const (
	StatusReady      Status = "Ready"
	StatusNotStarted Status = "NotStarted"
	StatusUnknown    Status = "Unknown"
	StatusDeleted    Status = "Deleted"
	// StatusInitializing means the prediction model is accumulating data until it satisfy the user specified time window such as 12h or 3d or 1w when use some real time data provider
	// if support recover from checkpoint, then it maybe faster
	StatusInitializing Status = "Initializing"
	StatusExpired      Status = "Expired"
)

type WithMetricEvent

type WithMetricEvent struct {
	MetricName string
	Conditions []common.QueryCondition
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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