base

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppDeniedMetric = &appDeniedMetric{}

AppDeniedMetric is a special metric indicating a "denied" situation

View Source
var ErrAppDenied = errors.New("App denied")

ErrAppDenied is seen when an app is denied access

View Source
var ErrInvalidCheckType = errors.New("Unknown throttler check type")

ErrInvalidCheckType is an internal error indicating an unknown check type

View Source
var ErrNoSuchMetric = errors.New("No such metric")

ErrNoSuchMetric is for when a user requests a metric by an unknown metric name

View Source
var ErrThresholdExceeded = errors.New("Threshold exceeded")

ErrThresholdExceeded is the common error one may get checking on metric result

View Source
var NoHostsMetricResult = &noHostsMetricResult{}

NoHostsMetricResult is a result indicating "no hosts"

View Source
var NoMetricResultYet = &noMetricResultYet{}

NoMetricResultYet is a result indicating "no data"

View Source
var NoSuchMetric = &noSuchMetric{}

NoSuchMetric is a metric results for an unknown metric name

Functions

func IsDialTCPError

func IsDialTCPError(e error) bool

IsDialTCPError sees if th egiven error indicates a TCP issue

func SetupHTTPClient

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

SetupHTTPClient creates a simple HTTP client with timeout

Types

type AppThrottle

type AppThrottle struct {
	AppName  string
	ExpireAt time.Time
	Ratio    float64
}

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

func NewAppThrottle

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

NewAppThrottle creates an AppThrottle struct

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

NewMetricHealth returns a MetricHealth

type MetricHealthMap

type MetricHealthMap map[string](*MetricHealth)

MetricHealthMap maps metric names to metric healths

func (MetricHealthMap) Aggregate

func (m MetricHealthMap) Aggregate(other MetricHealthMap) MetricHealthMap

Aggregate another map into this map, take the worst metric of the two

type MetricResult

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

MetricResult is what we expect our probes to return. This can be a numeric result, or a special type of result indicating more meta-information

func NewSimpleMetricResult

func NewSimpleMetricResult(value float64) MetricResult

NewSimpleMetricResult creates a simpleMetricResult

type MetricResultFunc

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

MetricResultFunc is a function that returns a metric result

type RecentApp

type RecentApp struct {
	CheckedAtEpoch      int64
	MinutesSinceChecked int64
}

RecentApp indicates when an app was last checked

func NewRecentApp

func NewRecentApp(checkedAt time.Time) *RecentApp

NewRecentApp creates a RecentApp

Jump to

Keyboard shortcuts

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