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 ¶
Return aggregated percentiles from the provided percentile samples.
func GetMinutePercentiles ¶
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 storage/memory. The main difference is that we do not pre-allocate the buffer as most containers won't live that long.
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.