Documentation ¶
Index ¶
- Constants
- Variables
- func GetAbortPercent(protocol, microServiceName, schema, operation string) int
- func GetAbortStatus(protocol, microServiceName, schema, operation string) int
- func GetBackOff(source, service string) backoff.BackOff
- func GetCircuitBreakerEnabled(command, t string) bool
- func GetCircuitBreakerEnabledKey(command string) string
- func GetContractDiscoveryAPIVersion() string
- func GetContractDiscoveryAddress() string
- func GetContractDiscoveryDisable() bool
- func GetContractDiscoveryTenant() string
- func GetContractDiscoveryType() string
- 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 GetDefaultTimeEnabledKey(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 GetServerListFilters() (filters []string)
- func GetServiceDiscoveryAPIVersion() string
- func GetServiceDiscoveryAddress() 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 GetTimeEnabledKey(command string) string
- func GetTimeout(command, t string) int
- func GetTimeoutEnabled(service, t string) bool
- func GetTimeoutKey(command string) string
- func Init() error
- func ReadHystrixFromArchaius() error
- func ReadLBFromArchaius() error
- func ReadMicroserviceConfigFromBytes(data []byte) error
- func RetryEnabled(source, service string) bool
- func StrategySuccessiveFailedTimes(source, service string) int
Constants ¶
const ( DefaultForceFallback = false DefaultTimeoutEnabled = false DefaultCircuitBreakerEnabled = true 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 //DefaultBackoffKind is zero DefaultBackoffKind = backoffZero )
Variables ¶
var ErrNoName = errors.New("Microservice 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 is having the info about application id, provider info, description of the service, and description of the instance
var NodeIP string
NodeIP gives the information of node ip
var PaasLagerDefinition *model.PassLagerCfg
PaasLagerDefinition is having the information about loging
var RouterDefinition *model.RouterConfig
RouterDefinition is route rule config
var SelfMetadata map[string]string
SelfMetadata is gives meta data of the self micro service
var SelfServiceID string
SelfServiceID 单进程多微服务根本没法记录依赖关系,因为一个进程里有多个微服务,你在调用别的微服务时到底该怎么添加依赖关系? 只能随意赋值个id
var SelfServiceName string
SelfServiceName is self micro service name
var SelfVersion string
SelfVersion gives version of the self micro service
Functions ¶
func GetAbortPercent ¶
GetAbortPercent get abort percentage
func GetAbortStatus ¶
GetAbortStatus get abort status
func GetBackOff ¶
GetBackOff return the the back off policy
func GetCircuitBreakerEnabled ¶
GetCircuitBreakerEnabled get circuit breaker enabled
func GetCircuitBreakerEnabledKey ¶
GetCircuitBreakerEnabledKey get circuit breaker enabled key
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 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 GetDefaultTimeEnabledKey ¶
GetDefaultTimeEnabledKey get default time enabled 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 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 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 GetTimeEnabledKey ¶
GetTimeEnabledKey get time enabled key
func GetTimeoutEnabled ¶
GetTimeoutEnabled get timeout enabled
func Init ¶
func Init() error
Init is initialize the configuration directory, lager, archaius, route rule, and schema
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 StrategySuccessiveFailedTimes ¶
StrategySuccessiveFailedTimes strategy successive failed times
Types ¶
This section is empty.