info

package
v0.0.0-...-e2ff7db Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2014 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "0.1.3"

Version of cAdvisor.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerInfo

type ContainerInfo struct {
	ContainerReference

	// The direct subcontainers of the current container.
	Subcontainers []ContainerReference `json:"subcontainers,omitempty"`

	// The isolation used in the container.
	Spec *ContainerSpec `json:"spec,omitempty"`

	// Historical statistics gathered from the container.
	Stats []*ContainerStats `json:"stats,omitempty"`

	// Randomly sampled container states.
	Samples []*ContainerStatsSample `json:"samples,omitempty"`

	StatsPercentiles *ContainerStatsPercentiles `json:"stats_summary,omitempty"`
}

func (*ContainerInfo) Eq

func (self *ContainerInfo) Eq(b *ContainerInfo) bool

ContainerInfo may be (un)marshaled by json or other en/decoder. In that case, the Timestamp field in each stats/sample may not be precisely en/decoded. This will lead to small but acceptable differences between a ContainerInfo and its encode-then-decode version. Eq() is used to compare two ContainerInfo accepting small difference (<10ms) of Time fields.

func (*ContainerInfo) StatsAfter

func (self *ContainerInfo) StatsAfter(ref time.Time) []*ContainerStats

func (*ContainerInfo) StatsEndTime

func (self *ContainerInfo) StatsEndTime() time.Time

func (*ContainerInfo) StatsStartTime

func (self *ContainerInfo) StatsStartTime() time.Time

type ContainerInfoRequest

type ContainerInfoRequest struct {
	// Max number of stats to return.
	NumStats int `json:"num_stats,omitempty"`
	// Max number of samples to return.
	NumSamples int `json:"num_samples,omitempty"`

	// Different percentiles of CPU usage within a period. The values must be within [0, 100]
	CpuUsagePercentiles []int `json:"cpu_usage_percentiles,omitempty"`
	// Different percentiles of memory usage within a period. The values must be within [0, 100]
	MemoryUsagePercentages []int `json:"memory_usage_percentiles,omitempty"`
}

ContainerInfoQuery is used when users check a container info from the REST api. It specifies how much data users want to get about a container

func (*ContainerInfoRequest) FillDefaults

func (self *ContainerInfoRequest) FillDefaults() *ContainerInfoRequest

type ContainerReference

type ContainerReference struct {
	// The absolute name of the container.
	Name string `json:"name"`

	Aliases []string `json:"aliases,omitempty"`
}

Container reference contains enough information to uniquely identify a container

type ContainerSpec

type ContainerSpec struct {
	Cpu    *CpuSpec    `json:"cpu,omitempty"`
	Memory *MemorySpec `json:"memory,omitempty"`
}

type ContainerStats

type ContainerStats struct {
	// The time of this stat point.
	Timestamp time.Time    `json:"timestamp"`
	Cpu       *CpuStats    `json:"cpu,omitempty"`
	Memory    *MemoryStats `json:"memory,omitempty"`
}

func (*ContainerStats) Copy

func (self *ContainerStats) Copy(dst *ContainerStats) *ContainerStats

Makes a deep copy of the ContainerStats and returns a pointer to the new copy. Copy() will allocate a new ContainerStats object if dst is nil.

func (*ContainerStats) Eq

This function is useful because we do not require precise time representation.

type ContainerStatsPercentiles

type ContainerStatsPercentiles struct {
	MaxMemoryUsage         uint64       `json:"max_memory_usage,omitempty"`
	MemoryUsagePercentiles []Percentile `json:"memory_usage_percentiles,omitempty"`
	CpuUsagePercentiles    []Percentile `json:"cpu_usage_percentiles,omitempty"`
}

func NewPercentiles

func NewPercentiles(samples []*ContainerStatsSample, cpuPercentages, memoryPercentages []int) *ContainerStatsPercentiles

type ContainerStatsSample

type ContainerStatsSample struct {
	// Timetamp of the end of the sample period
	Timestamp time.Time `json:"timestamp"`
	// Duration of the sample period
	Duration time.Duration `json:"duration"`
	Cpu      struct {
		// number of nanoseconds of CPU time used by the container
		Usage uint64 `json:"usage"`

		// Per-core usage of the container. (unit: nanoseconds)
		PerCpuUsage []uint64 `json:"per_cpu_usage,omitempty"`
	} `json:"cpu"`
	Memory struct {
		// Units: Bytes.
		Usage uint64 `json:"usage"`
	} `json:"memory"`
}

func NewSample

func NewSample(prev, current *ContainerStats) (*ContainerStatsSample, error)

Each sample needs two stats because the cpu usage in ContainerStats is cumulative. prev should be an earlier observation than current. This method is not thread/goroutine safe.

func (*ContainerStatsSample) Eq

This function is useful because we do not require precise time representation.

type CpuSpec

type CpuSpec struct {
	Limit    uint64      `json:"limit"`
	MaxLimit uint64      `json:"max_limit"`
	Mask     CpuSpecMask `json:"mask,omitempty"`
}

type CpuSpecMask

type CpuSpecMask struct {
	Data []uint64 `json:"data,omitempty"`
}

type CpuStats

type CpuStats struct {
	Usage struct {
		// Total CPU usage.
		// Units: nanoseconds
		Total uint64 `json:"total"`

		// Per CPU/core usage of the container.
		// Unit: nanoseconds.
		PerCpu []uint64 `json:"per_cpu_usage,omitempty"`

		// Time spent in user space.
		// Unit: nanoseconds
		User uint64 `json:"user"`

		// Time spent in kernel space.
		// Unit: nanoseconds
		System uint64 `json:"system"`
	} `json:"usage"`
	Load int32 `json:"load"`
}

All CPU usage metrics are cumulative from the creation of the container

type Interference

type Interference struct {
	// Absolute name of the antagonist container name. This field
	// should not be empty.
	Antagonist string `json:"antagonist"`

	// The absolute path of the victims. This field should not be empty.
	Victims []string `json:"victims"`

	// The name of the detector used to detect this antagonism. This field
	// should not be empty
	Detector string `json:"detector"`

	// Human readable description of this interference
	Description string `json:"description,omitempty"`
}

This struct describes one type of relationship between containers: One container, antagonist, interferes the performance of other containers, victims.

type MachineInfo

type MachineInfo struct {
	// The number of cores in this machine.
	NumCores int `json:"num_cores"`

	// The amount of memory (in bytes) in this machine
	MemoryCapacity int64 `json:"memory_capacity"`
}

type MachineInfoFactory

type MachineInfoFactory interface {
	GetMachineInfo() (*MachineInfo, error)
	GetVersionInfo() (*VersionInfo, error)
}

type MemorySpec

type MemorySpec struct {
	// The amount of memory requested. Default is unlimited (-1).
	// Units: bytes.
	Limit uint64 `json:"limit,omitempty"`

	// The amount of guaranteed memory.  Default is 0.
	// Units: bytes.
	Reservation uint64 `json:"reservation,omitempty"`

	// The amount of swap space requested. Default is unlimited (-1).
	// Units: bytes.
	SwapLimit uint64 `json:"swap_limit,omitempty"`
}

type MemoryStats

type MemoryStats struct {
	// Memory limit, equivalent to "limit" in MemorySpec.
	// Units: Bytes.
	Limit uint64 `json:"limit,omitempty"`

	// Current memory usage, this includes all memory regardless of when it was
	// accessed.
	// Units: Bytes.
	Usage uint64 `json:"usage,omitempty"`

	// The amount of working set memory, this includes recently accessed memory,
	// dirty memory, and kernel memory. Working set is <= "usage".
	// Units: Bytes.
	WorkingSet uint64 `json:"working_set,omitempty"`

	ContainerData    MemoryStatsMemoryData `json:"container_data,omitempty"`
	HierarchicalData MemoryStatsMemoryData `json:"hierarchical_data,omitempty"`
}

type MemoryStatsMemoryData

type MemoryStatsMemoryData struct {
	Pgfault    uint64 `json:"pgfault,omitempty"`
	Pgmajfault uint64 `json:"pgmajfault,omitempty"`
}

type Percentile

type Percentile struct {
	Percentage int    `json:"percentage"`
	Value      uint64 `json:"value"`
}

type VersionInfo

type VersionInfo struct {
	// Kernel version.
	KernelVersion string `json:"kernel_version"`

	// OS image being used for cadvisor container, or host image if running on host directly.
	ContainerOsVersion string `json:"container_os_version"`

	// Docker version.
	DockerVersion string `json:"docker_version"`

	// cAdvisor version.
	CadvisorVersion string `json:"cadvisor_version"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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