container

package
v0.0.0-...-fa91818 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStatsFormat

func NewStatsFormat(source, osType string) formatter.Format

NewStatsFormat returns a format for rendering an CStatsContext

Types

type Stats

type Stats struct {
	StatsEntry
	// contains filtered or unexported fields
}

Stats represents an entity to store containers statistics synchronously

func NewStats

func NewStats(container string) *Stats

NewStats returns a new Stats entity and sets in it the given name

func (*Stats) GetError

func (cs *Stats) GetError() error

GetError returns the container statistics error. This is used to determine whether the statistics are valid or not

func (*Stats) GetStatistics

func (cs *Stats) GetStatistics() StatsEntry

GetStatistics returns container statistics with other meta data such as the container name

func (*Stats) SetError

func (cs *Stats) SetError(err error)

SetError sets container statistics error

func (*Stats) SetErrorAndReset

func (cs *Stats) SetErrorAndReset(err error)

SetErrorAndReset zeroes all the container statistics and store the error. It is used when receiving time out error during statistics collecting to reduce lock overhead

func (*Stats) SetStatistics

func (cs *Stats) SetStatistics(s StatsEntry)

SetStatistics set the container statistics

type StatsEntry

type StatsEntry struct {
	Container        string
	Name             string
	ID               string
	CPUPercentage    float64
	Memory           float64 // On Windows this is the private working set
	MemoryLimit      float64 // Not used on Windows
	MemoryPercentage float64 // Not used on Windows
	NetworkRx        float64
	NetworkTx        float64
	BlockRead        float64
	BlockWrite       float64
	PidsCurrent      uint64 // Not used on Windows
	IsInvalid        bool
}

StatsEntry represents represents the statistics data collected from a container

func GetStats

func GetStats(dockerCli *client.Client) ([]StatsEntry, error)

GetStats collects docker container stats

Jump to

Keyboard shortcuts

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