Documentation
¶
Overview ¶
Package stats handles exporting Kubelet and container stats. NOTE: We intend to move this functionality into a standalone pod, so this package should be very loosely coupled to the rest of the Kubelet.
Index ¶
- func CreateHandlers(provider StatsProvider, resourceAnalyzer ResourceAnalyzer) *restful.WebService
- type Cache
- type MockStatsProvider
- func (_m *MockStatsProvider) DockerImagesFsInfo() (cadvisorapiv2.FsInfo, error)
- func (_m *MockStatsProvider) GetContainerInfo(podFullName string, uid types.UID, containerName string, ...) (*cadvisorapi.ContainerInfo, error)
- func (_m *MockStatsProvider) GetContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error)
- func (_m *MockStatsProvider) GetNode() (*api.Node, error)
- func (_m *MockStatsProvider) GetNodeConfig() cm.NodeConfig
- func (_m *MockStatsProvider) GetPodByName(namespace string, name string) (*api.Pod, bool)
- func (_m *MockStatsProvider) GetPods() []*api.Pod
- func (_m *MockStatsProvider) GetRawContainerInfo(containerName string, req *cadvisorapi.ContainerInfoRequest, ...) (map[string]*cadvisorapi.ContainerInfo, error)
- func (_m *MockStatsProvider) ListVolumesForPod(podUID types.UID) (map[string]volume.Volume, bool)
- func (_m *MockStatsProvider) RootFsInfo() (cadvisorapiv2.FsInfo, error)
- type PodVolumeStats
- type ResourceAnalyzer
- type StatsProvider
- type StatsRequest
- type SummaryProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHandlers ¶
func CreateHandlers(provider StatsProvider, resourceAnalyzer ResourceAnalyzer) *restful.WebService
Types ¶
type Cache ¶
type Cache map[types.UID]*PodVolumeStats
Map to PodVolumeStats pointers since the addresses for map values are not constant and can cause pain if we need ever to get a pointer to one of the values (e.g. you can't)
type MockStatsProvider ¶
func (*MockStatsProvider) DockerImagesFsInfo ¶
func (_m *MockStatsProvider) DockerImagesFsInfo() (cadvisorapiv2.FsInfo, error)
DockerImagesFsInfo provides a mock function with given fields:
func (*MockStatsProvider) GetContainerInfo ¶
func (_m *MockStatsProvider) GetContainerInfo(podFullName string, uid types.UID, containerName string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
GetContainerInfo provides a mock function with given fields: podFullName, uid, containerName, req
func (*MockStatsProvider) GetContainerInfoV2 ¶
func (_m *MockStatsProvider) GetContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error)
GetContainerInfoV2 provides a mock function with given fields: name, options
func (*MockStatsProvider) GetNode ¶
func (_m *MockStatsProvider) GetNode() (*api.Node, error)
GetNode provides a mock function with given fields:
func (*MockStatsProvider) GetNodeConfig ¶
func (_m *MockStatsProvider) GetNodeConfig() cm.NodeConfig
GetNodeConfig provides a mock function with given fields:
func (*MockStatsProvider) GetPodByName ¶
GetPodByName provides a mock function with given fields: namespace, name
func (*MockStatsProvider) GetPods ¶
func (_m *MockStatsProvider) GetPods() []*api.Pod
GetPods provides a mock function with given fields:
func (*MockStatsProvider) GetRawContainerInfo ¶
func (_m *MockStatsProvider) GetRawContainerInfo(containerName string, req *cadvisorapi.ContainerInfoRequest, subcontainers bool) (map[string]*cadvisorapi.ContainerInfo, error)
GetRawContainerInfo provides a mock function with given fields: containerName, req, subcontainers
func (*MockStatsProvider) ListVolumesForPod ¶
ListVolumesForPod provides a mock function with given fields: podUID
func (*MockStatsProvider) RootFsInfo ¶
func (_m *MockStatsProvider) RootFsInfo() (cadvisorapiv2.FsInfo, error)
RootFsInfo provides a mock function with given fields:
type PodVolumeStats ¶
type PodVolumeStats struct {
Volumes []stats.VolumeStats
}
PodVolumeStats encapsulates all VolumeStats for a pod
type ResourceAnalyzer ¶
type ResourceAnalyzer interface {
Start()
// contains filtered or unexported methods
}
ResourceAnalyzer provides statistics on node resource consumption
func NewResourceAnalyzer ¶
func NewResourceAnalyzer(statsProvider StatsProvider, calVolumeFrequency time.Duration) ResourceAnalyzer
NewResourceAnalyzer returns a new ResourceAnalyzer
type StatsProvider ¶
type StatsProvider interface {
GetContainerInfo(podFullName string, uid types.UID, containerName string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
GetContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error)
GetRawContainerInfo(containerName string, req *cadvisorapi.ContainerInfoRequest, subcontainers bool) (map[string]*cadvisorapi.ContainerInfo, error)
GetPodByName(namespace, name string) (*api.Pod, bool)
GetNode() (*api.Node, error)
GetNodeConfig() cm.NodeConfig
DockerImagesFsInfo() (cadvisorapiv2.FsInfo, error)
RootFsInfo() (cadvisorapiv2.FsInfo, error)
ListVolumesForPod(podUID types.UID) (map[string]volume.Volume, bool)
GetPods() []*api.Pod
}
Host methods required by stats handlers.
type StatsRequest ¶
type StatsRequest struct {
// The name of the container for which to request stats.
// Default: /
ContainerName string `json:"containerName,omitempty"`
// Max number of stats to return.
// If start and end time are specified this limit is ignored.
// Default: 60
NumStats int `json:"num_stats,omitempty"`
// Start time for which to query information.
// If omitted, the beginning of time is assumed.
Start time.Time `json:"start,omitempty"`
// End time for which to query information.
// If omitted, current time is assumed.
End time.Time `json:"end,omitempty"`
// Whether to also include information from subcontainers.
// Default: false.
Subcontainers bool `json:"subcontainers,omitempty"`
}
type SummaryProvider ¶
type SummaryProvider interface {
// Get provides a new Summary using the latest results from cadvisor
Get() (*stats.Summary, error)
}
func NewSummaryProvider ¶
func NewSummaryProvider(statsProvider StatsProvider, resourceAnalyzer ResourceAnalyzer) SummaryProvider
NewSummaryProvider returns a new SummaryProvider