Documentation ¶
Index ¶
- func Filter(localityLbEndpoints []*envoy_config_endpoint_v3.LocalityLbEndpoints, ...) []*envoy_config_endpoint_v3.Endpoint
- func GetAddress(ep *envoy_config_endpoint_v3.Endpoint) net.Addr
- func GetClusterLoadAssignmentReference(cluster *envoy_config_cluster_v3.Cluster) string
- func GetClusterLoadAssignmentReferences(clusters []*envoy_config_cluster_v3.Cluster) []string
- func GetLoadBalancingWeight(ep *envoy_config_endpoint_v3.LbEndpoint) uint32
- func GetLoadDistribution(localityLbEndpoints []*envoy_config_endpoint_v3.LocalityLbEndpoints, ...) map[string]float64
- func HasSocketAddress() *endpointWithSocketAddressFilter
- func IsHealthy(ep *envoy_config_endpoint_v3.LbEndpoint) bool
- func LoadBalancingWeightsAreEqual(endpoints []*envoy_config_endpoint_v3.LocalityLbEndpoints) bool
- func WithHealthyStatus() *healthyEndpointFilter
- func WithSocketAddress(address *net.TCPAddr) *endpointWithSocketAddressFilter
- type EndpointsStats
- func (eps *EndpointsStats) ActiveRequestsCount(endpointAddress string) uint32
- func (eps *EndpointsStats) DecActiveRequestsCount(endpointAddress string)
- func (eps *EndpointsStats) IncActiveRequestsCount(endpointAddress string)
- func (eps *EndpointsStats) IncRoundRobinCount(endpointAddress string)
- func (eps *EndpointsStats) ResetActiveRequestsCount(endpointAddress string)
- func (eps *EndpointsStats) ResetRoundRobinCount(endpointAddress string)
- func (eps *EndpointsStats) RoundRobinCount(endpointAddress string) uint32
- func (eps *EndpointsStats) SetActiveRequestsCount(endpointAddress string, activeRequestsCount uint32)
- type LbEndpointsFilterOption
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
func Filter(localityLbEndpoints []*envoy_config_endpoint_v3.LocalityLbEndpoints, opts ...LbEndpointsFilterOption) []*envoy_config_endpoint_v3.Endpoint
func GetAddress ¶
func GetAddress(ep *envoy_config_endpoint_v3.Endpoint) net.Addr
func GetClusterLoadAssignmentReference ¶
func GetClusterLoadAssignmentReference(cluster *envoy_config_cluster_v3.Cluster) string
func GetClusterLoadAssignmentReferences ¶
func GetClusterLoadAssignmentReferences(clusters []*envoy_config_cluster_v3.Cluster) []string
GetClusterLoadAssignmentReferences returns the ClusterLoadAssignment names that references the provided clusters
func GetLoadBalancingWeight ¶
func GetLoadBalancingWeight(ep *envoy_config_endpoint_v3.LbEndpoint) uint32
func GetLoadDistribution ¶
func GetLoadDistribution(localityLbEndpoints []*envoy_config_endpoint_v3.LocalityLbEndpoints, endpointsStats *EndpointsStats, overProvisioningFactor, activeRequestBias float64) map[string]float64
GetLoadDistribution computes the load distribution for healthy endpoints taking into account priority level and locality load distribution If the activeRequestBias is >= 0.0 than adjust effective endpoint weights based on active requests according to the formula described at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancers#weighted-least-request
func HasSocketAddress ¶
func HasSocketAddress() *endpointWithSocketAddressFilter
func IsHealthy ¶
func IsHealthy(ep *envoy_config_endpoint_v3.LbEndpoint) bool
IsHealthy returns true if the given endpoint is healthy
func LoadBalancingWeightsAreEqual ¶
func LoadBalancingWeightsAreEqual(endpoints []*envoy_config_endpoint_v3.LocalityLbEndpoints) bool
LoadBalancingWeightsAreEqual returns true if the weights of all the endpoints are equal
func WithHealthyStatus ¶
func WithHealthyStatus() *healthyEndpointFilter
func WithSocketAddress ¶
Types ¶
type EndpointsStats ¶
type EndpointsStats struct { *util.KeyValueCollection[string, *Stats] }
EndpointsStats stores Stats for a collection of endpoints
func NewEndpointsStats ¶
func NewEndpointsStats() *EndpointsStats
func (*EndpointsStats) ActiveRequestsCount ¶
func (eps *EndpointsStats) ActiveRequestsCount(endpointAddress string) uint32
ActiveRequestsCount returns the number of active requests the endpoint with given address has.
func (*EndpointsStats) DecActiveRequestsCount ¶
func (eps *EndpointsStats) DecActiveRequestsCount(endpointAddress string)
func (*EndpointsStats) IncActiveRequestsCount ¶
func (eps *EndpointsStats) IncActiveRequestsCount(endpointAddress string)
func (*EndpointsStats) IncRoundRobinCount ¶
func (eps *EndpointsStats) IncRoundRobinCount(endpointAddress string)
func (*EndpointsStats) ResetActiveRequestsCount ¶
func (eps *EndpointsStats) ResetActiveRequestsCount(endpointAddress string)
func (*EndpointsStats) ResetRoundRobinCount ¶
func (eps *EndpointsStats) ResetRoundRobinCount(endpointAddress string)
func (*EndpointsStats) RoundRobinCount ¶
func (eps *EndpointsStats) RoundRobinCount(endpointAddress string) uint32
RoundRobinCount returns the number of times the endpoint with the given address was selected by weighted round-robin load balancing
func (*EndpointsStats) SetActiveRequestsCount ¶
func (eps *EndpointsStats) SetActiveRequestsCount(endpointAddress string, activeRequestsCount uint32)
type LbEndpointsFilterOption ¶
type LbEndpointsFilterOption interface {
Filter(ep *envoy_config_endpoint_v3.LbEndpoint) bool
}
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Stats stores various items related to a service endpoint
func (*Stats) ActiveRequestsCount ¶
ActiveRequestsCount returns the number of active requests the endpoint has.
func (*Stats) RoundRobinCount ¶
RoundRobinCount returns the number of times the endpoint was selected by weighted round-robin load balancing