Documentation
¶
Index ¶
- Variables
- type Config
- type HealthPing
- type HealthPingConfig
- func (*HealthPingConfig) Descriptor() ([]byte, []int)deprecated
- func (x *HealthPingConfig) GetConnectivity() string
- func (x *HealthPingConfig) GetDestination() string
- func (x *HealthPingConfig) GetInterval() int64
- func (x *HealthPingConfig) GetSamplingCount() int32
- func (x *HealthPingConfig) GetTimeout() int64
- func (*HealthPingConfig) ProtoMessage()
- func (x *HealthPingConfig) ProtoReflect() protoreflect.Message
- func (x *HealthPingConfig) Reset()
- func (x *HealthPingConfig) String() string
- type HealthPingRTTS
- type HealthPingSettings
- type HealthPingStats
- type Observer
Constants ¶
This section is empty.
Variables ¶
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) GetPingConfig ¶
func (x *Config) GetPingConfig() *HealthPingConfig
func (*Config) GetSubjectSelector ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) ProtoReflect ¶
func (x *Config) ProtoReflect() protoreflect.Message
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 put 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
}