scaleAlertAggregator

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger zerolog.Logger

	WeightMap              ScaleAlertWeightMap
	NoAlertScaleDamping    float32
	UpScalingThreshold     float32
	DownScalingThreshold   float32
	EvaluationCycle        time.Duration
	EvaluationPeriodFactor uint
	CleanupCycle           time.Duration

	// AlertExpirationTime defines after which time an alert will be pruned if he did not
	// get updated again by the ScaleAlertEmitter, assuming that the alert is not relevant any more.
	AlertExpirationTime time.Duration
}

Config configuration for the ScaleAlertAggregator

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates an empty default configuration

func (Config) New

func (cfg Config) New(emitters []ScaleAlertEmitter, metrics Metrics) *ScaleAlertAggregator

New creates a instance of the ScaleAlertAggregator

type Metrics

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

Metrics represents the collection of metrics internally set by the ScaleAlertAggregator.

func NewMetrics

func NewMetrics() Metrics

NewMetrics returns the metrics collection needed for the SAA.

type ScaleAlert

type ScaleAlert struct {
	// Name of the alert.
	Name string
	// Firing is true if the alert is active, false otherwise.
	Firing bool
	// StartedAt represents the point in time the alert was created.
	StartedAt time.Time
}

ScaleAlert represents either a down or up-scale alert fired by an alerting system

type ScaleAlertAggregator

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

ScaleAlertAggregator is a component that is responsible to gather and aggregate ScaleEvents

func (*ScaleAlertAggregator) GetName

func (sc *ScaleAlertAggregator) GetName() string

GetName returns the name of this component

func (*ScaleAlertAggregator) Join

func (sc *ScaleAlertAggregator) Join()

Join blocks/ waits until ScaleAlertAggregator has been stopped

func (*ScaleAlertAggregator) Run

func (sc *ScaleAlertAggregator) Run()

Run starts the ScaleAlertAggregator

func (*ScaleAlertAggregator) Stop

func (sc *ScaleAlertAggregator) Stop() error

Stop tears down ScaleAlertAggregator

func (*ScaleAlertAggregator) Subscribe

func (sc *ScaleAlertAggregator) Subscribe(subscriber chan sokar.ScaleEvent)

Subscribe is used to register for receiving ScaleEvents

type ScaleAlertEmitter

type ScaleAlertEmitter interface {
	// Register is used to register the given handler func.
	// The ScaleAlertHandleFunc is called each time the ScaleAlertEmitter wants to promote
	// received alerts.
	Register(handleFunc ScaleAlertHandleFunc)
}

ScaleAlertEmitter is a component emits ScaleAlerts.

type ScaleAlertHandleFunc

type ScaleAlertHandleFunc func(emitter string, scaleAlerts ScaleAlertPacket)

ScaleAlertHandleFunc is a handler for received ScaleAlerts

type ScaleAlertPacket

type ScaleAlertPacket struct {
	ScaleAlerts []ScaleAlert
}

ScaleAlertPacket is a container for ScaleAlerts and meta information

type ScaleAlertPool

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

ScaleAlertPool is a structure for organizing ScaleAlerts. Adding, removing, updating and obtaining them. Based on the configured TTL the ScaleAlerts will be removed automatically if they were not updated. Access is thread-safe.

func NewScaleAlertPool

func NewScaleAlertPool(alertExpirationTime time.Duration) ScaleAlertPool

NewScaleAlertPool creates a new empty pool The parameter alertExpirationTime defines after which time an alert will be pruned if he did not get updated again by the ScaleAlertEmitter, assuming that the alert is not relevant any more.

func (*ScaleAlertPool) String

func (sp *ScaleAlertPool) String() string

String returns the content of the pool in a string representation

type ScaleAlertPoolEntry

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

ScaleAlertPoolEntry represents a ScaleAlert with an expiration time. This is needed in order to be able to clean up alerts which are not updated/ fired for a long time.

type ScaleAlertWeightMap

type ScaleAlertWeightMap map[string]float32

ScaleAlertWeightMap maps an alert name to its weight

Jump to

Keyboard shortcuts

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