Merge pull request #400 from liubin/wip/add-pod-overhead

runtime: add pod overhead metrics
This commit is contained in:
Peng Tao
2020-07-13 11:02:12 +08:00
committed by GitHub
8 changed files with 250 additions and 1 deletions

View File

@@ -68,6 +68,8 @@ type VCSandbox interface {
ID() string
SetAnnotations(annotations map[string]string) error
Stats() (SandboxStats, error)
Start() error
Stop(force bool) error
Release() error

View File

@@ -125,6 +125,9 @@ func (s *Sandbox) StatusContainer(contID string) (vc.ContainerStatus, error) {
// StatsContainer implements the VCSandbox function of the same name.
func (s *Sandbox) StatsContainer(contID string) (vc.ContainerStats, error) {
if s.StatsContainerFunc != nil {
return s.StatsContainerFunc(contID)
}
return vc.ContainerStats{}, nil
}
@@ -232,3 +235,11 @@ func (s *Sandbox) GetAgentMetrics() (string, error) {
}
return "", nil
}
// Stats implements the VCSandbox function of the same name.
func (s *Sandbox) Stats() (vc.SandboxStats, error) {
if s.StatsFunc != nil {
return s.StatsFunc()
}
return vc.SandboxStats{}, nil
}

View File

@@ -66,6 +66,7 @@ type Sandbox struct {
ListRoutesFunc func() ([]*vcTypes.Route, error)
UpdateRuntimeMetricsFunc func() error
GetAgentMetricsFunc func() (string, error)
StatsFunc func() (vc.SandboxStats, error)
}
// Container is a fake Container type used for testing