status

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GrpReg *grpReg = &grpReg{
	grps: map[string]Grouper{},
}

GrpReg holds all by json instanceble groups

Functions

func Cleanup

func Cleanup(s Status)

Cleanup removes groups with Level below OK (i.e. unknown) and no events since status.cleanup config

Types

type Availability

type Availability float64

Availability is the availability of a group given in % from 0 to 1

func (Availability) String

func (ga Availability) String() string

type Config

type Config struct {
	UnknownTimeout time.Duration
}

Config holds configuration for the Status

type EvtGroup

type EvtGroup interface {
	Grouper
	AddEvent(evt *msg.SzenarioEvtMsg)
}

EvtGroup is a status group containing events

type Group

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

Group is the implementation of a generic alert group

func (*Group) Add

func (g *Group) Add(c Grouper)

Add a new child

func (Group) Availability

func (g Group) Availability() Availability

Availability is the availability of a group given in % from 0 to 1

func (Group) GetCounter added in v0.10.4

func (g Group) GetCounter(counter string) float64

GetCounter returns the avg of a counter

func (Group) Key

func (g Group) Key() string

Key returns the key of the group item

func (Group) Level

func (g Group) Level() Level

Level returns the error level

func (Group) LevelRedundent

func (g Group) LevelRedundent() Level

LevelRedundent returns the error level of a redanent set

func (Group) MarshalJSON

func (g Group) MarshalJSON() ([]byte, error)

MarshalJSON marshall children

func (Group) New

func (Group) New(k string) Grouper

New create a Group

func (*Group) SetConfig

func (g *Group) SetConfig(cfg *Config)

SetConfig recursively set the config

func (*Group) UnmarshalJSON

func (g *Group) UnmarshalJSON(data []byte) error

UnmarshalJSON marshall children

type Grouper

type Grouper interface {
	New(k string) Grouper
	Key() string
	Level() Level
	Availability() Availability
	GetCounter(string) float64
	Add(Grouper)
	SetConfig(*Config)
	json.Marshaler
	json.Unmarshaler
}

Grouper is the alert group interface

type Level

type Level int

Level is the serverity level of a state

const (
	// Unknown indicates that no information is availabler
	Unknown Level = iota
	// OK indicates OK (or if an event at least the last event was OK)
	OK
	// Issues indicates that some states where not OK
	Issues
	// Warning indicates that most states where not OK
	Warning
	// Down indicates that all (or at least a lot) states where DOWN
	Down
)

func (Level) FromString

func (Level) FromString(lvl string) Level

FromString converts string to Level or panics

func (Level) Img

func (l Level) Img() string

Img returns the name of the image

func (Level) MarshalGQL

func (e Level) MarshalGQL(w io.Writer)

MarshalGQL for graphql

func (Level) String

func (i Level) String() string

func (*Level) UnmarshalGQL

func (e *Level) UnmarshalGQL(v interface{}) error

UnmarshalGQL for graphql

type RegionGroup

type RegionGroup interface {
	Grouper
	String() string
	StringInt(int) string
	AddEvent(evt *msg.SzenarioEvtMsg)
	Users() []UserGroup
	LastUpdate() time.Time
	LastTotal() float64
	Totals() []float64
}

RegionGroup correlates event messages

type Status

type Status interface {
	Grouper
	String() string
	StringInt(int) string
	AddEvent(evt *msg.SzenarioEvtMsg)
	Szenarios() []SzenarioGroup
	Get(string) SzenarioGroup
	LastUpdate() time.Time
	JSONBySzenario(string) []byte
	UpdatePrometheus()
}

Status correlates event messages

func New

func New() Status

New Creates a TopGroup to correlate event messages

type SzenarioGroup

type SzenarioGroup interface {
	Grouper
	String() string
	StringInt(int) string
	AddEvent(evt *msg.SzenarioEvtMsg)
	Regions() []RegionGroup
	LastUpdate() time.Time
	LastTotal() float64
	Totals() []float64
}

SzenarioGroup correlates event messages

type UserGroup

type UserGroup interface {
	EvtGroup
	String() string
	StringInt(int) string
	AddEvent(evt *msg.SzenarioEvtMsg)
	LastEvent() *msg.SzenarioEvtMsg
	LastUpdate() time.Time
	LastTotal() float64
	Totals() []float64
	Error() string
}

UserGroup correlates event messages

Jump to

Keyboard shortcuts

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