circuitbreaker

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kind is the kind of CircuitBreaker.
	Kind = "CircuitBreaker"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CircuitBreaker

type CircuitBreaker struct {
	// contains filtered or unexported fields
}

CircuitBreaker defines the circuit breaker

func (*CircuitBreaker) Close

func (cb *CircuitBreaker) Close()

Close closes CircuitBreaker.

func (*CircuitBreaker) DefaultSpec

func (cb *CircuitBreaker) DefaultSpec() interface{}

DefaultSpec returns the default spec of CircuitBreaker.

func (*CircuitBreaker) Description

func (cb *CircuitBreaker) Description() string

Description returns the description of CircuitBreaker

func (*CircuitBreaker) Handle

func (cb *CircuitBreaker) Handle(ctx context.HTTPContext) string

Handle handles HTTP request

func (*CircuitBreaker) Inherit

func (cb *CircuitBreaker) Inherit(filterSpec *httppipeline.FilterSpec, previousGeneration httppipeline.Filter)

Inherit inherits previous generation of CircuitBreaker.

func (*CircuitBreaker) Init

func (cb *CircuitBreaker) Init(filterSpec *httppipeline.FilterSpec)

Init initializes CircuitBreaker.

func (*CircuitBreaker) Kind

func (cb *CircuitBreaker) Kind() string

Kind returns the kind of CircuitBreaker.

func (*CircuitBreaker) Results

func (cb *CircuitBreaker) Results() []string

Results returns the results of CircuitBreaker.

func (*CircuitBreaker) Status

func (cb *CircuitBreaker) Status() interface{}

Status returns Status generated by Runtime.

type Policy

type Policy struct {
	Name                             string `yaml:"name" jsonschema:"required"`
	SlidingWindowType                string `yaml:"slidingWindowType"  jsonschema:"omitempty,enum=COUNT_BASED,enum=TIME_BASED"`
	FailureRateThreshold             uint8  `yaml:"failureRateThreshold" jsonschema:"omitempty,maximum=100"`
	SlowCallRateThreshold            uint8  `yaml:"slowCallRateThreshold" jsonschema:"omitempty,maximum=100"`
	CountingNetworkError             bool   `yaml:"countingNetworkError" jsonschema:"omitempty"`
	SlidingWindowSize                uint32 `yaml:"slidingWindowSize" jsonschema:"omitempty,minimum=1"`
	PermittedNumberOfCallsInHalfOpen uint32 `yaml:"permittedNumberOfCallsInHalfOpenState" jsonschema:"omitempty"`
	MinimumNumberOfCalls             uint32 `yaml:"minimumNumberOfCalls" jsonschema:"omitempty"`
	SlowCallDurationThreshold        string `yaml:"slowCallDurationThreshold" jsonschema:"omitempty,format=duration"`
	MaxWaitDurationInHalfOpen        string `yaml:"maxWaitDurationInHalfOpenState" jsonschema:"omitempty,format=duration"`
	WaitDurationInOpen               string `yaml:"waitDurationInOpenState" jsonschema:"omitempty,format=duration"`
	FailureStatusCodes               []int  `yaml:"failureStatusCodes" jsonschema:"omitempty,uniqueItems=true,format=httpcode-array"`
}

Policy defines the policy of a circuit breaker

type Spec

type Spec struct {
	Policies         []*Policy  `yaml:"policies" jsonschema:"required"`
	DefaultPolicyRef string     `yaml:"defaultPolicyRef" jsonschema:"omitempty"`
	URLs             []*URLRule `yaml:"urls" jsonschema:"required"`
}

Spec is the configuration of a circuit breaker

func (Spec) Validate

func (spec Spec) Validate() error

Validate implements custom validation for Spec

type Status

type Status struct {
	Health string `yaml:"health"`
}

Status is the status of CircuitBreaker.

type URLRule

type URLRule struct {
	urlrule.URLRule `yaml:",inline"`
	// contains filtered or unexported fields
}

URLRule defines the circuit breaker rule for a URL pattern

Jump to

Keyboard shortcuts

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