Documentation ¶
Index ¶
- Variables
- type Debug
- func (aspect *Debug) After(ctx types.RuleContext, msg types.RuleMsg, err error, relationType string) types.RuleMsg
- func (aspect *Debug) Before(ctx types.RuleContext, msg types.RuleMsg, relationType string) types.RuleMsg
- func (aspect *Debug) Order() int
- func (aspect *Debug) PointCut(ctx types.RuleContext, msg types.RuleMsg, relationType string) bool
- type NodeError
- type SkipFallbackAspect
- func (aspect *SkipFallbackAspect) After(ctx types.RuleContext, msg types.RuleMsg, err error, relationType string) types.RuleMsg
- func (aspect *SkipFallbackAspect) Around(ctx types.RuleContext, msg types.RuleMsg, relationType string) (types.RuleMsg, bool)
- func (aspect *SkipFallbackAspect) OnDestroy(ctx types.NodeCtx)
- func (aspect *SkipFallbackAspect) OnReload(parentCtx types.NodeCtx, ctx types.NodeCtx, err error)
- func (aspect *SkipFallbackAspect) Order() int
- func (aspect *SkipFallbackAspect) PointCut(ctx types.RuleContext, msg types.RuleMsg, relationType string) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var FallbackErr = errors.New("skip fallback error")
FallbackErr 降级错误
Functions ¶
This section is empty.
Types ¶
type NodeError ¶
type NodeError struct {
// contains filtered or unexported fields
}
NodeError 节点错误记录
type SkipFallbackAspect ¶
type SkipFallbackAspect struct { // ErrorCountLimit LimitDuration 错误次数达到多少后,执行跳过降级 ErrorCountLimit int64 // LimitDuration 限制降级的时长 LimitDuration time.Duration // PointCutFunc 切入点,默认所有 // 用于判断是否需要执行降级逻辑 // 若返回true,则执行降级逻辑 // 若返回false,则不执行降级逻辑 PointCutFunc func(ctx types.RuleContext, msg types.RuleMsg, relationType string) bool // contains filtered or unexported fields }
SkipFallbackAspect 组件故障降级切面 降级逻辑: 1. 节点执行错误次数达到 ErrorCountLimit 后,执行跳过降级 2. 节点执行时间超过 LimitDuration 后,恢复执行
func (*SkipFallbackAspect) After ¶
func (aspect *SkipFallbackAspect) After(ctx types.RuleContext, msg types.RuleMsg, err error, relationType string) types.RuleMsg
After 如果出现错误,则记录错误次数
func (*SkipFallbackAspect) Around ¶
func (aspect *SkipFallbackAspect) Around(ctx types.RuleContext, msg types.RuleMsg, relationType string) (types.RuleMsg, bool)
Around 判断是否执行降级逻辑
func (*SkipFallbackAspect) OnDestroy ¶
func (aspect *SkipFallbackAspect) OnDestroy(ctx types.NodeCtx)
func (*SkipFallbackAspect) Order ¶
func (aspect *SkipFallbackAspect) Order() int
func (*SkipFallbackAspect) PointCut ¶
func (aspect *SkipFallbackAspect) PointCut(ctx types.RuleContext, msg types.RuleMsg, relationType string) bool
PointCut 判断是否执行降级逻辑 可以指定某类型的节点执行降级逻辑,默认所有节点执行降级逻辑。可以被 PointCutFunc 覆盖
Click to show internal directories.
Click to hide internal directories.