burst

package
v5.0.0-...-470bbe4 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_app_observatory_burst_config_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Config

type Config struct {

	// @Document The selectors for outbound under observation
	SubjectSelector []string          `protobuf:"bytes,2,rep,name=subject_selector,json=subjectSelector,proto3" json:"subject_selector,omitempty"`
	PingConfig      *HealthPingConfig `protobuf:"bytes,3,opt,name=ping_config,json=pingConfig,proto3" json:"ping_config,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetPingConfig

func (x *Config) GetPingConfig() *HealthPingConfig

func (*Config) GetSubjectSelector

func (x *Config) GetSubjectSelector() []string

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type HealthPing

type HealthPing struct {
	Settings *HealthPingSettings
	Results  map[string]*HealthPingRTTS
	// contains filtered or unexported fields
}

HealthPing is the health checker for balancers

func NewHealthPing

func NewHealthPing(ctx context.Context, config *HealthPingConfig) *HealthPing

NewHealthPing creates a new HealthPing with settings

func (*HealthPing) Check

func (h *HealthPing) Check(tags []string) error

Check implements the HealthChecker

func (*HealthPing) Cleanup

func (h *HealthPing) Cleanup(tags []string)

Cleanup removes results of removed handlers, tags should be all valid tags of the Balancer now

func (*HealthPing) PutResult

func (h *HealthPing) PutResult(tag string, rtt time.Duration)

PutResult puts a ping rtt to results

func (*HealthPing) StartScheduler

func (h *HealthPing) StartScheduler(selector func() ([]string, error))

StartScheduler implements the HealthChecker

func (*HealthPing) StopScheduler

func (h *HealthPing) StopScheduler()

StopScheduler implements the HealthChecker

type HealthPingConfig

type HealthPingConfig struct {

	// destination url, need 204 for success return
	// default https://connectivitycheck.gstatic.com/generate_204
	Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"`
	// connectivity check url
	Connectivity string `protobuf:"bytes,2,opt,name=connectivity,proto3" json:"connectivity,omitempty"`
	// health check interval, int64 values of time.Duration
	Interval int64 `protobuf:"varint,3,opt,name=interval,proto3" json:"interval,omitempty"`
	// sampling count is the amount of recent ping results which are kept for calculation
	SamplingCount int32 `protobuf:"varint,4,opt,name=samplingCount,proto3" json:"samplingCount,omitempty"`
	// ping timeout, int64 values of time.Duration
	Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contains filtered or unexported fields
}

func (*HealthPingConfig) Descriptor deprecated

func (*HealthPingConfig) Descriptor() ([]byte, []int)

Deprecated: Use HealthPingConfig.ProtoReflect.Descriptor instead.

func (*HealthPingConfig) GetConnectivity

func (x *HealthPingConfig) GetConnectivity() string

func (*HealthPingConfig) GetDestination

func (x *HealthPingConfig) GetDestination() string

func (*HealthPingConfig) GetInterval

func (x *HealthPingConfig) GetInterval() int64

func (*HealthPingConfig) GetSamplingCount

func (x *HealthPingConfig) GetSamplingCount() int32

func (*HealthPingConfig) GetTimeout

func (x *HealthPingConfig) GetTimeout() int64

func (*HealthPingConfig) ProtoMessage

func (*HealthPingConfig) ProtoMessage()

func (*HealthPingConfig) ProtoReflect

func (x *HealthPingConfig) ProtoReflect() protoreflect.Message

func (*HealthPingConfig) Reset

func (x *HealthPingConfig) Reset()

func (*HealthPingConfig) String

func (x *HealthPingConfig) String() string

type HealthPingRTTS

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

HealthPingRTTS holds ping rtts for health Checker

func NewHealthPingResult

func NewHealthPingResult(cap int, validity time.Duration) *HealthPingRTTS

NewHealthPingResult returns a *HealthPingResult with specified capacity

func (*HealthPingRTTS) Get

func (h *HealthPingRTTS) Get() *HealthPingStats

Get gets statistics of the HealthPingRTTS

func (*HealthPingRTTS) GetWithCache

func (h *HealthPingRTTS) GetWithCache() *HealthPingStats

GetWithCache get statistics and write cache for next call Make sure use Mutex.Lock() before calling it, RWMutex.RLock() is not an option since it writes cache

func (*HealthPingRTTS) Put

func (h *HealthPingRTTS) Put(d time.Duration)

Put puts a new rtt to the HealthPingResult

type HealthPingSettings

type HealthPingSettings struct {
	Destination   string        `json:"destination"`
	Connectivity  string        `json:"connectivity"`
	Interval      time.Duration `json:"interval"`
	SamplingCount int           `json:"sampling"`
	Timeout       time.Duration `json:"timeout"`
}

HealthPingSettings holds settings for health Checker

type HealthPingStats

type HealthPingStats struct {
	All       int
	Fail      int
	Deviation time.Duration
	Average   time.Duration
	Max       time.Duration
	Min       time.Duration
}

HealthPingStats is the statistics of HealthPingRTTS

type Observer

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

func New

func New(ctx context.Context, config *Config) (*Observer, error)

func (*Observer) Close

func (o *Observer) Close() error

func (*Observer) GetObservation

func (o *Observer) GetObservation(ctx context.Context) (proto.Message, error)

func (*Observer) Start

func (o *Observer) Start() error

func (*Observer) Type

func (o *Observer) Type() interface{}

Jump to

Keyboard shortcuts

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