Documentation
¶
Index ¶
- Constants
- Variables
- func ClearRules() error
- func CurrentCpuUsage() float64
- func CurrentLoad() float64
- func InitCollector(intervalMs uint32)
- func IsValidSystemRule(rule *Rule) error
- func LoadRules(rules []*Rule) (bool, error)
- type AdaptiveSlot
- type AdaptiveStrategy
- type MetricType
- type Rule
- type RuleMap
Constants ¶
View Source
const (
RuleCheckSlotName = "sentinel-core-system-adaptive-rule-check-slot"
)
Variables ¶
View Source
var (
DefaultAdaptiveSlot = &AdaptiveSlot{}
)
Functions ¶
func CurrentCpuUsage ¶
func CurrentCpuUsage() float64
func CurrentLoad ¶
func CurrentLoad() float64
func InitCollector ¶
func InitCollector(intervalMs uint32)
func IsValidSystemRule ¶
IsValidSystemRule determine the system rule is valid or not
Types ¶
type AdaptiveSlot ¶ added in v0.6.1
type AdaptiveSlot struct { }
func (*AdaptiveSlot) Check ¶ added in v0.6.1
func (s *AdaptiveSlot) Check(ctx *base.EntryContext) *base.TokenResult
func (*AdaptiveSlot) Name ¶ added in v1.0.0
func (s *AdaptiveSlot) Name() string
type AdaptiveStrategy ¶
type AdaptiveStrategy int32
const ( NoAdaptive AdaptiveStrategy = -1 // 1 BBR AdaptiveStrategy = iota )
func (AdaptiveStrategy) String ¶
func (t AdaptiveStrategy) String() string
type MetricType ¶
type MetricType uint32
const ( // Load represents system load1 in Linux/Unix. Load MetricType = iota // AvgRT represents the average response time of all inbound requests. AvgRT // Concurrency represents the concurrency of all inbound requests. Concurrency InboundQPS CpuUsage // MetricTypeSize indicates the enum size of MetricType. MetricTypeSize )
func (MetricType) String ¶
func (t MetricType) String() string
type Rule ¶ added in v0.6.1
type Rule struct { ID string `json:"id,omitempty"` MetricType MetricType `json:"metricType"` TriggerCount float64 `json:"triggerCount"` Strategy AdaptiveStrategy `json:"strategy"` }
func GetRules ¶
func GetRules() []Rule
GetRules returns all the rules based on copy. It doesn't take effect for system module if user changes the rule. GetRules need to compete system module's global lock and the high performance losses of copy,
reduce or do not call GetRules if possible
func (*Rule) ResourceName ¶ added in v0.6.1
type RuleMap ¶
type RuleMap map[MetricType][]*Rule
Click to show internal directories.
Click to hide internal directories.