Documentation ¶
Overview ¶
Package api contains the telemetry of the Cluster Agent API and implements the forwarding of queries from Cluster Agent followers to the leader.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGlobalLeaderForwarder ¶
func NewGlobalLeaderForwarder(apiPort, maxConnections int)
NewGlobalLeaderForwarder initializes the global LeaderForwarder instance
func WithTelemetryWrapper ¶
func WithTelemetryWrapper(handlerName string, handler func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
WithTelemetryWrapper returns a http handler function that emits telemetry.
Types ¶
type LeaderForwarder ¶
type LeaderForwarder struct {
// contains filtered or unexported fields
}
LeaderForwarder allows to forward queries from follower to leader
func GetGlobalLeaderForwarder ¶
func GetGlobalLeaderForwarder() *LeaderForwarder
GetGlobalLeaderForwarder returns the global LeaderForwarder instance
func NewLeaderForwarder ¶
func NewLeaderForwarder(apiPort, maxConnections int) *LeaderForwarder
NewLeaderForwarder initializes a new LeaderForwarder instance and is used for test purposes
func (*LeaderForwarder) Forward ¶
func (lf *LeaderForwarder) Forward(rw http.ResponseWriter, req *http.Request)
Forward forwards a query to leader if available
func (*LeaderForwarder) SetLeaderIP ¶
func (lf *LeaderForwarder) SetLeaderIP(leaderIP string)
SetLeaderIP allows to change the target leader IP
type TelemetryHandler ¶
type TelemetryHandler struct {
// contains filtered or unexported fields
}
TelemetryHandler provides a http handler and emits requests telemetry for it.