gofmt -r "ContainerStatsSummary->ContainerStatsPercentiles"
This commit is contained in:
parent
f07a91c0cc
commit
71835f9bc4
@ -35,12 +35,12 @@ type ContainerHandler interface {
|
||||
ListContainers(listType ListType) ([]string, error)
|
||||
ListThreads(listType ListType) ([]int, error)
|
||||
ListProcesses(listType ListType) ([]int, error)
|
||||
StatsSummary() (*info.ContainerStatsSummary, error)
|
||||
StatsSummary() (*info.ContainerStatsPercentiles, error)
|
||||
}
|
||||
|
||||
type NoStatsSummary struct {
|
||||
}
|
||||
|
||||
func (self *NoStatsSummary) StatsSummary() (*info.ContainerStatsSummary, error) {
|
||||
func (self *NoStatsSummary) StatsSummary() (*info.ContainerStatsPercentiles, error) {
|
||||
return nil, fmt.Errorf("This method (StatsSummary) should never be called")
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ import (
|
||||
|
||||
type statsSummaryContainerHandlerWrapper struct {
|
||||
handler ContainerHandler
|
||||
currentSummary *info.ContainerStatsSummary
|
||||
prevStats *info.ContainerStats
|
||||
numStats uint64
|
||||
sampler sampling.Sampler
|
||||
lock sync.Mutex
|
||||
currentSummary *info.ContainerStatsPercentiles
|
||||
prevStats *info.ContainerStats
|
||||
numStats uint64
|
||||
sampler sampling.Sampler
|
||||
lock sync.Mutex
|
||||
}
|
||||
|
||||
func (self *statsSummaryContainerHandlerWrapper) GetSpec() (*info.ContainerSpec, error) {
|
||||
@ -78,7 +78,7 @@ func (self *statsSummaryContainerHandlerWrapper) GetStats() (*info.ContainerStat
|
||||
}
|
||||
self.updatePrevStats(stats)
|
||||
if self.currentSummary == nil {
|
||||
self.currentSummary = new(info.ContainerStatsSummary)
|
||||
self.currentSummary = new(info.ContainerStatsPercentiles)
|
||||
}
|
||||
self.numStats++
|
||||
if stats.Memory != nil {
|
||||
@ -101,7 +101,7 @@ func (self *statsSummaryContainerHandlerWrapper) ListProcesses(listType ListType
|
||||
return self.handler.ListProcesses(listType)
|
||||
}
|
||||
|
||||
func (self *statsSummaryContainerHandlerWrapper) StatsSummary() (*info.ContainerStatsSummary, error) {
|
||||
func (self *statsSummaryContainerHandlerWrapper) StatsSummary() (*info.ContainerStatsPercentiles, error) {
|
||||
self.lock.Lock()
|
||||
defer self.lock.Unlock()
|
||||
samples := make([]*info.ContainerStatsSample, 0, self.sampler.Len())
|
||||
@ -132,7 +132,7 @@ func AddStatsSummary(handler ContainerHandler, parameter *StatsParameter) (Conta
|
||||
}
|
||||
return &statsSummaryContainerHandlerWrapper{
|
||||
handler: handler,
|
||||
currentSummary: &info.ContainerStatsSummary{},
|
||||
currentSummary: &info.ContainerStatsPercentiles{},
|
||||
sampler: sampler,
|
||||
}, nil
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ type ContainerInfo struct {
|
||||
// Historical statistics gathered from the container.
|
||||
Stats []*ContainerStats `json:"stats,omitempty"`
|
||||
|
||||
StatsSummary *ContainerStatsSummary `json:"stats_summary,omitempty"`
|
||||
StatsSummary *ContainerStatsPercentiles `json:"stats_summary,omitempty"`
|
||||
}
|
||||
|
||||
func (self *ContainerInfo) StatsAfter(ref time.Time) []*ContainerStats {
|
||||
@ -177,7 +177,7 @@ type percentile struct {
|
||||
Value uint64 `json:"value"`
|
||||
}
|
||||
|
||||
type ContainerStatsSummary struct {
|
||||
type ContainerStatsPercentiles struct {
|
||||
// TODO(dengnan): More things?
|
||||
MaxMemoryUsage uint64 `json:"max_memory_usage,omitempty"`
|
||||
Samples []*ContainerStatsSample `json:"samples,omitempty"`
|
||||
@ -263,7 +263,7 @@ func intZipuint64(as []int, bs []uint64) []percentile {
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self *ContainerStatsSummary) FillPercentiles(cpuPercentages, memoryPercentages []int) {
|
||||
func (self *ContainerStatsPercentiles) FillPercentiles(cpuPercentages, memoryPercentages []int) {
|
||||
if len(self.Samples) == 0 {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user