Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLoadBalancedClient ¶
func NewLoadBalancedClient(niClients []client.Client, max int, timeout time.Duration, mids ...Middleware) client.Client
NewLoadBalancerClient creates a round-robin balancer of the clients passed in parameter. The balancer behaves identically to a regular influx client. `timeout` specifies the timeout before giving up on a client and retrying, `max` is the max number of retries before failing, `qpsLimit` is the hard limit on the number of queries per second the load balancer will accept, `qpsQueued` is the number of queries per second before the load balancer starts queuing the queries. The load balancer implements the breaker pattern (Not flexible yet. TODO)
Types ¶
type ErrorAggregation ¶
type ErrorAggregation struct {
// contains filtered or unexported fields
}
An error aggregation is required for close operations, which ripple through all balanced clients. It simply aggregates all the errors produced by all clients by name. (Experimental! Could be subject to change)
func (ErrorAggregation) Add ¶
func (aggr ErrorAggregation) Add(err error) ErrorAggregation
Returns a new aggregator with the added (name, error)
func (ErrorAggregation) Error ¶
func (aggr ErrorAggregation) Error() (err string)
Returns a string representation of all errors each on a new line
type InfluxMiddleware ¶
type InfluxMiddleware func(client client.Client) client.Client
Middleware acting differently for each function e.g. logging.
type Middleware ¶
type Middleware = endpoint.Middleware
Middleware that applies to the whole client e.g. throttler, limiter, breaker...
func NewCircuitBreaker ¶
func NewCircuitBreaker() Middleware
func NewTokenBucketLimiter ¶
func NewTokenBucketLimiter(rate float64, capacity int64) Middleware
func NewTokenBucketThrottler ¶
func NewTokenBucketThrottler(rate float64, capacity int64) Middleware