Documentation
¶
Index ¶
- Constants
- Variables
- type CheckFlags
- type CheckResult
- type Throttler
- func (throttler *Throttler) AppRequestMetricResult(appName string, storeName string, metricResultFunc base.MetricResultFunc, ...) (metricResult base.MetricResult, threshold float64)
- func (throttler *Throttler) IsAppThrottled(appName, storeName string) bool
- func (throttler *Throttler) Operate()
- func (throttler *Throttler) RecentAppsMap() (result map[string](*base.RecentApp))
- func (throttler *Throttler) RecoverHost(hostName string)
- func (throttler *Throttler) SetLeaderFunc(isLeaderFunc func() bool)
- func (throttler *Throttler) SetSharedDomainServicesFunc(sharedDomainServicesFunc func() (map[string]string, error))
- func (throttler *Throttler) SkipHost(hostName string, expireAt time.Time)
- func (throttler *Throttler) SkippedHostsMap() map[string]time.Time
- func (throttler *Throttler) ThrottleApp(appName string, expireAt time.Time, ratio float64)
- func (throttler *Throttler) ThrottledAppsMap() (result map[string](*base.AppThrottle))
- func (throttler *Throttler) ThrottledAppsSnapshot() map[string]cache.Item
- func (throttler *Throttler) UnthrottleApp(appName string)
- type ThrottlerCheck
- func (check *ThrottlerCheck) AggregatedMetrics() map[string]base.MetricResult
- func (check *ThrottlerCheck) Check(appName string, storeType string, storeName string, remoteAddr string, ...) (checkResult *CheckResult)
- func (check *ThrottlerCheck) MetricsHealth() map[string](*base.MetricHealth)
- func (check *ThrottlerCheck) SelfChecks()
Constants ¶
View Source
const DefaultSkipTTLMinutes = 60
View Source
const DefaultThrottleRatio = 1.0
View Source
const DefaultThrottleTTLMinutes = 60
Variables ¶
View Source
var NoSuchMetricCheckResult = NewErrorCheckResult(http.StatusNotFound, base.NoSuchMetricError)
View Source
var StandardCheckFlags = &CheckFlags{}
Functions ¶
This section is empty.
Types ¶
type CheckFlags ¶
type CheckResult ¶
type CheckResult struct { StatusCode int `json:"StatusCode"` Value float64 `json:"Value"` Threshold float64 `json:"Threshold"` Error error `json:"-"` Message string `json:"Message"` }
CheckResult is the result for an app inquiring on a metric. It also exports as JSON via the API
func NewCheckResult ¶
func NewCheckResult(statusCode int, value float64, threshold float64, err error) *CheckResult
func NewErrorCheckResult ¶
func NewErrorCheckResult(statusCode int, err error) *CheckResult
type Throttler ¶
type Throttler struct {
// contains filtered or unexported fields
}
func NewThrottler ¶
func NewThrottler() *Throttler
func (*Throttler) AppRequestMetricResult ¶
func (throttler *Throttler) AppRequestMetricResult(appName string, storeName string, metricResultFunc base.MetricResultFunc, denyApp bool) (metricResult base.MetricResult, threshold float64)
func (*Throttler) IsAppThrottled ¶
func (*Throttler) RecentAppsMap ¶
func (*Throttler) RecoverHost ¶ added in v1.3.0
func (*Throttler) SetLeaderFunc ¶
func (*Throttler) SetSharedDomainServicesFunc ¶
func (*Throttler) SkippedHostsMap ¶ added in v1.3.0
func (*Throttler) ThrottleApp ¶
func (*Throttler) ThrottledAppsMap ¶
func (throttler *Throttler) ThrottledAppsMap() (result map[string](*base.AppThrottle))
func (*Throttler) ThrottledAppsSnapshot ¶
func (*Throttler) UnthrottleApp ¶
type ThrottlerCheck ¶
type ThrottlerCheck struct {
// contains filtered or unexported fields
}
ThrottlerCheck provides methdos for an app checking on metrics
func NewThrottlerCheck ¶
func NewThrottlerCheck(throttler *Throttler) *ThrottlerCheck
func (*ThrottlerCheck) AggregatedMetrics ¶
func (check *ThrottlerCheck) AggregatedMetrics() map[string]base.MetricResult
AggregatedMetrics is a convenience acces method into throttler's `aggregatedMetricsSnapshot`
func (*ThrottlerCheck) Check ¶
func (check *ThrottlerCheck) Check(appName string, storeType string, storeName string, remoteAddr string, flags *CheckFlags) (checkResult *CheckResult)
CheckAppStoreMetric
func (*ThrottlerCheck) MetricsHealth ¶
func (check *ThrottlerCheck) MetricsHealth() map[string](*base.MetricHealth)
MetricsHealth is a convenience acces method into throttler's `metricsHealthSnapshot`
func (*ThrottlerCheck) SelfChecks ¶
func (check *ThrottlerCheck) SelfChecks()
Click to show internal directories.
Click to hide internal directories.