Documentation
¶
Overview ¶
Package autoscale is target tracking for services (§5.5): every 15s it reads each policy's metric from VictoriaMetrics and moves the desired task count towards the number that brings the metric back to its target, quickly out and conservatively in.
Index ¶
Constants ¶
const ( // Interval between evaluations. Interval = 15 * time.Second // TopicEvent carries a store.ScalingEvent when the autoscaler scales. TopicEvent = "scaling.event" // Actor is who the autoscaler's changes are attributed to. Actor = "autoscaler" )
Variables ¶
var Metrics = map[string]string{
"cpu": "% of reserved CPU",
"memory": "% of reserved memory",
"rps": "requests/s per task",
"latency": "ms p95",
}
Metrics the policies can track and their units.
Functions ¶
func Validate ¶
func Validate(p *store.ScalingPolicy) error
Validate checks a policy and fills in defaults.
Types ¶
type Current ¶
type Current struct {
Value *float64 `json:"value"` // nil: no data
EvaluatedAt *time.Time `json:"evaluatedAt"`
}
Current is the latest measurement of a service's policy metric.
type ErrInvalid ¶
type ErrInvalid struct{ Err error }
ErrInvalid wraps validation errors.
func (ErrInvalid) Error ¶
func (e ErrInvalid) Error() string