task

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSampleWeight is the default weight of any sample (prior to including decaying factor)
	DefaultSampleWeight = float64(1)
	// DefaultMinSampleWeight is the minimal sample weight of any sample (prior to including decaying factor)
	DefaultMinSampleWeight = float64(0.1)
	// DefaultEpsilon is the minimal weight kept in histograms, it should be small enough that old samples
	// (just inside MemoryAggregationWindowLength) added with DefaultMinSampleWeight are still kept
	DefaultEpsilon = 0.001 * DefaultMinSampleWeight
	// DefaultHistogramBucketSizeGrowth is the default value for HistogramBucketSizeGrowth.
	DefaultHistogramBucketSizeGrowth = 0.05 // Make each bucket 5% larger than the previous one.

	// DefaultCPUHistogramMaxValue CPU histograms max bucket size is 1000.0 cores
	DefaultCPUHistogramMaxValue = 1000.0
	// DefaultCPUHistogramFirstBucketSize CPU histograms smallest bucket size is 0.01 cores
	DefaultCPUHistogramFirstBucketSize = 0.01

	// DefaultMemHistogramMaxValue Mem histograms max bucket size is 1TB
	DefaultMemHistogramMaxValue = 1e12
	// DefaultMemHistogramFirstBucketSize Mem histograms smallest bucket size is 10MB
	DefaultMemHistogramFirstBucketSize = 1e7

	DefaultCPUTaskProcessInterval = time.Minute * 10
	DefaultMemTaskProcessInterval = time.Hour * 1

	// DefaultHistogramDecayHalfLife is the default value for HistogramDecayHalfLife.
	DefaultHistogramDecayHalfLife = time.Hour * 24

	// DefaultInitDataLength is default data query span for the first run of the task
	DefaultInitDataLength = time.Hour * 25

	// MaxOfAllowNotExecutionTime is maximum non-run tolerance time for a task
	MaxOfAllowNotExecutionTime = 50 * time.Hour
)
View Source
const (
	ProcessConfigHalfLifeKey = "decayHalfLife"
)

Variables

View Source
var (
	DataPreparingErr         = errors.New("data preparing")
	SampleExpirationErr      = errors.New("no samples in the last 24 hours")
	InsufficientSampleErr    = errors.New("The data sample is insufficient to obtain the predicted value")
	QuerySamplesIsEmptyErr   = errors.New("the sample found is empty")
	HistogramTaskRunPanicErr = errors.New("histogram task run panic")
)

Functions

func GetDefaultTaskProcessInterval

func GetDefaultTaskProcessInterval(resourceName v1.ResourceName) (t time.Duration, err error)

func HistogramOptionsFactory

func HistogramOptionsFactory(resourceName v1.ResourceName) (vpautil.HistogramOptions, error)

Types

type HistogramTask

type HistogramTask struct {
	ProcessInterval time.Duration
	// contains filtered or unexported fields
}

func (*HistogramTask) AddRangeSample

func (t *HistogramTask) AddRangeSample(firstSampleTime, lastSampleTime time.Time, sampleValue float64, sampleWeight float64)

func (*HistogramTask) AddSample

func (t *HistogramTask) AddSample(sampleTime time.Time, sampleValue float64, sampleWeight float64)

func (*HistogramTask) IsTimeoutNotExecute

func (t *HistogramTask) IsTimeoutNotExecute() bool

func (*HistogramTask) QueryPercentileValue

func (t *HistogramTask) QueryPercentileValue(ctx context.Context, percentile float64) (float64, error)

func (*HistogramTask) Run

func (t *HistogramTask) Run(ctx context.Context, datasourceProxy *datasource.Proxy) (nextRunInterval time.Duration, err error)

type ProcessConfig

type ProcessConfig struct {
	DecayHalfLife time.Duration
}

func GetTaskConfig

func GetTaskConfig(extensions processortypes.TaskConfigStr) (*ProcessConfig, error)

Jump to

Keyboard shortcuts

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