cadvisor: github.com/google/cadvisor/summary Index | Files

package summary

import "github.com/google/cadvisor/summary"

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

Package Files

buffer.go percentiles.go summary.go

func GetDerivedPercentiles Uses

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

Return aggregated percentiles from the provided percentile samples.

func GetMinutePercentiles Uses

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

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

type Percentile Uses

type Percentile interface {
    Add(info.Percentiles)
    AddSample(uint64)
    GetAllPercentiles() info.Percentiles
}

func NewResource Uses

func NewResource(size int) Percentile

type SamplesBuffer Uses

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 Uses

func NewSamplesBuffer(size int) *SamplesBuffer

Initializes an empty buffer.

func (*SamplesBuffer) Add Uses

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

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

func (*SamplesBuffer) RecentStats Uses

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

Returns pointers to the last 'n' stats.

func (*SamplesBuffer) Size Uses

func (s *SamplesBuffer) Size() int

Returns the current number of samples in the buffer.

type StatsSummary Uses

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

func New Uses

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

func (*StatsSummary) AddSample Uses

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 Uses

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

Return the latest calculated derived stats.

type Uint64Slice Uses

type Uint64Slice []uint64

func (Uint64Slice) GetPercentile Uses

func (s Uint64Slice) GetPercentile(d float64) uint64

Get percentile of the provided samples. Round to integer.

func (Uint64Slice) Len Uses

func (s Uint64Slice) Len() int

func (Uint64Slice) Less Uses

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

func (Uint64Slice) Swap Uses

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

Package summary imports 7 packages (graph) and is imported by 126 packages. Updated 2020-06-10. Refresh now. Tools for package owners.