load

package
v0.0.0-...-72c2bb7 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateReporter

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

RateReporter maintains score as an exponentially weighted rate

func NewRateReporter

func NewRateReporter(d time.Duration) *RateReporter

NewRateReporter builds a rate reporter over a period of time.

func (*RateReporter) Increment

func (r *RateReporter) Increment(n int64)

Increment increases the rate by n. Typical use case is e.g. the rate of requests, where Increment(1) is called on every request.

func (*RateReporter) Load

Load implements github.com/bsm/grpclb/grpclb_backend_v1.LoadReportServer

func (*RateReporter) Score

func (r *RateReporter) Score() int64

Score returns the current load score

type Reporter

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

func NewReporter

func NewReporter() *Reporter

NewReporter creates a new Reporter

func (*Reporter) Increment

func (r *Reporter) Increment(n int64)

Increment allows to adjust load by a certain increment. Typical use case is e.g. the number of server connections, where Increment(1) is called on evert new connect and Increment(-1) on every disconnect.

func (*Reporter) Load

Load implements github.com/bsm/grpclb/grpclb_backend_v1.LoadReportServer

func (*Reporter) Reset

func (r *Reporter) Reset()

Reset resets the load to 0

func (*Reporter) Score

func (r *Reporter) Score() int64

Score returns the current load score

func (*Reporter) Set

func (r *Reporter) Set(n int64)

Set sets the load to a particular value

Jump to

Keyboard shortcuts

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