statforwarder

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 23 Imported by: 2

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

This section is empty.

Types

type Forwarder

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

Forwarder does the following things:

  1. Watches the change of Leases for Autoscaler buckets. Stores the Lease -> IP mapping.
  2. Creates/updates the corresponding K8S Service and Endpoints.
  3. Can be used to forward the metrics owned by a bucket based on the holder IP.

func New

func New(ctx context.Context, logger *zap.SugaredLogger, kc kubernetes.Interface, selfIP string, bs *hash.BucketSet, accept statProcessor) *Forwarder

New creates a new Forwarder.

func (*Forwarder) Cancel

func (f *Forwarder) Cancel()

Cancel is the function to call when terminating a Forwarder.

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.

Jump to

Keyboard shortcuts

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