probing

package
v0.0.0-...-f66d3e9 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionHTTPProber

type FunctionHTTPProber struct {
	Query           scaling.FunctionQuery
	Resolver        middleware.BaseURLResolver
	DirectFunctions bool
}

FunctionHTTPProber probes a function's health endpoint

func (*FunctionHTTPProber) Probe

func (f *FunctionHTTPProber) Probe(functionName, namespace string) FunctionProbeResult

Scale scales a function from zero replicas to 1 or the value set in the minimum replicas metadata

type FunctionNonProber

type FunctionNonProber struct {
}

func (*FunctionNonProber) Probe

func (f *FunctionNonProber) Probe(functionName, namespace string) FunctionProbeResult

type FunctionProbeResult

type FunctionProbeResult struct {
	Available bool
	Error     error
	Found     bool
	Duration  time.Duration
	Updated   time.Time
}

FunctionProbeResult holds the result of scaling from zero

func (*FunctionProbeResult) Expired

func (res *FunctionProbeResult) Expired(expiry time.Duration) bool

Expired find out whether the cache item has expired with the given expiry duration from when it was stored.

type FunctionProber

type FunctionProber interface {
	Probe(functionName, namespace string) FunctionProbeResult
}

func NewFunctionProber

func NewFunctionProber(functionQuery scaling.FunctionQuery, resolver middleware.BaseURLResolver) FunctionProber

NewFunctionProber create a new scaler with the specified ScalingConfig

type ProbeCache

type ProbeCache struct {
	Cache  map[string]*FunctionProbeResult
	Expiry time.Duration
	Sync   sync.RWMutex
}

ProbeCache provides a cache of Probe replica counts

func (*ProbeCache) Get

func (fc *ProbeCache) Get(functionName, namespace string) (*FunctionProbeResult, bool)

func (*ProbeCache) Set

func (fc *ProbeCache) Set(functionName, namespace string, result *FunctionProbeResult)

Set replica count for functionName

type ProbeCacher

type ProbeCacher interface {
	Set(functionName, namespace string, result *FunctionProbeResult)
	Get(functionName, namespace string) (result *FunctionProbeResult, hit bool)
}

ProbeCacher queries functions and caches the results

func NewProbeCache

func NewProbeCache(cacheExpiry time.Duration) ProbeCacher

NewProbeCache creates a function cache to query function metadata

Jump to

Keyboard shortcuts

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