detectors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Started     = false
	Opt         Options
	ActiveStats *StatsType
)
View Source
var DetectorFuncs = make([]DetectorFunc, 0)

DetectorFuncs detector functions

Functions

func RegisterDetector

func RegisterDetector(d DetectorFunc)

RegisterDetector register a new function to be called for detecting issues on the system

func SetLogLevel

func SetLogLevel(level logrus.Level)

func Start

func Start(ctx context.Context, opt Options)

Types

type DetectionResult

type DetectionResult struct {
	//Typ type of issue: bottleneck, risk, harm, lib-error
	Typ string
	//Id name of the issue. ex: low-available-cpu, disk-write-ceil
	ID string
	//Score how critical is this issue to the health of the system
	Score float64
	//Message text indicating the issue details
	Message string
	//Res resource directly related to the issue
	Res Resource
	//Related related resources to the issue (ex: for low CPU, place top 3 CPU processes)
	Related []Resource
	//InfoURL contains more information on how to deal with the issue
	InfoURL string
	//When time of detection process
	When time.Time
}

DetectionResult detection results

func (*DetectionResult) String

func (i *DetectionResult) String() string

type DetectorFunc

type DetectorFunc func(*Options) []DetectionResult

DetectorFunc function that is called for detecting issues on the system

type Options

type Options struct {
	Loglevel                string
	HighCPUPercRange        [2]float64
	HighCPUWaitPercRange    [2]float64
	HighMemPercRange        [2]float64
	LowDiskPercRange        [2]float64
	LowFileHandlesPercRange [2]float64
	FDUsedRange             [2]float64
	NICErrorsRange          [2]float64
	HighSwapBpsRange        [2]float64
	HighDiskUtilPercRange   [2]float64
	DefaultSampleFreq       float64
	DefaultTimeseriesSize   time.Duration
	CPULoadAvgDuration      time.Duration
	IORateLoadDuration      time.Duration
	MemAvgDuration          time.Duration
	MemLeakDuration         time.Duration
	IOLimitsSpan            time.Duration
}

Options performance analysis options

func NewOptions

func NewOptions() Options

NewOptions create a new default options

type Resource

type Resource struct {
	//Typ resource type. ex: ram, disk, cpu, fs, net
	Typ string
	//Name identification of the resource in the system. ex: /dev/fda021, cpu:23, process:prometheus[6456]
	Name string
	//PropertyName name of the resource property. ex: available-cpu, disk-writes-per-second
	PropertyName string
	//PropertyValue value of the resource property
	PropertyValue float64
}

Resource a computational resource

func (*Resource) String

func (r *Resource) String() string

type StatsType

type StatsType struct {
	CPUStats     *stats.CPUStats
	ProcessStats *stats.ProcessStats
	MemStats     *stats.MemStats
	DiskStats    *stats.DiskStats
	NetStats     *stats.NetStats
}

Jump to

Keyboard shortcuts

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