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) ConsensusLeader(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (api *APIImpl) ConsensusState(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (api *APIImpl) ConsensusStatus(w http.ResponseWriter, r *http.Request, _ 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) ReadCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) ReadCheckIfExists(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) RecoverHost(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) SkipHost(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (api *APIImpl) SkippedHosts(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)
- func (api *APIImpl) WriteCheckIfExists(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) ConsensusLeader(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) ConsensusState(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) ConsensusStatus(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) Hostname(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) WriteCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params) WriteCheckIfExists(w http.ResponseWriter, r *http.Request, _ httprouter.Params) ReadCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params) ReadCheckIfExists(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) SkipHost(w http.ResponseWriter, r *http.Request, _ httprouter.Params) SkippedHosts(w http.ResponseWriter, r *http.Request, _ httprouter.Params) RecoverHost(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) ConsensusLeader ¶
func (api *APIImpl) ConsensusLeader(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
ConsensusLeader returns the identity of the leader
func (*APIImpl) ConsensusState ¶
func (api *APIImpl) ConsensusState(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
ConsensusLeader returns the consensus state of this node
func (*APIImpl) ConsensusStatus ¶
func (api *APIImpl) ConsensusStatus(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
ConsensusLeader returns the consensus state of this node
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) ReadCheck ¶
func (api *APIImpl) ReadCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ReadCheck
func (*APIImpl) ReadCheckIfExists ¶
func (api *APIImpl) ReadCheckIfExists(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
ReadCheckIfExists checks for a metric, but reports an OK if the metric does not exist. If the metric does exist, then all usual checks are made.
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) RecoverHost ¶ added in v1.3.0
func (api *APIImpl) RecoverHost(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*APIImpl) SkipHost ¶ added in v1.3.0
func (api *APIImpl) SkipHost(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*APIImpl) SkippedHosts ¶ added in v1.3.0
func (api *APIImpl) SkippedHosts(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
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)
UnthrottleApp unthrottles given app.
func (*APIImpl) WriteCheck ¶
func (api *APIImpl) WriteCheck(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
WriteCheck
func (*APIImpl) WriteCheckIfExists ¶
func (api *APIImpl) WriteCheckIfExists(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
WriteCheckIfExists checks for a metric, but reports an OK if the metric does not exist. If the metric does exist, then all usual checks are made.
type GeneralResponse ¶
func NewGeneralResponse ¶
func NewGeneralResponse(statusCode int, message string) *GeneralResponse