Documentation
¶
Index ¶
- func ConfigureRoutes(api API) *httprouter.Router
- type API
- type APIImpl
- func (api *APIImpl) AggregatedMetrics(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) Help(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) Hostname(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (api *APIImpl) LbCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (api *APIImpl) LeaderCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (api *APIImpl) MemcacheConfig(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) MetricsHealth(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) RaftLeader(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (api *APIImpl) RaftState(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (api *APIImpl) ReadCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) RecentApps(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) ThrottleApp(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) ThrottledApps(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) UnthrottleApp(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) WriteCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- type GeneralResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureRoutes ¶
func ConfigureRoutes(api API) *httprouter.Router
ConfigureRoutes configures a set of HTTP routes to be actions dispatched by the given api's methods.
Types ¶
type API ¶
type API interface {
LbCheck(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
LeaderCheck(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
RaftLeader(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
RaftState(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
Hostname(w http.ResponseWriter, _ *http.Request, _ httprouter.Params)
WriteCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
ReadCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
AggregatedMetrics(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
MetricsHealth(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
ThrottleApp(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
UnthrottleApp(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
ThrottledApps(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
RecentApps(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
Help(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
MemcacheConfig(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
}
API exposes the contract for the throttler's web API
type APIImpl ¶
type APIImpl struct {
// contains filtered or unexported fields
}
APIImpl implements the API
func NewAPIImpl ¶
func NewAPIImpl(throttlerCheck *throttle.ThrottlerCheck, consensusService group.ConsensusService) *APIImpl
NewAPIImpl creates a new instance of the API implementation
func (*APIImpl) AggregatedMetrics ¶
func (api *APIImpl) AggregatedMetrics(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
AggregatedMetrics returns a snapshot of all current aggregated metrics
func (*APIImpl) Help ¶
func (api *APIImpl) Help(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ThrottledApps returns a snapshot of all currently throttled apps
func (*APIImpl) Hostname ¶
func (api *APIImpl) Hostname(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
Hostname returns the hostname this process executes on
func (*APIImpl) LbCheck ¶
func (api *APIImpl) LbCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
LbCheck responds to LbCheck with HTTP 200
func (*APIImpl) LeaderCheck ¶
func (api *APIImpl) LeaderCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
LeaderCheck responds with HTTP 200 when this node is a raft leader, otherwise 404 This is a useful check for HAProxy routing
func (*APIImpl) MemcacheConfig ¶
func (api *APIImpl) MemcacheConfig(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
MemcacheConfig outputs the memcache configuration being used, so clients can implement more efficient access strategies
func (*APIImpl) MetricsHealth ¶
func (api *APIImpl) MetricsHealth(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
MetricsHealth returns the time since last "OK" check per-metric
func (*APIImpl) RaftLeader ¶
func (api *APIImpl) RaftLeader(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
RaftLeader returns the identity of the leader
func (*APIImpl) RaftState ¶
func (api *APIImpl) RaftState(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
RaftState returns the state of the raft node
func (*APIImpl) ReadCheck ¶
func (api *APIImpl) ReadCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ReadCheck
func (*APIImpl) RecentApps ¶
func (api *APIImpl) RecentApps(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ThrottledApps returns a snapshot of all currently throttled apps
func (*APIImpl) ThrottleApp ¶
func (api *APIImpl) ThrottleApp(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ThrottleApp forcibly marks given app as throttled. Future requests by this app may be denied.
func (*APIImpl) ThrottledApps ¶
func (api *APIImpl) ThrottledApps(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ThrottledApps returns a snapshot of all currently throttled apps
func (*APIImpl) UnthrottleApp ¶
func (api *APIImpl) UnthrottleApp(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ThrottleApp unthrottles given app.
func (*APIImpl) WriteCheck ¶
func (api *APIImpl) WriteCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
WriteCheck
type GeneralResponse ¶
func NewGeneralResponse ¶
func NewGeneralResponse(statusCode int, message string) *GeneralResponse