autoscaler

package
v0.0.0-...-268cd68 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scaling

type Scaling struct {
	// contains filtered or unexported fields
}

func NewScaling

func NewScaling(state State, url string, opts ...ScalingOption) (*Scaling, error)

func NewScalingWithOptions

func NewScalingWithOptions(state State, sMetrics ScalingMetrics, receive ScalingReceiver, calculate ScalingCalculator, prepare ScalingPreparator, url string, opts ...ScalingOption) (*Scaling, error)

func (*Scaling) ProcessScrapeTargetWithValue

func (s *Scaling) ProcessScrapeTargetWithValue(scrapeTarget *cloudburst.ScrapeTarget, value float64) error

func (*Scaling) Run

func (s *Scaling) Run(ctx context.Context) error

type ScalingCalculator

type ScalingCalculator interface {
	Calculate(scrapeTarget *cloudburst.ScrapeTarget, instances []*cloudburst.Instance, metricValue float64) cloudburst.ScalingResult
}

type ScalingMetrics

type ScalingMetrics interface {
	SetReceiverMetricValue(service string, value float64)
	SetCalculatorInstancesTotal(service, provider, status string, value float64)
	SetCalculatorInstanceDemandResult(service, provider string, value float64)
}

type ScalingOption

type ScalingOption func(b *Scaling) error

ScalingOption passed to NewBot to change the default instance.

func WithCalculator

func WithCalculator(c ScalingCalculator) ScalingOption

func WithInterval

func WithInterval(t time.Duration) ScalingOption

func WithLogger

func WithLogger(l log.Logger) ScalingOption

func WithMetrics

func WithMetrics(m ScalingMetrics) ScalingOption

func WithReceiver

func WithReceiver(r ScalingReceiver) ScalingOption

type ScalingPreparator

type ScalingPreparator interface {
	Prepare(result cloudburst.ScalingResult, scrapeTarget *cloudburst.ScrapeTarget) error
}

type ScalingReceiver

type ScalingReceiver interface {
	Poll(query string) (float64, error)
	PollFrom(url string, query string) (float64, error)
}

type State

type State interface {
	ListScrapeTargets() ([]*cloudburst.ScrapeTarget, error)
	GetInstance(scrapeTarget string, name string) (*cloudburst.Instance, error)
	GetInstances(scrapeTarget string) ([]*cloudburst.Instance, error)
	RemoveInstances(scrapeTarget string, instances []*cloudburst.Instance) error
	RemoveInstance(scrapeTarget string, instance *cloudburst.Instance) error
	SaveInstances(scrapeTarget string, instances []*cloudburst.Instance) ([]*cloudburst.Instance, error)
	SaveInstance(scrapeTarget string, instance *cloudburst.Instance) (*cloudburst.Instance, error)
}

Jump to

Keyboard shortcuts

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