sysstats

package
v2.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 14 Imported by: 19

Documentation

Index

Constants

View Source
const (
	// SmallestAccpetableInterval is the smallest interval at which a
	// periodic stat can be generated
	SmallestAccpetableInterval time.Duration = 400 * time.Millisecond
)

Variables

This section is empty.

Functions

func SubscribeToEvents

func SubscribeToEvents() (ret events.EventSubscription, err error)

Types

type DiskConfig

type DiskConfig struct {

	// IgnorePartitions - any named partition in this list will be ignored.
	// Example would be: "/tmpfs"
	IgnorePartitions []string `yaml:"ignore_partitions"`
	// IgnorePartitionsRegex - any partition name matching this regex will be ignored
	// Example would be: "\/snap\/.*" would ignore all /snap related paths
	IgnorePartitionsRegex []string `yaml:"ignore_partitions_regex"`

	// WhiteListPartitions while not empty will be the only partitions
	// the disk stat will gather statistics on.
	WhiteListPartitions []string `yaml:"white_list_partitions"`
	// IgnoreMountpoints - any named partition in this list will be ignored.
	// Example would be: "/var/lib/docker/aufs"
	IgnoreMountpoints []string `yaml:"ignore_mountpoints"`
	// IgnoreMountpointsRegex - any mountpoint name matching this regex will be ignored
	// Example would be: "/var/lib/docker\/.*" would ignore /var/lib/docker/aufs
	IgnoreMountpointsRegex []string `yaml:"ignore_mountpoints_regex"`
	// WhiteListPartitions while not empty will be the only partitions
	// the disk stat will gather statistics on.
	// Example "/"
	WhiteListMountpoints []string `yaml:"white_list_mountpoints"`
	// contains filtered or unexported fields
}

func (*DiskConfig) GetPace

func (stat *DiskConfig) GetPace() int64

func (*DiskConfig) RunStat

func (stat *DiskConfig) RunStat(ctx context.Context, configChanged bool) (ret *StatPayload, err error)

func (*DiskConfig) Validate

func (stat *DiskConfig) Validate() (ok bool, err error)

type RunnableStat

type RunnableStat interface {
	// RunStat get the latest stat for this stat. The returned interface{}
	// should be a json encodable
	RunStat(ctx context.Context, configChanged bool) (*StatPayload, error)
	GetPace() int64
}

RunnableStat is a way for us to generically run the stats

type StatPayload

type StatPayload struct {
	Name     string
	StatData interface{}
}

StatPayload carries the stat along with a 'name'

func (*StatPayload) MarshalJSON

func (pl *StatPayload) MarshalJSON() (ret []byte, err error)

MarshalJSON for StatPayload Proper format is: "{<Name>": { <JSON STAT DATA> }}

type StatsConfig

type StatsConfig struct {
	//	loopInterval int64       `yaml:"loop_interval" json:"loop_interval"`
	VMStats   *VMConfig   `yaml:"vm_stats" json:"vm_stats"`
	DiskStats *DiskConfig `yaml:"disk_stats" json:"disk_stats"`
}

StatsConfig is used to configure the sysstats (system stats) subsystem

type SysStats

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

func GetManager

func GetManager() *SysStats

GetManager returns the singleton manager for Sysstats subsystem

func (*SysStats) OneTimeRun

func (mgr *SysStats) OneTimeRun(name string) (stat *StatPayload, err error)

tell manager to get a single stat by name, one time. This will block until the stat is returned. No event will be generated

func (*SysStats) ReadConfig

func (mgr *SysStats) ReadConfig(config *StatsConfig) (ok bool, err error)

func (*SysStats) Start

func (mgr *SysStats) Start() (err error)

type VMConfig

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

func (*VMConfig) GetPace

func (stat *VMConfig) GetPace() int64

func (*VMConfig) RunStat

func (stat *VMConfig) RunStat(ctx context.Context, configChanged bool) (ret *StatPayload, err error)

func (*VMConfig) Validate

func (stat *VMConfig) Validate() (ok bool, err error)

Jump to

Keyboard shortcuts

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