Documentation ¶
Overview ¶
Package statforwarder provides a forwarder which can be used to forward autoscaler statistics to the right Autoscaler pod if Autoscaler is set up with multiple pods and running in Leader Election mode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LeaseBasedProcessor ¶ added in v0.20.0
LeaseBasedProcessor tracks leases and decodes the holder's identity in order to set the appropriate "processor" on the Forwarder.
Types ¶
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
Forwarder does the following things:
- Watches the change of Leases for Autoscaler buckets. Stores the Lease -> IP mapping.
- Creates/updates the corresponding K8S Service and Endpoints.
- Can be used to forward the metrics owned by a bucket based on the holder IP.
func New ¶
New creates a new Forwarder. This must be configured with a mechanism for setting up its "processors", such as LeaseBasedProcessor or StatefulSetBasedProcessor, which correlates with the mechanism of leader election being used.
func (*Forwarder) Cancel ¶
func (f *Forwarder) Cancel()
Cancel is the function to call when terminating a Forwarder.
func (*Forwarder) IsBucketOwner ¶ added in v0.19.0
IsBucketOwner returns true if this Autoscaler pod is the owner of the given bucket.
func (*Forwarder) Process ¶
func (f *Forwarder) Process(sm asmetrics.StatMessage)
Process enqueues the given Stat for processing asynchronously. It calls Forwarder.accept if the pod where this Forwarder is running is the owner of the given StatMessage. Otherwise it forwards the given StatMessage to the right owner pod. It will retry if any error happens during the processing.