outlier

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuleCheckSlotOrder = 6000
)
View Source
const (
	StatSlotOrder = 6000
)

Variables

View Source
var (
	DefaultMetricStatSlot = &MetricStatSlot{}
)
View Source
var (
	DefaultSlot = &Slot{}
)

Functions

func ClearRuleOfResource

func ClearRuleOfResource(res string) error

ClearRuleOfResource clears resource level rule in outlier ejection module.

func ClearRules

func ClearRules() error

ClearRules clear all the previous rules.

func IsValidRule

func IsValidRule(r *Rule) error

func LoadRuleOfResource

func LoadRuleOfResource(res string, rule *Rule) (bool, error)

LoadRuleOfResource loads the given resource's outlier ejection rule to the rule manager, while previous resource's rule will be replaced. the first returned value indicates whether do real load operation, if the rule is the same with previous resource's rule, return false

func LoadRules

func LoadRules(rules []*Rule) (bool, error)

LoadRules replaces old outlier ejection rules with the given rules.

return value:

bool: was designed to indicate whether the internal map has been changed error: was designed to indicate whether occurs the error.

func LogRuleUpdate

func LogRuleUpdate(rules map[string]*Rule)

Types

type MetricStatSlot

type MetricStatSlot struct {
}

MetricStatSlot records metrics for outlier ejection on invocation completed. MetricStatSlot must be filled into slot chain if outlier ejection is alive.

func (*MetricStatSlot) OnCompleted

func (c *MetricStatSlot) OnCompleted(ctx *base.EntryContext)

func (*MetricStatSlot) OnEntryBlocked

func (c *MetricStatSlot) OnEntryBlocked(_ *base.EntryContext, _ *base.BlockError)

func (*MetricStatSlot) OnEntryPassed

func (c *MetricStatSlot) OnEntryPassed(_ *base.EntryContext)

func (*MetricStatSlot) Order

func (s *MetricStatSlot) Order() uint32

type RecoveryCheckFunc

type RecoveryCheckFunc func(address string) bool

type Recycler

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

Recycler recycles node instance that have been invalidated for a long time

type Retryer

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

Each service should have its own Retryer to proactively retry in case of node failure.

type Rule

type Rule struct {
	*circuitbreaker.Rule

	// Whether to enable active detection mode for recovery.
	// Enabling active detection mode will disable passive detection.
	EnableActiveRecovery bool

	// An upper limit on the percentage of nodes to be excluded from the
	// service's load balancing pool.
	MaxEjectionPercent float64

	// The initial value of the time interval (in ms) to resume detection.
	RecoveryIntervalMs uint32

	// The time interval (in seconds) for node recycling。
	RecycleIntervalS uint32

	// Maximum number of recovery attempts allowed during recovery detection.
	MaxRecoveryAttempts uint32

	// RecoveryCheckFunc is used to determine whether a node is healthy in
	// the active recovery mode.
	RecoveryCheckFunc RecoveryCheckFunc
}

Rule encompasses the fields of outlier ejection rule.

func GetRules

func GetRules() []Rule

GetRules returns all the rules based on copy. It doesn't take effect for outlier ejection module if user changes the rule. GetRules need to compete outlier ejection module's global lock and the high performance losses of copy,

reduce or do not call GetRules if possible

type Slot

type Slot struct {
}

func (*Slot) Check

func (s *Slot) Check(ctx *base.EntryContext) *base.TokenResult

func (*Slot) Order

func (s *Slot) Order() uint32

Jump to

Keyboard shortcuts

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