autoscaler

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MaxInt = int(MaxUint >> 1)
View Source
const MaxUint = ^uint(0)

Go does not provide a MaxInt, so we have to calculate it.

Variables

This section is empty.

Functions

func NewAutoScaler

func NewAutoScaler(metricsReceiver metrics.MetricsReceiver, transportInspector transport.Inspector) *autoScaler

NewAutoScaler constructs an autoscaler instance using the given metrics receiver and the given transport inspector.

Types

type AutoScaler

type AutoScaler interface {
	// Set maximum replica count policy.
	SetMaxReplicasPolicy(func(function FunctionId) int)

	// Set delay scale down policy.
	SetDelayScaleDownPolicy(func(function FunctionId) time.Duration)

	// Run starts the autoscaler receiving and sampling metrics.
	Run()

	// Close stops the autoscaler receiving and sampling metrics.
	io.Closer

	// InformFunctionReplicas is used to tell the autoscaler the actual number of replicas there are for a given
	// function. The function is not necessarily being monitored by the autoscaler.
	InformFunctionReplicas(function FunctionId, replicas int)

	// StartMonitoring starts monitoring metrics for the given topic and function.
	StartMonitoring(topic string, function FunctionId) error

	// StopMonitoring stops monitoring metrics for the given topic and function.
	StopMonitoring(topic string, function FunctionId) error

	// Propose proposes the number of replicas for functions that are being monitored.
	Propose() map[FunctionId]int
}

type Delayer

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

func NewDelayer

func NewDelayer(delayPolicy func() time.Duration) *Delayer

NewDelayer creates a delayer which delays scaling down to zero until the delay returned by the given policy has elapsed.

func (*Delayer) Delay

func (b *Delayer) Delay(proposal int) *Delayer

func (*Delayer) Get

func (b *Delayer) Get() int

type FunctionId

type FunctionId struct {
	Function string
}

FunctionId identifies a function TODO: support namespaces.

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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