outlierdetection

package
v1.68.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package outlierdetection provides an implementation of the outlier detection LB policy, as defined in https://github.com/grpc/proposal/blob/master/A50-xds-outlier-detection.md.

Index

Constants

View Source
const Name = "outlier_detection_experimental"

Name is the name of the outlier detection balancer.

Variables

This section is empty.

Functions

This section is empty.

Types

type FailurePercentageEjection

type FailurePercentageEjection struct {
	// Threshold is the failure percentage to use when determining failure
	// percentage-based outlier detection. If the failure percentage of a given
	// host is greater than or equal to this value, it will be ejected. Defaults
	// to 85.
	Threshold uint32 `json:"threshold,omitempty"`
	// EnforcementPercentage is the % chance that a host will be actually
	// ejected when an outlier status is detected through failure percentage
	// statistics. This setting can be used to disable ejection or to ramp it up
	// slowly. Defaults to 0.
	EnforcementPercentage uint32 `json:"enforcementPercentage,omitempty"`
	// MinimumHosts is the minimum number of hosts in a cluster in order to
	// perform failure percentage-based ejection. If the total number of hosts
	// in the cluster is less than this value, failure percentage-based ejection
	// will not be performed. Defaults to 5.
	MinimumHosts uint32 `json:"minimumHosts,omitempty"`
	// RequestVolume is the minimum number of total requests that must be
	// collected in one interval (as defined by the interval duration above) to
	// perform failure percentage-based ejection for this host. If the volume is
	// lower than this setting, failure percentage-based ejection will not be
	// performed for this host. Defaults to 50.
	RequestVolume uint32 `json:"requestVolume,omitempty"`
}

FailurePercentageEjection is parameters for the failure percentage algorithm. This algorithm ejects individual endpoints whose failure rate is greater than some threshold, independently of any other endpoint.

func (*FailurePercentageEjection) Equal

Equal returns whether the FailurePercentageEjection is the same with the parameter.

func (*FailurePercentageEjection) UnmarshalJSON added in v1.56.0

func (fpe *FailurePercentageEjection) UnmarshalJSON(j []byte) error

UnmarshalJSON unmarshals JSON into FailurePercentageEjection. If a FailurePercentageEjection field is not set, that field will get its default value.

type LBConfig

type LBConfig struct {
	serviceconfig.LoadBalancingConfig `json:"-"`
	// Interval is the time interval between ejection analysis sweeps. This can
	// result in both new ejections as well as addresses being returned to
	// service. Defaults to 10s.
	Interval iserviceconfig.Duration `json:"interval,omitempty"`
	// BaseEjectionTime is the base time that a host is ejected for. The real
	// time is equal to the base time multiplied by the number of times the host
	// has been ejected and is capped by MaxEjectionTime. Defaults to 30s.
	BaseEjectionTime iserviceconfig.Duration `json:"baseEjectionTime,omitempty"`
	// MaxEjectionTime is the maximum time that an address is ejected for. If
	// not specified, the default value (300s) or the BaseEjectionTime value is
	// applied, whichever is larger.
	MaxEjectionTime iserviceconfig.Duration `json:"maxEjectionTime,omitempty"`
	// MaxEjectionPercent is the maximum % of an upstream cluster that can be
	// ejected due to outlier detection. Defaults to 10% but will eject at least
	// one host regardless of the value.
	MaxEjectionPercent uint32 `json:"maxEjectionPercent,omitempty"`
	// SuccessRateEjection is the parameters for the success rate ejection
	// algorithm. If set, success rate ejections will be performed.
	SuccessRateEjection *SuccessRateEjection `json:"successRateEjection,omitempty"`
	// FailurePercentageEjection is the parameters for the failure percentage
	// algorithm. If set, failure rate ejections will be performed.
	FailurePercentageEjection *FailurePercentageEjection `json:"failurePercentageEjection,omitempty"`
	// ChildPolicy is the config for the child policy.
	ChildPolicy *iserviceconfig.BalancerConfig `json:"childPolicy,omitempty"`
}

LBConfig is the config for the outlier detection balancer.

func (*LBConfig) EqualIgnoringChildPolicy

func (lbc *LBConfig) EqualIgnoringChildPolicy(lbc2 *LBConfig) bool

EqualIgnoringChildPolicy returns whether the LBConfig is same with the parameter outside of the child policy, only comparing the Outlier Detection specific configuration.

func (*LBConfig) UnmarshalJSON added in v1.56.0

func (lbc *LBConfig) UnmarshalJSON(j []byte) error

UnmarshalJSON unmarshals JSON into LBConfig. If a top level LBConfig field (i.e. not next layer sre or fpe) is not set, that field will get its default value. If sre or fpe is not set, it will stay unset, otherwise it will unmarshal on those types populating with default values for their fields if needed.

type SuccessRateEjection

type SuccessRateEjection struct {
	// StddevFactor is used to determine the ejection threshold for
	// success rate outlier ejection. The ejection threshold is the difference
	// between the mean success rate, and the product of this factor and the
	// standard deviation of the mean success rate: mean - (stdev *
	// success_rate_stdev_factor). This factor is divided by a thousand to get a
	// double. That is, if the desired factor is 1.9, the runtime value should
	// be 1900. Defaults to 1900.
	StdevFactor uint32 `json:"stdevFactor,omitempty"`
	// EnforcementPercentage is the % chance that a host will be actually ejected
	// when an outlier status is detected through success rate statistics. This
	// setting can be used to disable ejection or to ramp it up slowly. Defaults
	// to 100.
	EnforcementPercentage uint32 `json:"enforcementPercentage,omitempty"`
	// MinimumHosts is the number of hosts in a cluster that must have enough
	// request volume to detect success rate outliers. If the number of hosts is
	// less than this setting, outlier detection via success rate statistics is
	// not performed for any host in the cluster. Defaults to 5.
	MinimumHosts uint32 `json:"minimumHosts,omitempty"`
	// RequestVolume is the minimum number of total requests that must be
	// collected in one interval (as defined by the interval duration above) to
	// include this host in success rate based outlier detection. If the volume
	// is lower than this setting, outlier detection via success rate statistics
	// is not performed for that host. Defaults to 100.
	RequestVolume uint32 `json:"requestVolume,omitempty"`
}

SuccessRateEjection is parameters for the success rate ejection algorithm. This algorithm monitors the request success rate for all endpoints and ejects individual endpoints whose success rates are statistical outliers.

func (*SuccessRateEjection) Equal

func (sre *SuccessRateEjection) Equal(sre2 *SuccessRateEjection) bool

Equal returns whether the SuccessRateEjection is the same with the parameter.

func (*SuccessRateEjection) UnmarshalJSON added in v1.56.0

func (sre *SuccessRateEjection) UnmarshalJSON(j []byte) error

UnmarshalJSON unmarshals JSON into SuccessRateEjection. If a SuccessRateEjection field is not set, that field will get its default value.

Jump to

Keyboard shortcuts

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