base

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppDeniedError = errors.New("App denied")
View Source
var AppDeniedMetric = &appDeniedMetric{}
View Source
var NoHostsMetricResult = &noHostsMetricResult{}
View Source
var NoMetricResultYet = &noMetricResultYet{}
View Source
var NoSuchMetric = &noSuchMetric{}
View Source
var NoSuchMetricError = errors.New("No such metric")
View Source
var ThresholdExceededError = errors.New("Threshold exceeded")

Functions

func IsDialTcpError

func IsDialTcpError(e error) bool

func SetupHttpClient

func SetupHttpClient(httpTimeout time.Duration) *http.Client

Types

type AppThrottle

type AppThrottle struct {
	ExpireAt time.Time
	Ratio    float64
}

AppThrottle is the definition for an app throtting instruction - Ratio: [0..1], 0 == no throttle, 1 == fully throttle

func NewAppThrottle

func NewAppThrottle(expireAt time.Time, ratio float64) *AppThrottle

type MetricHealth

type MetricHealth struct {
	LastHealthyAt           time.Time
	SecondsSinceLastHealthy int64
}

MetricHealth is a health status for a metric, and more specifically, when it was last checked to be "OK"

func NewMetricHealth

func NewMetricHealth(lastHealthyAt time.Time) *MetricHealth

type MetricHealthMap

type MetricHealthMap map[string](*MetricHealth)

func (MetricHealthMap) Aggregate

func (m MetricHealthMap) Aggregate(other MetricHealthMap) MetricHealthMap

type MetricResult

type MetricResult interface {
	Get() (float64, error)
}

func NewSimpleMetricResult

func NewSimpleMetricResult(value float64) MetricResult

type MetricResultFunc

type MetricResultFunc func() (metricResult MetricResult, threshold float64)

type RecentApp

type RecentApp struct {
	CheckedAtEpoch      int64
	MinutesSinceChecked int64
}

AppThrottle is the definition for an app throtting instruction - Ratio: [0..1], 0 == no throttle, 1 == fully throttle

func NewRecentApp

func NewRecentApp(checkedAt time.Time) *RecentApp

Jump to

Keyboard shortcuts

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