Version: v0.7.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 16 Imported by: 0




View Source
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

View Source
const (
	DefaultAbortPercent = 0
	DefaultAbortStatus  = 0
	DefaultDelayPercent = 0

constant for default values of abort and delay

View Source
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

View Source
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
View Source
const DefaultConfigPath = "/etc/.kube/config"

DefaultConfigPath set the default config path

View Source
const DefaultRouterType = "cse"

DefaultRouterType set the default router type


View Source
var ErrNoName = errors.New("micro service name is missing in description file")

ErrNoName is used to represent the service name missing error

View Source
var GlobalDefinition *model.GlobalCfg

GlobalDefinition is having the information about region, load balancing, service center, config center, protocols, and handlers for the micro service

HystrixConfig is having info about isolation, circuit breaker, fallback properities of the micro service

View Source
var MicroserviceDefinition *model.MicroserviceCfg

MicroserviceDefinition is having the info about application id, provider info, description of the service, and description of the instance

View Source
var NodeIP string

NodeIP gives the information of node ip

View Source
var PaasLagerDefinition *model.PassLagerCfg

PaasLagerDefinition is having the information about loging

View Source
var RouterDefinition *model.RouterConfig

RouterDefinition is route rule config

View Source
var SelfMetadata map[string]string

SelfMetadata is gives meta data of the self micro service

View Source
var SelfServiceName string

SelfServiceName is self micro service name

View Source
var SelfVersion string

SelfVersion gives version of the self micro service


func BackOffKind added in v0.7.1

func BackOffKind(source, service string) string

BackOffKind get kind

func BackOffMaxMs added in v0.7.1

func BackOffMaxMs(source, service string) int

BackOffMaxMs get max time

func BackOffMinMs added in v0.7.1

func BackOffMinMs(source, service string) int

BackOffMinMs get min time

func GetAbortPercent

func GetAbortPercent(protocol, microServiceName, schema, operation string) int

GetAbortPercent get abort percentage

func GetAbortStatus

func GetAbortStatus(protocol, microServiceName, schema, operation string) int

GetAbortStatus get abort status

func GetCircuitBreakerEnabled

func GetCircuitBreakerEnabled(command, t string) bool

GetCircuitBreakerEnabled get circuit breaker enabled

func GetCircuitBreakerEnabledKey

func GetCircuitBreakerEnabledKey(command string) string

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

func GetDefaultCircuitBreakerEnabledKey(t string) string

GetDefaultCircuitBreakerEnabledKey get default circuit breaker enabled key

func GetDefaultErrorPercentThreshold

func GetDefaultErrorPercentThreshold(t string) string

GetDefaultErrorPercentThreshold get default error percentage threshold value

func GetDefaultFallbackPolicyKey

func GetDefaultFallbackPolicyKey(t string) string

GetDefaultFallbackPolicyKey get default fallback policy key

func GetDefaultForceCloseKey

func GetDefaultForceCloseKey(t string) string

GetDefaultForceCloseKey get default force close key

func GetDefaultForceFallbackKey

func GetDefaultForceFallbackKey(t string) string

GetDefaultForceFallbackKey get default force fallback key

func GetDefaultForceOpenKey

func GetDefaultForceOpenKey(t string) string

GetDefaultForceOpenKey get default force open key

func GetDefaultGetFallbackEnabledKey

func GetDefaultGetFallbackEnabledKey(t string) string

GetDefaultGetFallbackEnabledKey get default fallback enabled key

func GetDefaultMaxConcurrentKey

func GetDefaultMaxConcurrentKey(t string) string

GetDefaultMaxConcurrentKey get default maximum concurrent key

func GetDefaultRequestVolumeThresholdKey

func GetDefaultRequestVolumeThresholdKey(t string) string

GetDefaultRequestVolumeThresholdKey get default request volume threshold key

func GetDefaultSleepWindowKey

func GetDefaultSleepWindowKey(t string) string

GetDefaultSleepWindowKey get default sleep window key

func GetDefaultTimeEnabledKey

func GetDefaultTimeEnabledKey(t string) string

GetDefaultTimeEnabledKey get default time enabled key

func GetDefaultTimeoutKey

func GetDefaultTimeoutKey(t string) string

GetDefaultTimeoutKey get default timeout key

func GetDelayPercent

func GetDelayPercent(protocol, microServiceName, schema, operation string) int

GetDelayPercent get delay percentage

func GetErrorPercentThreshold

func GetErrorPercentThreshold(command, t string) int

GetErrorPercentThreshold get error percent threshold

func GetErrorPercentThresholdKey

func GetErrorPercentThresholdKey(command string) string

GetErrorPercentThresholdKey get error percentage threshold key

func GetFallbackEnabled

func GetFallbackEnabled(command, t string) bool

GetFallbackEnabled get fallback enabled

func GetFallbackEnabledKey

func GetFallbackEnabledKey(command string) string

GetFallbackEnabledKey get fallback enabled key

func GetFallbackPolicyKey

func GetFallbackPolicyKey(command string) string

GetFallbackPolicyKey get fallback policy key

func GetFaultAbortHTTPStatusKey

func GetFaultAbortHTTPStatusKey(key, protocol string) string

GetFaultAbortHTTPStatusKey get fault abort http status key

func GetFaultAbortPercentKey

func GetFaultAbortPercentKey(key, protocol string) string

GetFaultAbortPercentKey get fault abort percentage key

func GetFaultDelayPercentKey

func GetFaultDelayPercentKey(key, protocol string) string

GetFaultDelayPercentKey get fault daley percentage key

func GetFaultFixedDelayKey

func GetFaultFixedDelayKey(key, protocol string) string

GetFaultFixedDelayKey get fault fixed delay key

func GetFaultInjectionGlobalKey

func GetFaultInjectionGlobalKey() string

GetFaultInjectionGlobalKey get fault injection global key

func GetFaultInjectionOperationKey

func GetFaultInjectionOperationKey(microServiceName, schema, operation string) string

GetFaultInjectionOperationKey get fault injection operation key

func GetFaultInjectionSchemaKey

func GetFaultInjectionSchemaKey(microServiceName, schema string) string

GetFaultInjectionSchemaKey get fault injection schema key

func GetFaultInjectionServiceKey

func GetFaultInjectionServiceKey(microServiceName string) string

GetFaultInjectionServiceKey get fault injection service key

func GetFilterNamesKey

func GetFilterNamesKey() string

GetFilterNamesKey get filer name and key

func GetFixedDelay

func GetFixedDelay(protocol, microServiceName, schema, operation string) time.Duration

GetFixedDelay get fixed delay

func GetForceClose

func GetForceClose(service, t string) bool

GetForceClose get force close

func GetForceCloseKey

func GetForceCloseKey(command string) string

GetForceCloseKey get force close key

func GetForceFallback

func GetForceFallback(service, t string) bool

GetForceFallback get force fallback

func GetForceFallbackKey

func GetForceFallbackKey(command string) string

GetForceFallbackKey get force fallback key

func GetForceOpen

func GetForceOpen(service, t string) bool

GetForceOpen get foce open

func GetForceOpenKey

func GetForceOpenKey(command string) string

GetForceOpenKey get force open key

func GetGlobalAppID added in v0.7.1

func GetGlobalAppID() string

GetGlobalAppID returns appID of definition

func GetHystrixConfig

func GetHystrixConfig() *model.HystrixConfig

GetHystrixConfig return cb config

func GetHystrixSpecificKey

func GetHystrixSpecificKey(namespace, cmd, property string) string

GetHystrixSpecificKey get hystrix specific key

func GetLoadBalancing

func GetLoadBalancing() *model.LoadBalancing

GetLoadBalancing return lb config

func GetMaxConcurrentKey

func GetMaxConcurrentKey(command string) string

GetMaxConcurrentKey get maximum concurrent key

func GetMaxConcurrentRequests

func GetMaxConcurrentRequests(command, t string) int

GetMaxConcurrentRequests get max concurrent requests

func GetPolicy

func GetPolicy(service, t string) string

GetPolicy get fallback policy

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

func GetRequestVolumeThreshold(command, t string) int

GetRequestVolumeThreshold get request volume threshold

func GetRequestVolumeThresholdKey

func GetRequestVolumeThresholdKey(command string) string

GetRequestVolumeThresholdKey get request volume threshold key

func GetRetryOnNext

func GetRetryOnNext(source, service string) int

GetRetryOnNext return value of GetRetryOnNext

func GetRetryOnSame

func GetRetryOnSame(source, service string) int

GetRetryOnSame return value of RetryOnSame

func GetRouterEndpoints added in v0.7.1

func GetRouterEndpoints() string

GetRouterEndpoints returns the router address

func GetRouterReference added in v0.7.1

func GetRouterReference() map[string]model.ReferencesStruct

GetRouterReference 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

func GetSessionTimeout(source, service string) int

GetSessionTimeout return session timeout

func GetSleepWindow

func GetSleepWindow(command, t string) int

GetSleepWindow get sleep window

func GetSleepWindowKey

func GetSleepWindowKey(command string) string

GetSleepWindowKey get sleep window key

func GetStrategyName

func GetStrategyName(source, service string) string

GetStrategyName get strategy name

func GetTimeEnabledKey

func GetTimeEnabledKey(command string) string

GetTimeEnabledKey get time enabled key

func GetTimeout

func GetTimeout(command, t string) int

GetTimeout get timeout durations

func GetTimeoutEnabled

func GetTimeoutEnabled(service, t string) bool

GetTimeoutEnabled get timeout enabled

func GetTimeoutKey

func GetTimeoutKey(command string) string

GetTimeoutKey get timeout key

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

func ReadMicroserviceConfigFromBytes(data []byte) error

ReadMicroserviceConfigFromBytes read micro service configurations from bytes

func RetryEnabled

func RetryEnabled(source, service string) bool

RetryEnabled retry enabled

func StrategySuccessiveFailedTimes

func StrategySuccessiveFailedTimes(source, service string) int

StrategySuccessiveFailedTimes strategy successive failed times


This section is empty.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL