Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct { NameSpace string //所在的模块,用于空间的管理 Url string //api的url Desc string //描述 Method []HttpMethod //允许的访问方法 Cluster *ServerCluster //对应的集群 Access IPAccessControl //ip访问控制 ServerUrl string //服务对应url Domain string //对应的域名 Status Status AuthFilter string MatchRule MatchRule //url匹配规则 CircuitBreaker *CircuitBreaker MaxQPS int64 }
api的描述
type CircuitBreaker ¶
type CircuitBreaker struct { CloseTimeout int64 `protobuf:"varint,1,opt,name=closeTimeout" json:"closeTimeout"` HalfTrafficRate int32 `protobuf:"varint,2,opt,name=halfTrafficRate" json:"halfTrafficRate"` RateCheckPeriod int64 `protobuf:"varint,3,opt,name=rateCheckPeriod" json:"rateCheckPeriod"` FailureRateToClose int32 `protobuf:"varint,4,opt,name=failureRateToClose" json:"failureRateToClose"` SucceedRateToOpen int32 `protobuf:"varint,5,opt,name=succeedRateToOpen" json:"succeedRateToOpen"` }
* 熔断器 circuitBreaker.errorThresholdPercentage 失败率达到多少百分比后熔断 默认值:50 主要根据依赖重要性进行调整
circuitBreaker.forceClosed 是否强制关闭熔断 如果是强依赖,应该设置为true
circuitBreaker.requestVolumeThreshold 熔断触发的最小个数/10s 默认值:20
circuitBreaker.sleepWindowInMilliseconds 熔断多少秒后去尝试请求 默认值:5000
hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds 记录health 快照(用来统计成功和错误绿)的间隔,默认500ms
type CircuitStatus ¶
type CircuitStatus int32
熔断状态
const ( CS_Open CircuitStatus = 0 CS_Half CircuitStatus = 1 CS_Close CircuitStatus = 2 )
type Env ¶
type Env struct { ID byte //环境ID Name string //环境名称 Description string //环境描述 Domain string //环境对应的域名,可选 }
环境
type HeathCheck ¶
type HeathCheck struct { Path string `json:"path"` Body string `json:"body"` CheckInterval int64 `json:"checkInterval"` Timeout int64 `json:"timeout"` }
健康监测
type HttpMethod ¶
type HttpMethod byte //http 访问的方式
常量定义
const ( HTTP_GET HttpMethod = 1 HTTP_POST HttpMethod = 2 )
type LoadBalance ¶
type LoadBalance int32
LoadBalance the load balance enum
const ( LBRoundRobin LoadBalance = 0 LBIPHash LoadBalance = 1 LBTag LoadBalance = 2 )
type Parameter ¶
type Parameter struct { Name string //参数名 Source ParameterSource //参数来源 Index int32 //序号 }
Parameter is a parameter from a http request
type ParameterSource ¶
type ParameterSource byte
参数来源
const ( PS_QueryString ParameterSource = 0 PS_FormData ParameterSource = 1 PS_JSONBody ParameterSource = 2 PS_Header ParameterSource = 3 PS_Cookie ParameterSource = 4 PS_PathValue ParameterSource = 5 )
type RetryStrategy ¶
type RetryStrategy struct { Interval int32 `protobuf:"varint,1,opt,name=interval" json:"interval"` MaxTimes int32 `protobuf:"varint,2,opt,name=maxTimes" json:"maxTimes"` Codes []int32 `protobuf:"varint,3,rep,name=codes" json:"codes,omitempty"` }
重试策略 RetryStrategy retry strategy
type Server ¶
type ServerCluster ¶
type ServerCluster struct { ID string //集群ID Name string //集群名称 Servers []*Server //服务 Balance LoadBalance //负载策略 BalanceConfig string //配置 Heath HeathCheck //健康检查 }
虚拟服务器
type Validation ¶
type Validation struct { Parameter Parameter Required bool Rules []ValidationRule }
type ValidationRule ¶
Click to show internal directories.
Click to hide internal directories.