Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterMetrics(cfg *config.Config)
- type Node
- func (n *Node) CurrentConnections() uint32
- func (n *Node) CurrentLoad() uint32
- func (n *Node) CurrentPenalty() uint32
- func (n *Node) DecrementConnections()
- func (n *Node) Host() string
- func (n *Node) IncrementConnections()
- func (n *Node) IsActive() bool
- func (n *Node) Penalize()
- func (n *Node) ReplicaName() string
- func (n *Node) Scheme() string
- func (n *Node) SetIsActive(active bool)
- func (n *Node) StartHeartbeat(done <-chan struct{})
- func (n *Node) String() string
- type NodeOption
Constants ¶
View Source
const ( // prevents excess goroutine creating while penalizing overloaded host DefaultPenaltySize = 5 DefaultMaxSize = 300 DefaultPenaltyDuration = time.Second * 10 )
Variables ¶
View Source
var ( HostHealth *prometheus.GaugeVec HostPenalties *prometheus.CounterVec )
Functions ¶
func RegisterMetrics ¶
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) CurrentConnections ¶
func (*Node) CurrentLoad ¶
CurrentLoad returns the current node returns the number of open connections plus the penalty.
func (*Node) CurrentPenalty ¶
func (*Node) DecrementConnections ¶
func (n *Node) DecrementConnections()
func (*Node) IncrementConnections ¶
func (n *Node) IncrementConnections()
func (*Node) Penalize ¶
func (n *Node) Penalize()
Penalize a node if a request failed to decrease it's priority. If the penalty is already at the maximum allowed size this function will not penalize the node further. A function will be registered to run after the penalty duration to increase the priority again.
func (*Node) ReplicaName ¶
func (*Node) SetIsActive ¶
func (*Node) StartHeartbeat ¶
func (n *Node) StartHeartbeat(done <-chan struct{})
StartHeartbeat runs the heartbeat healthcheck against the node until the done channel is closed. If the heartbeat fails, the active status of the node is changed.
type NodeOption ¶
type NodeOption interface {
// contains filtered or unexported methods
}
func WithDefaultActiveState ¶
func WithDefaultActiveState(active bool) NodeOption
Click to show internal directories.
Click to hide internal directories.