summary

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Maintains the summary of aggregated minute, hour, and day stats. For a container running for more than a day, amount of tracked data can go up to 40 KB when cpu and memory are tracked. We'll start by enabling collection for the node, followed by docker, and then all containers as we understand the usage pattern better TODO(rjnagal): Optimize the size if we start running it for every container.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDerivedPercentiles

func GetDerivedPercentiles(stats []*info.Usage) info.Usage

Return aggregated percentiles from the provided percentile samples.

func GetMinutePercentiles

func GetMinutePercentiles(stats []*secondSample) info.Usage

Returns a percentile sample for a minute by aggregating seconds samples.

func NewResource

func NewResource(size int) *resource

Types

type SamplesBuffer

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

Manages a buffer of usage samples. This is similar to stats buffer in cache/memory. The main difference is that we do not pre-allocate the buffer as most containers won't live that long.

func NewSamplesBuffer

func NewSamplesBuffer(size int) *SamplesBuffer

Initializes an empty buffer.

func (*SamplesBuffer) Add

func (s *SamplesBuffer) Add(stat info.Usage)

Add an element to the buffer. Oldest one is overwritten if required.

func (*SamplesBuffer) RecentStats

func (s *SamplesBuffer) RecentStats(n int) []*info.Usage

Returns pointers to the last 'n' stats.

func (*SamplesBuffer) Size

func (s *SamplesBuffer) Size() int

Returns the current number of samples in the buffer.

type StatsSummary

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

func New

func New(spec v1.ContainerSpec) (*StatsSummary, error)

func (*StatsSummary) AddSample

func (s *StatsSummary) AddSample(stat v1.ContainerStats) error

Adds a new seconds sample. If enough seconds samples are collected, a minute sample is generated and derived stats are updated.

func (*StatsSummary) DerivedStats

func (s *StatsSummary) DerivedStats() (info.DerivedStats, error)

Return the latest calculated derived stats.

type Uint64Slice added in v1.0.5

type Uint64Slice []uint64

func (Uint64Slice) GetPercentile added in v1.0.5

func (self Uint64Slice) GetPercentile(d float64) uint64

Get percentile of the provided samples. Round to integer.

func (Uint64Slice) Len added in v1.0.5

func (a Uint64Slice) Len() int

func (Uint64Slice) Less added in v1.0.5

func (a Uint64Slice) Less(i, j int) bool

func (Uint64Slice) Swap added in v1.0.5

func (a Uint64Slice) Swap(i, j int)

Jump to

Keyboard shortcuts

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