wrapper

package
v0.0.0-...-8cf3c65 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CgroupsToStats = map[string]Stats{
	"cpuset":  &CpuSet{},
	"shares":  &Shares{},
	"cpu":     &fs.CpuGroup{},
	"cpuacct": &fs.CpuacctGroup{},
	"memory":  &fs.MemoryGroup{},
	"devices": &fs.DevicesGroup{},
}

Cgroups2Stats holds pointer to appropriate cgroup type (defined in lib `opencontainers`) under cgroup name as a key

Functions

This section is empty.

Types

type CgroupExtended

type CgroupExtended struct {
	CpuSet CpuSet `json:"cpuset"`
	Shares Shares `json:"shares"`
}

CgroupsExtended holds additional group statistics like cpuset and shares These stats are not supported by libcontainers lib

type CpuSet

type CpuSet struct {
	Cpus            string `json:"cpus"`
	Mems            string `json:"mems"`
	MemoryMigrate   uint64 `json:"memory_migrate"`
	CpuExclusive    uint64 `json:"cpu_exclusive"`
	MemoryExclusive uint64 `json:"memory_exclusive"`
}

CpuSet stores information regarding subsystem assignment of individual CPUs and memory nodes

func (*CpuSet) GetExtendedStats

func (cs *CpuSet) GetExtendedStats(path string, ext *CgroupExtended) error

GetExtendedStats extracts CPUs and memory nodes a group can access

func (*CpuSet) GetStats

func (cs *CpuSet) GetStats(path string, stats *cgroups.Stats) error

GetStats is not used. It is defined only to implement interface for CpuSet as a member of Cgroups2Stats It is temporary solution until openlibcontainers lib provides mechanism to extract cpuset values from cgroups

type FilesystemInterface

type FilesystemInterface struct {
	// The block device name associated with the filesystem
	Device string `json:"device_name"`

	// Type of the filesystem
	Type string `json:"type"`

	// Number of bytes that can be consumed on this filesystem
	Limit uint64 `json:"capacity"`

	// Number of bytes that is consumed on this filesystem
	Usage uint64 `json:"usage"`

	// Base Usage that is consumed by the container's writable layer
	BaseUsage uint64 `json:"base_usage"`

	// Number of bytes available for non-root user
	Available uint64 `json:"available"`

	// Number of available Inodes
	InodesFree uint64 `json:"inodes_free"`

	// This is the total number of reads completed successfully
	ReadsCompleted uint64 `json:"reads_completed"`

	// This is the total number of reads merged successfully. This field lets you know how often this was done
	ReadsMerged uint64 `json:"reads_merged"`

	// This is the total number of sectors read successfully
	SectorsRead uint64 `json:"sectors_read"`

	// This is the total number of milliseconds spent reading
	ReadTime uint64 `json:"read_time"`

	// This is the total number of writes completed successfully
	WritesCompleted uint64 `json:"writes_completed"`

	// This is the total number of writes merged successfully
	WritesMerged uint64 `json:"writes_merged"`

	// This is the total number of sectors written successfully
	SectorsWritten uint64 `json:"sectors_written"`

	// This is the total number of milliseconds spent writing
	WriteTime uint64 `json:"write_time"`

	// Number of I/Os currently in progress
	IoInProgress uint64 `json:"io_in_progress"`

	// Number of milliseconds spent doing I/Os
	IoTime uint64 `json:"io_time"`

	// weighted number of milliseconds spent doing I/Os
	// This field is incremented at each I/O start, I/O completion, I/O
	// merge, or read of these stats by the number of I/Os in progress
	// (field 9) times the number of milliseconds spent doing I/O since the
	// last update of this field.  This can provide an easy measure of both
	// I/O completion time and the backlog that may be accumulating.
	WeightedIoTime uint64 `json:"weighted_io_time"`
}

FilesystemInterface holds statistics about filesystem device, capacity, usage, etc.

type NetworkInterface

type NetworkInterface struct {
	// Name is the name of the network interface.
	Name string `json:"-"`

	RxBytes   uint64 `json:"rx_bytes"`
	RxPackets uint64 `json:"rx_packets"`
	RxErrors  uint64 `json:"rx_errors"`
	RxDropped uint64 `json:"rx_dropped"`
	TxBytes   uint64 `json:"tx_bytes"`
	TxPackets uint64 `json:"tx_packets"`
	TxErrors  uint64 `json:"tx_errors"`
	TxDropped uint64 `json:"tx_dropped"`
}

NetworkInterface holds name of network interface and its statistics (rx_bytes, tx_bytes, etc.)

type Shares

type Shares struct {
	Cpu uint64 `json:"cpu"`
}

Shares stores information regarding relative share of CPU time available to the tasks in a group

func (*Shares) GetExtendedStats

func (s *Shares) GetExtendedStats(path string, ext *CgroupExtended) error

GetExtendedStats extracts integer value from cpu.shares file in given group

func (*Shares) GetStats

func (s *Shares) GetStats(path string, stats *cgroups.Stats) error

GetStats is not used. It is defined only to implement interface for Shares as a member of Cgroups2Stats It is temporary solution until openlibcontainers lib provides mechanism to extract shares from cgroups

type Specification

type Specification struct {
	Status     string            `json:"status"`
	Created    string            `json:"creation_time"`
	Image      string            `json:"image_name"`
	SizeRw     int64             `json:"size_rw"`
	SizeRootFs int64             `json:"size_root_fs"`
	Labels     map[string]string `json:"labels"`
}

Specification holds docker container specification

type Statistics

type Statistics struct {
	Network         []NetworkInterface             `json:"network"`
	Connection      TcpInterface                   `json:"connection"` //TCP, TCP6 connection stats
	CgroupStats     *cgroups.Stats                 `json:"cgroups"`
	CgroupsExtended *CgroupExtended                `json:"cgroups_extended"`
	Filesystem      map[string]FilesystemInterface `json:"filesystem"`
}

Statistics holds all available statistics: network, tcp/tcp6, cgroups and filesystem

func NewStatistics

func NewStatistics() *Statistics

NewStatistics returns pointer to initialized Statistics

type Stats

type Stats interface {
	GetStats(path string, stats *cgroups.Stats) error
}

Stats provides method to get cgroups statistics

type TcpInterface

type TcpInterface struct {
	Tcp  TcpStat `json:"tcp"`  // TCP connection stats (Established, Listen, etc.)
	Tcp6 TcpStat `json:"tcp6"` // TCP6 connection stats (Established, Listen, etc.)
}

TcpInterface holds tcp and tcp6 statistics

type TcpStat

type TcpStat struct {
	//Count of TCP connections in state "Established"
	Established uint64 `json:"established"`
	//Count of TCP connections in state "Syn_Sent"
	SynSent uint64 `json:"syn_sent"`
	//Count of TCP connections in state "Syn_Recv"
	SynRecv uint64 `json:"syn_recv"`
	//Count of TCP connections in state "Fin_Wait1"
	FinWait1 uint64 `json:"fin_wait1"`
	//Count of TCP connections in state "Fin_Wait2"
	FinWait2 uint64 `json:"fin_wait2"`
	//Count of TCP connections in state "Time_Wait
	TimeWait uint64 `json:"time_wait"`
	//Count of TCP connections in state "Close"
	Close uint64 `json:"close"`
	//Count of TCP connections in state "Close_Wait"
	CloseWait uint64 `json:"close_wait"`
	//Count of TCP connections in state "Listen_Ack"
	LastAck uint64 `json:"last_ack"`
	//Count of TCP connections in state "Listen"
	Listen uint64 `json:"listen"`
	//Count of TCP connections in state "Closing"
	Closing uint64 `json:"closing"`
}

TcpStat holds statistics about count of connections in different states

Jump to

Keyboard shortcuts

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