dagor

package
v0.0.0-...-e391fcb Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHistogramDifference

func GetHistogramDifference(earlier, later metrics.Float64Histogram) metrics.Float64Histogram

To extract the difference between two Float64Histogram distributions, and return a new Float64Histogram you can subtract the corresponding bucket counts of the two histograms. If the earlier histogram is from an empty pointer, return the later histogram Ensure the two histograms have the same number of buckets

Types

type CounterMatrix

type CounterMatrix struct {
	Counters [][]*int64
}

CounterMatrix holds a 2D slice of atomic counters

func NewCounterMatrix

func NewCounterMatrix(bMax, uMax int) *CounterMatrix

NewCounterMatrix initializes a CounterMatrix with the given dimensions

func (*CounterMatrix) Get

func (m *CounterMatrix) Get(B, U int) int64

Get safely retrieves the current value of the counter at the given B and U indices

func (*CounterMatrix) Increment

func (m *CounterMatrix) Increment(B, U int)

Increment safely increments the counter at the given B and U indices

func (*CounterMatrix) Reset

func (m *CounterMatrix) Reset()

Reset sets all counters in the matrix to zero

type Dagor

type Dagor struct {
	Umax       int
	Bmax       int
	C          sync.Map
	N          int64 // Use int64 to be compatible with atomic operations
	Nadm       int64 // Use int64 to be compatible with atomic operations
	UseSyncMap bool
	CM         *CounterMatrix
	// contains filtered or unexported fields
}

Dagor is the DAGOR network.

func NewDagorNode

func NewDagorNode(params DagorParam) *Dagor

NewDagorNode creates a new DAGOR node without a UUID.

func (*Dagor) CalculateAdmissionLevel

func (d *Dagor) CalculateAdmissionLevel(foverload bool) (int, int)

CalculateAdmissionLevel adjusts the B and U based on the overload flag

func (*Dagor) DecrementN

func (d *Dagor) DecrementN()

func (*Dagor) DecrementNadm

func (d *Dagor) DecrementNadm()

func (*Dagor) IncrementN

func (d *Dagor) IncrementN()

func (*Dagor) IncrementNadm

func (d *Dagor) IncrementNadm()

func (*Dagor) ReadN

func (d *Dagor) ReadN() int64

func (*Dagor) ReadNadm

func (d *Dagor) ReadNadm() int64

func (*Dagor) ResetHistogram

func (d *Dagor) ResetHistogram()

func (*Dagor) UnaryInterceptorClient

func (d *Dagor) UnaryInterceptorClient(ctx context.Context, method string, req interface{}, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

func (*Dagor) UnaryInterceptorServer

func (d *Dagor) UnaryInterceptorServer(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

func (*Dagor) UpdateAdmissionLevel

func (d *Dagor) UpdateAdmissionLevel()

overloadDetection is a function that detects overload and updates the threshold

func (*Dagor) UpdateHistogram

func (d *Dagor) UpdateHistogram(admitted bool, B, U int)

func (*Dagor) UpdateN

func (d *Dagor) UpdateN(newN int64)

func (*Dagor) UpdateNadm

func (d *Dagor) UpdateNadm(newN int64)

type DagorParam

type DagorParam struct {
	NodeName                     string
	BusinessMap                  map[string]int
	QueuingThresh                time.Duration
	EntryService                 bool
	IsEnduser                    bool
	AdmissionLevelUpdateInterval time.Duration
	Alpha                        float64
	Beta                         float64
	Umax                         int
	Bmax                         int
	Debug                        bool
	UseSyncMap                   bool
}

type ThresholdTable

type ThresholdTable struct {
	BStar int
	UStar int
}

Jump to

Keyboard shortcuts

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