Documentation ¶
Index ¶
- Constants
- Variables
- func FlushCircuitByKey(key string)
- func GetCBCacheKey(serviceName, serviceType string) string
- func GetCircuitName(sourceName, serviceName string) string
- func GetNames(key string) (string, string)
- func GetQPSRate(rateConfig string) (int, bool)
- func GetQPSRateWithPriority(cmd ...string) (int, string)
- func Init()
- func RegisterKeys(eventListener event.Listener, keys ...string)
- func SaveToCBCache(raw *model.HystrixConfig)
- func SaveToLBCache(raw *model.LoadBalancing)
- type CircuitBreakerEventListener
- type ConsumerKeys
- type LagerEventListener
- type LoadBalancingEventListener
- type Panel
- func (p *Panel) GetCircuitBreaker(inv invocation.Invocation, serviceType string) (string, hystrix.CommandConfig)
- func (p *Panel) GetEgressRule() []control.EgressConfig
- func (p *Panel) GetFaultInjection(inv invocation.Invocation) model.Fault
- func (p *Panel) GetLoadBalancing(inv invocation.Invocation) control.LoadBalancingConfig
- func (p *Panel) GetRateLimiting(inv invocation.Invocation, serviceType string) control.RateLimitingConfig
- type ProviderKeys
- type QPSEventListener
Constants ¶
const ( // ConsumerIsolationKey is a variable of type string ConsumerIsolationKey = "cse.isolation" ConsumerCircuitBreakerKey = "cse.circuitBreaker" ConsumerFallbackKey = "cse.fallback" ConsumerFallbackPolicyKey = "cse.fallbackpolicy" )
constants for consumer isolation, circuit breaker, fallback keys
const (
//LagerLevelKey is a variable of type string
LagerLevelKey = "logLevel"
)
const (
//LoadBalanceKey is variable of type string that matches load balancing events
LoadBalanceKey = "^cse\\.loadbalance\\."
)
constants for loadbalancer strategy name, and timeout
const Prefix = "cse.flowcontrol"
Prefix is const
Variables ¶
var ( //key is service name LBConfigCache = cache.New(0, 0) //key is [Provider|Consumer]:service_name or [Consumer|Provider] CBConfigCache = cache.New(0, 0) RLConfigCache = cache.New(0, 0) EgressConfigCache = cache.New(0, 0) FIConfigCache = cache.New(0, 0) )
save configs
var ( DefaultLB = control.LoadBalancingConfig{ Strategy: loadbalancer.StrategyRoundRobin, BackOffKind: retry.DefaultBackOffKind, } )
Default values
Functions ¶
func FlushCircuitByKey ¶ added in v2.0.3
func FlushCircuitByKey(key string)
FlushCircuitByKey is a function used to flush for a particular key
func GetCBCacheKey ¶
GetCBCacheKey generate cache key
func GetCircuitName ¶ added in v2.0.3
GetCircuitName is a function used to get circuit names
func GetQPSRateWithPriority ¶
GetQPSRateWithPriority get qps rate with priority
func RegisterKeys ¶ added in v2.0.3
RegisterKeys registers a config key to the archaius
Types ¶
type CircuitBreakerEventListener ¶ added in v2.0.3
type CircuitBreakerEventListener struct {
Key string
}
CircuitBreakerEventListener is a struct with one string variable
func (*CircuitBreakerEventListener) Event ¶ added in v2.0.3
func (el *CircuitBreakerEventListener) Event(e *event.Event)
Event is a method which triggers flush circuit
type ConsumerKeys ¶
type ConsumerKeys struct { MicroServiceName string SchemaQualifiedName string OperationQualifiedName string }
ConsumerKeys contain consumer keys
func GetConsumerKey ¶
func GetConsumerKey(sourceName, serviceName, schemaID, OperationID string) *ConsumerKeys
GetConsumerKey get specific key for consumer
func (*ConsumerKeys) GetMicroServiceName ¶
func (op *ConsumerKeys) GetMicroServiceName() string
GetMicroServiceName get micro-service name
func (*ConsumerKeys) GetMicroServiceSchemaOpQualifiedName ¶
func (op *ConsumerKeys) GetMicroServiceSchemaOpQualifiedName() string
GetMicroServiceSchemaOpQualifiedName get micro-service schema operation qualified name
func (*ConsumerKeys) GetSchemaQualifiedName ¶
func (op *ConsumerKeys) GetSchemaQualifiedName() string
GetSchemaQualifiedName get schema qualified name
type LagerEventListener ¶ added in v2.0.3
type LagerEventListener struct { //Key []string Key string }
LagerEventListener is a struct used for Event listener
func (*LagerEventListener) Event ¶ added in v2.0.3
func (el *LagerEventListener) Event(e *event.Event)
Event is a method for Lager event listening
type LoadBalancingEventListener ¶ added in v2.0.3
type LoadBalancingEventListener struct {
Key string
}
LoadBalancingEventListener is a struct
func (*LoadBalancingEventListener) Event ¶ added in v2.0.3
func (e *LoadBalancingEventListener) Event(evt *event.Event)
Event is a method used to handle a load balancing event
type Panel ¶
type Panel struct { }
Panel pull configs from archaius
func (*Panel) GetCircuitBreaker ¶
func (p *Panel) GetCircuitBreaker(inv invocation.Invocation, serviceType string) (string, hystrix.CommandConfig)
GetCircuitBreaker return command , and circuit breaker settings
func (*Panel) GetEgressRule ¶
func (p *Panel) GetEgressRule() []control.EgressConfig
GetEgressRule get egress config
func (*Panel) GetFaultInjection ¶
func (p *Panel) GetFaultInjection(inv invocation.Invocation) model.Fault
GetFaultInjection get Fault injection config
func (*Panel) GetLoadBalancing ¶
func (p *Panel) GetLoadBalancing(inv invocation.Invocation) control.LoadBalancingConfig
GetLoadBalancing get load balancing config
func (*Panel) GetRateLimiting ¶
func (p *Panel) GetRateLimiting(inv invocation.Invocation, serviceType string) control.RateLimitingConfig
GetRateLimiting get rate limiting config
type ProviderKeys ¶
ProviderKeys contain provider keys
func GetProviderKey ¶
func GetProviderKey(sourceServiceName string) *ProviderKeys
GetProviderKey get specific key for provider
type QPSEventListener ¶ added in v2.0.3
type QPSEventListener struct { //Key []string Key string }
QPSEventListener is a struct used for Event listener
func (*QPSEventListener) Event ¶ added in v2.0.3
func (el *QPSEventListener) Event(e *event.Event)
Event is a method for QPS event listening