Documentation ¶
Index ¶
- Constants
- Variables
- func BackOffKind(source, service string) string
- func BackOffMaxMs(source, service string) int
- func BackOffMinMs(source, service string) int
- func GetAPM() model.APMStruct
- func GetAbortPercent(protocol, microServiceName, schema, operation string) int
- func GetAbortStatus(protocol, microServiceName, schema, operation string) int
- func GetCircuitBreakerEnabled(command, t string) bool
- func GetCircuitBreakerEnabledKey(command string) string
- func GetConfigCenterConf() model.ConfigClient
- func GetContractDiscoveryAPIVersion() string
- func GetContractDiscoveryAddress() string
- func GetContractDiscoveryDisable() bool
- func GetContractDiscoveryTenant() string
- func GetContractDiscoveryType() string
- func GetDataCenter() *model.DataCenterInfo
- func GetDefaultCircuitBreakerEnabledKey(t string) string
- func GetDefaultErrorPercentThreshold(t string) string
- func GetDefaultFallbackPolicyKey(t string) string
- func GetDefaultForceCloseKey(t string) string
- func GetDefaultForceFallbackKey(t string) string
- func GetDefaultForceOpenKey(t string) string
- func GetDefaultGetFallbackEnabledKey(t string) string
- func GetDefaultMaxConcurrentKey(t string) string
- func GetDefaultRequestVolumeThresholdKey(t string) string
- func GetDefaultSleepWindowKey(t string) string
- func GetDefaultTimeoutKey(t string) string
- func GetDelayPercent(protocol, microServiceName, schema, operation string) int
- func GetErrorPercentThreshold(command, t string) int
- func GetErrorPercentThresholdKey(command string) string
- func GetFallbackEnabled(command, t string) bool
- func GetFallbackEnabledKey(command string) string
- func GetFallbackPolicyKey(command string) string
- func GetFaultAbortHTTPStatusKey(key, protocol string) string
- func GetFaultAbortPercentKey(key, protocol string) string
- func GetFaultDelayPercentKey(key, protocol string) string
- func GetFaultFixedDelayKey(key, protocol string) string
- func GetFaultInjectionGlobalKey() string
- func GetFaultInjectionOperationKey(microServiceName, schema, operation string) string
- func GetFaultInjectionSchemaKey(microServiceName, schema string) string
- func GetFaultInjectionServiceKey(microServiceName string) string
- func GetFilterNamesKey() string
- func GetFixedDelay(protocol, microServiceName, schema, operation string) time.Duration
- func GetForceClose(service, t string) bool
- func GetForceCloseKey(command string) string
- func GetForceFallback(service, t string) bool
- func GetForceFallbackKey(command string) string
- func GetForceOpen(service, t string) bool
- func GetForceOpenKey(command string) string
- func GetHystrixConfig() *model.HystrixConfig
- func GetHystrixSpecificKey(namespace, cmd, property string) string
- func GetLoadBalancing() *model.LoadBalancing
- func GetMaxConcurrentKey(command string) string
- func GetMaxConcurrentRequests(command, t string) int
- func GetPolicy(service, t string) string
- func GetRegistratorAPIVersion() string
- func GetRegistratorAddress() string
- func GetRegistratorAutoRegister() string
- func GetRegistratorDisable() bool
- func GetRegistratorScope() string
- func GetRegistratorTenant() string
- func GetRegistratorType() string
- func GetRequestVolumeThreshold(command, t string) int
- func GetRequestVolumeThresholdKey(command string) string
- func GetRetryOnNext(source, service string) int
- func GetRetryOnSame(source, service string) int
- func GetRouterEndpoints() string
- func GetRouterType() string
- func GetServerListFilters() (filters []string)
- func GetServiceDiscoveryAPIVersion() string
- func GetServiceDiscoveryAddress() string
- func GetServiceDiscoveryConfigPath() string
- func GetServiceDiscoveryDisable() bool
- func GetServiceDiscoveryHealthCheck() bool
- func GetServiceDiscoveryRefreshInterval() string
- func GetServiceDiscoveryTenant() string
- func GetServiceDiscoveryType() string
- func GetServiceDiscoveryWatch() bool
- func GetSessionTimeout(source, service string) int
- func GetSleepWindow(command, t string) int
- func GetSleepWindowKey(command string) string
- func GetStrategyName(source, service string) string
- func GetTimeout(service, t string) int
- func GetTimeoutDuration(service, t string) time.Duration
- func GetTimeoutDurationFromArchaius(service, t string) time.Duration
- func GetTimeoutKey(command string) string
- func GetTransportConf() model.Transport
- func Init() error
- func InitArchaius() error
- func ReadGlobalConfigFromArchaius() error
- func ReadHystrixFromArchaius() error
- func ReadLBFromArchaius() error
- func ReadMicroserviceConfigFromBytes(data []byte) error
- func ReadMonitorFromArchaius() error
- func ReadMonitorFromFile() error
- func RetryEnabled(source, service string) bool
- func StrategySuccessiveFailedTimes(source, service string) int
- type DarkLaunchRule
- type LimiterConfig
- type Match
- type MatchPolicy
- type OneServiceRule
- type Prefix
- type RouteRule
- type RouteTag
- type Router
- type RouterConfig
- type RuleItem
- type ServiceComb
Constants ¶
const ( DefaultForceFallback = false DefaultTimeoutEnabled = false DefaultConsumerCircuitBreakerEnabled = false DefaultProviderCircuitBreakerEnabled = false DefaultCircuitBreakerForceOpen = false DefaultCircuitBreakerForceClosed = false DefaultFallbackEnable = true DefaultMaxConcurrent = 1000 DefaultSleepWindow = 15000 DefaultTimeout = 30000 DefaultErrorPercentThreshold = 50 DefaultRequestVolumeThreshold = 20 PolicyNull = "returnnull" PolicyThrowException = "throwexception" )
constant for hystrix parameters
const ( DefaultAbortPercent = 0 DefaultAbortStatus = 0 DefaultDelayPercent = 0 )
constant for default values of abort and delay
const ( FixedPrefix = "cse" NamespaceIsolation = "isolation" NamespaceCircuitBreaker = "circuitBreaker" NamespaceFallback = "fallback" //降级 NamespaceFallbackpolicy = "fallbackpolicy" PropertyTimeoutInMilliseconds = "timeoutInMilliseconds" PropertyTimeoutEnabled = "timeout.enabled" PropertyMaxConcurrentRequests = "maxConcurrentRequests" PropertyErrorThresholdPercentage = "errorThresholdPercentage" //失败率 PropertyRequestVolumeThreshold = "requestVolumeThreshold" //窗口请求数 PropertySleepWindowInMilliseconds = "sleepWindowInMilliseconds" //熔断时间窗 PropertyEnabled = "enabled" PropertyForce = "force" PropertyPolicy = "policy" PropertyForceClosed = "forceClosed" PropertyForceOpen = "forceOpen" PropertyFault = "fault" PropertyGlobal = "_global" PropertyGovernance = "governance" PropertyConsumer = "Consumer" PropertySchema = "schemas" PropertyOperations = "operations" PropertyProtocol = "protocols" PropertyAbort = "abort" PropertyPercent = "percent" PropertyFixedDelay = "fixedDelay" PropertyDelay = "delay" PropertyHTTPStatus = "httpStatus" LoadBalance = "loadbalance" )
constant for hystrix keys
const ( //DefaultStrategy is default value for strategy DefaultStrategy = "RoundRobin" //DefaultSessionTimeout is default value for timeout DefaultSessionTimeout = 30 //DefaultFailedTimes is default value for failed times DefaultFailedTimes = 5 )
const DefaultConfigPath = "/etc/.kube/config"
DefaultConfigPath set the default config path
const DefaultRouterType = "cse"
DefaultRouterType set the default router type
Variables ¶
var ErrNoName = errors.New("micro service name is missing in description file")
ErrNoName is used to represent the service name missing error
var GlobalDefinition *model.GlobalCfg
GlobalDefinition is having the information about region, load balancing, service center, config center, protocols, and handlers for the micro service
var HystrixConfig *model.HystrixConfigWrapper
HystrixConfig is having info about isolation, circuit breaker, fallback properities of the micro service
var MicroserviceDefinition *model.MicroserviceCfg
MicroserviceDefinition has info about application id, provider info, description of the service, and description of the instance
var MonitorCfgDef *model.MonitorCfg
MonitorCfgDef has monitorv info, including zipkin and apm.
var NodeIP string
NodeIP gives the information of node ip
Functions ¶
func BackOffKind ¶ added in v0.7.1
BackOffKind get kind
func BackOffMaxMs ¶ added in v0.7.1
BackOffMaxMs get max time
func BackOffMinMs ¶ added in v0.7.1
BackOffMinMs get min time
func GetAbortPercent ¶
GetAbortPercent get abort percentage
func GetAbortStatus ¶
GetAbortStatus get abort status
func GetCircuitBreakerEnabled ¶
GetCircuitBreakerEnabled get circuit breaker enabled
func GetCircuitBreakerEnabledKey ¶
GetCircuitBreakerEnabledKey get circuit breaker enabled key
func GetConfigCenterConf ¶ added in v1.3.0
func GetConfigCenterConf() model.ConfigClient
GetConfigCenterConf return config center conf
func GetContractDiscoveryAPIVersion ¶
func GetContractDiscoveryAPIVersion() string
GetContractDiscoveryAPIVersion returns the APIVersion of contract discovery registry
func GetContractDiscoveryAddress ¶
func GetContractDiscoveryAddress() string
GetContractDiscoveryAddress returns the Address of contract discovery registry
func GetContractDiscoveryDisable ¶
func GetContractDiscoveryDisable() bool
GetContractDiscoveryDisable returns the Disable of contract discovery registry
func GetContractDiscoveryTenant ¶
func GetContractDiscoveryTenant() string
GetContractDiscoveryTenant returns the Tenant of contract discovery registry
func GetContractDiscoveryType ¶
func GetContractDiscoveryType() string
GetContractDiscoveryType returns the Type of contract discovery registry
func GetDataCenter ¶ added in v1.4.0
func GetDataCenter() *model.DataCenterInfo
GetDataCenter return data center info
func GetDefaultCircuitBreakerEnabledKey ¶
GetDefaultCircuitBreakerEnabledKey get default circuit breaker enabled key
func GetDefaultErrorPercentThreshold ¶
GetDefaultErrorPercentThreshold get default error percentage threshold value
func GetDefaultFallbackPolicyKey ¶
GetDefaultFallbackPolicyKey get default fallback policy key
func GetDefaultForceCloseKey ¶
GetDefaultForceCloseKey get default force close key
func GetDefaultForceFallbackKey ¶
GetDefaultForceFallbackKey get default force fallback key
func GetDefaultForceOpenKey ¶
GetDefaultForceOpenKey get default force open key
func GetDefaultGetFallbackEnabledKey ¶
GetDefaultGetFallbackEnabledKey get default fallback enabled key
func GetDefaultMaxConcurrentKey ¶
GetDefaultMaxConcurrentKey get default maximum concurrent key
func GetDefaultRequestVolumeThresholdKey ¶
GetDefaultRequestVolumeThresholdKey get default request volume threshold key
func GetDefaultSleepWindowKey ¶
GetDefaultSleepWindowKey get default sleep window key
func GetDefaultTimeoutKey ¶
GetDefaultTimeoutKey get default timeout key
func GetDelayPercent ¶
GetDelayPercent get delay percentage
func GetErrorPercentThreshold ¶
GetErrorPercentThreshold get error percent threshold
func GetErrorPercentThresholdKey ¶
GetErrorPercentThresholdKey get error percentage threshold key
func GetFallbackEnabled ¶
GetFallbackEnabled get fallback enabled
func GetFallbackEnabledKey ¶
GetFallbackEnabledKey get fallback enabled key
func GetFallbackPolicyKey ¶
GetFallbackPolicyKey get fallback policy key
func GetFaultAbortHTTPStatusKey ¶
GetFaultAbortHTTPStatusKey get fault abort http status key
func GetFaultAbortPercentKey ¶
GetFaultAbortPercentKey get fault abort percentage key
func GetFaultDelayPercentKey ¶
GetFaultDelayPercentKey get fault daley percentage key
func GetFaultFixedDelayKey ¶
GetFaultFixedDelayKey get fault fixed delay key
func GetFaultInjectionGlobalKey ¶
func GetFaultInjectionGlobalKey() string
GetFaultInjectionGlobalKey get fault injection global key
func GetFaultInjectionOperationKey ¶
GetFaultInjectionOperationKey get fault injection operation key
func GetFaultInjectionSchemaKey ¶
GetFaultInjectionSchemaKey get fault injection schema key
func GetFaultInjectionServiceKey ¶
GetFaultInjectionServiceKey get fault injection service key
func GetFixedDelay ¶
GetFixedDelay get fixed delay
func GetForceCloseKey ¶
GetForceCloseKey get force close key
func GetForceFallback ¶
GetForceFallback get force fallback
func GetForceFallbackKey ¶
GetForceFallbackKey get force fallback key
func GetForceOpenKey ¶
GetForceOpenKey get force open key
func GetHystrixConfig ¶
func GetHystrixConfig() *model.HystrixConfig
GetHystrixConfig return cb config
func GetHystrixSpecificKey ¶
GetHystrixSpecificKey get hystrix specific key
func GetLoadBalancing ¶
func GetLoadBalancing() *model.LoadBalancing
GetLoadBalancing return lb config
func GetMaxConcurrentKey ¶
GetMaxConcurrentKey get maximum concurrent key
func GetMaxConcurrentRequests ¶
GetMaxConcurrentRequests get max concurrent requests
func GetRegistratorAPIVersion ¶
func GetRegistratorAPIVersion() string
GetRegistratorAPIVersion returns the APIVersion of service registry
func GetRegistratorAddress ¶
func GetRegistratorAddress() string
GetRegistratorAddress returns the Address of service registry
func GetRegistratorAutoRegister ¶
func GetRegistratorAutoRegister() string
GetRegistratorAutoRegister returns the AutoRegister of service registry
func GetRegistratorDisable ¶
func GetRegistratorDisable() bool
GetRegistratorDisable returns the Disable of service registry
func GetRegistratorScope ¶
func GetRegistratorScope() string
GetRegistratorScope returns the Scope of service registry
func GetRegistratorTenant ¶
func GetRegistratorTenant() string
GetRegistratorTenant returns the Tenant of service registry
func GetRegistratorType ¶
func GetRegistratorType() string
GetRegistratorType returns the Type of service registry
func GetRequestVolumeThreshold ¶
GetRequestVolumeThreshold get request volume threshold
func GetRequestVolumeThresholdKey ¶
GetRequestVolumeThresholdKey get request volume threshold key
func GetRetryOnNext ¶
GetRetryOnNext return value of GetRetryOnNext
func GetRetryOnSame ¶
GetRetryOnSame return value of RetryOnSame
func GetRouterEndpoints ¶ added in v0.7.1
func GetRouterEndpoints() string
GetRouterEndpoints returns the router address
func GetRouterType ¶ added in v0.7.1
func GetRouterType() string
GetRouterType returns the type of router
func GetServerListFilters ¶
func GetServerListFilters() (filters []string)
GetServerListFilters get server list filters
func GetServiceDiscoveryAPIVersion ¶
func GetServiceDiscoveryAPIVersion() string
GetServiceDiscoveryAPIVersion returns the APIVersion of SD registry
func GetServiceDiscoveryAddress ¶
func GetServiceDiscoveryAddress() string
GetServiceDiscoveryAddress returns the Address of SD registry
func GetServiceDiscoveryConfigPath ¶ added in v0.7.1
func GetServiceDiscoveryConfigPath() string
GetServiceDiscoveryConfigPath returns the configpath of SD registry
func GetServiceDiscoveryDisable ¶
func GetServiceDiscoveryDisable() bool
GetServiceDiscoveryDisable returns the Disable of SD registry
func GetServiceDiscoveryHealthCheck ¶
func GetServiceDiscoveryHealthCheck() bool
GetServiceDiscoveryHealthCheck returns the HealthCheck of SD registry
func GetServiceDiscoveryRefreshInterval ¶
func GetServiceDiscoveryRefreshInterval() string
GetServiceDiscoveryRefreshInterval returns the RefreshInterval of SD registry
func GetServiceDiscoveryTenant ¶
func GetServiceDiscoveryTenant() string
GetServiceDiscoveryTenant returns the Tenant of SD registry
func GetServiceDiscoveryType ¶
func GetServiceDiscoveryType() string
GetServiceDiscoveryType returns the Type of SD registry
func GetServiceDiscoveryWatch ¶
func GetServiceDiscoveryWatch() bool
GetServiceDiscoveryWatch returns the Watch of SD registry
func GetSessionTimeout ¶
GetSessionTimeout return session timeout
func GetSleepWindowKey ¶
GetSleepWindowKey get sleep window key
func GetStrategyName ¶
GetStrategyName get strategy name
func GetTimeoutDuration ¶ added in v1.1.1
GetTimeoutDuration get timeout durations from cache first, then get from archaius
func GetTimeoutDurationFromArchaius ¶ added in v1.6.1
GetTimeoutDurationFromArchaius get timeout durations from archaius
func GetTransportConf ¶ added in v1.3.0
GetTransportConf return transport settings
func Init ¶
func Init() error
Init is initialize the configuration directory, archaius, route rule, and schema
func ReadGlobalConfigFromArchaius ¶ added in v1.7.2
func ReadGlobalConfigFromArchaius() error
ReadGlobalConfigFromArchaius for to unmarshal the global config file(chassis.yaml) information
func ReadHystrixFromArchaius ¶
func ReadHystrixFromArchaius() error
ReadHystrixFromArchaius is unmarshal hystrix configuration file(circuit_breaker.yaml)
func ReadLBFromArchaius ¶
func ReadLBFromArchaius() error
ReadLBFromArchaius for to unmarshal the global config file(chassis.yaml) information
func ReadMicroserviceConfigFromBytes ¶
ReadMicroserviceConfigFromBytes read micro service configurations from bytes
func ReadMonitorFromArchaius ¶ added in v1.8.0
func ReadMonitorFromArchaius() error
ReadMonitorFromArchaius read monitor config from archauis pkg
func ReadMonitorFromFile ¶ added in v1.8.0
func ReadMonitorFromFile() error
ReadMonitorFromFile read monitor config from local file conf/monitoring.yaml
func StrategySuccessiveFailedTimes ¶
StrategySuccessiveFailedTimes strategy successive failed times
Types ¶
type DarkLaunchRule ¶ added in v1.7.1
type DarkLaunchRule struct { Type string `json:"policyType"` // RULE/RATE Items []*RuleItem `json:"ruleItems"` }
DarkLaunchRule dark launch rule Deprecated
type LimiterConfig ¶ added in v1.8.1
LimiterConfig is rate limiter policy
type Match ¶ added in v1.7.1
type Match struct { Refer string `yaml:"refer"` Source string `yaml:"source"` SourceTags map[string]string `yaml:"sourceTags"` HTTPHeaders map[string]map[string]string `yaml:"httpHeaders"` Headers map[string]map[string]string `yaml:"headers"` }
Match is checking source, source tags, and http headers
type MatchPolicy ¶ added in v1.8.1
type MatchPolicy struct { }
MatchPolicy specify a request mach policy
type OneServiceRule ¶ added in v1.7.1
type OneServiceRule []*RouteRule
OneServiceRule save route rule for one service
func NewServiceRule ¶ added in v1.7.1
func NewServiceRule(raw string) (*OneServiceRule, error)
NewServiceRule create a rule by raw data
func (OneServiceRule) Len ¶ added in v1.7.1
func (o OneServiceRule) Len() int
Len return the length of rule
func (OneServiceRule) Value ¶ added in v1.7.1
func (o OneServiceRule) Value() []*RouteRule
Value return the rule
type Prefix ¶ added in v1.7.1
type Prefix struct { RouteRule map[string]string `yaml:"routeRule"` //service name is key,value is route rule yaml config SourceTemplates map[string]string `yaml:"sourceTemplate"` //template name is key, value is template policy }
Prefix hold all config items
type RouteRule ¶ added in v1.7.1
type RouteRule struct { Precedence int `yaml:"precedence"` Routes []*RouteTag `yaml:"route"` Match Match `yaml:"match"` }
RouteRule is having route rule parameters
type RouteTag ¶ added in v1.7.1
type RouteTag struct { Tags map[string]string `yaml:"tags"` Weight int `yaml:"weight"` Label string }
RouteTag gives route tag information
type RouterConfig ¶ added in v1.7.1
type RouterConfig struct { Router Router `yaml:"router"` Destinations map[string][]*RouteRule `yaml:"routeRule"` SourceTemplates map[string]*Match `yaml:"sourceTemplate"` }
RouterConfig is the struct having info about route rule destinations, source templates Deprecated
var OldRouterDefinition *RouterConfig
OldRouterDefinition is route rule config Deprecated
type RuleItem ¶ added in v1.7.1
type RuleItem struct { GroupName string `json:"groupName"` GroupCondition string `json:"groupCondition"` // version=0.0.1 PolicyCondition string `json:"policyCondition"` // 80/test!=2 CaseInsensitive bool `json:"caseInsensitive"` Versions []string `json:"versions"` }
RuleItem rule item Deprecated
type ServiceComb ¶ added in v1.7.1
type ServiceComb struct {
Prefix Prefix `yaml:"servicecomb"`
}
ServiceComb hold all config items