summary

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 284

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.

Types

type Percentile added in v0.37.0

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

func NewResource

func NewResource(size int) Percentile

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

type Uint64Slice []uint64

func (Uint64Slice) GetPercentile

func (s Uint64Slice) GetPercentile(d float64) uint64

Get percentile of the provided samples. Round to integer.

func (Uint64Slice) Len

func (s Uint64Slice) Len() int

func (Uint64Slice) Less

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

func (Uint64Slice) Swap

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

Jump to

Keyboard shortcuts

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