data

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package data implements types to handle monitoring data, calculate values from it, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	// Data per each node.
	Nodes map[string]*Node

	Timestamp time.Time
	Interval  time.Duration
}

Data represents the monitoring data retrieved via Talos API.

Data structure is sent over the channel each interval.

func (*Data) CalculateDiff

func (data *Data) CalculateDiff(oldData *Data)

CalculateDiff with data from previous iteration.

type Node

type Node struct {
	// These fields are directly API responses.
	Hostname    *machine.Hostname
	LoadAvg     *machine.LoadAvg
	Version     *machine.Version
	Memory      *machine.Memory
	SystemStat  *machine.SystemStat
	CPUsInfo    *machine.CPUsInfo
	NetDevStats *machine.NetworkDeviceStats
	DiskStats   *machine.DiskStats
	Processes   *machine.Process

	// These fields are calculated as diff with Node data from previous pol.
	SystemStatDiff  *machine.SystemStat
	NetDevStatsDiff *machine.NetworkDeviceStats
	DiskStatsDiff   *machine.DiskStats
	ProcsDiff       map[int32]*machine.ProcessInfo

	// Time-series data.
	Series map[string][]float64
}

Node represents data gathered from a single node.

func (*Node) CPUUsageByName

func (node *Node) CPUUsageByName(name string) float64

CPUUsageByName returns CPU usage by name.

func (*Node) CtxSwitches

func (node *Node) CtxSwitches() uint64

CtxSwitches returns diff of context switches.

func (*Node) MemUsage

func (node *Node) MemUsage() float64

MemUsage as used/total.

func (*Node) ProcsCreated

func (node *Node) ProcsCreated() uint64

ProcsCreated returns diff of processes created.

func (*Node) UpdateDiff

func (node *Node) UpdateDiff(old *Node)

UpdateDiff calculates diff with node data from previous iteration.

func (*Node) UpdateSeries

func (node *Node) UpdateSeries(old *Node)

UpdateSeries builds time-series data based on previous iteration data.

Jump to

Keyboard shortcuts

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