cgroupstore

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0, BSD-3-Clause, MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubernetesPodNameLabel       = "io.kubernetes.pod.name"
	KubernetesPodNamespaceLabel  = "io.kubernetes.pod.namespace"
	KubernetesPodUIDLabel        = "io.kubernetes.pod.uid"
	KubernetesContainerNameLabel = "io.kubernetes.container.name"

	PodInfraContainerName = "POD"
)

Variables

This section is empty.

Functions

func GetContainerName

func GetContainerName(labels map[string]string) string

GetContainerName get pod container name from docker container labels

func GetPodName

func GetPodName(labels map[string]string) string

GetPodName get pod name from docker container labels

func GetPodNamespace

func GetPodNamespace(labels map[string]string) string

GetPodNamespace get pod namespace from docker container labels

func GetPodUID

func GetPodUID(labels map[string]string) string

GetPodUID get pod uid from docker container labels

Types

type CgroupRef

type CgroupRef struct {
	Name          string
	ContainerName string
	PodName       string
	PodNamespace  string
	PodUid        string
	AppClass      appclass.AppClass
}

CgroupRef group pod infos

type CgroupStats

type CgroupStats struct {
	Ref                   *CgroupRef `structs:"ref,omitempty"`
	CpuUsage              float64    `structs:"cpu_usage"`
	NrCpuThrottled        float64    `structs:"nr_cpu_throttled"`
	LoadAvg               float64    `structs:"load_avg"`
	MemoryTotalUsage      float64    `structs:"memory_total_usage"`
	MemoryWorkingSetUsage float64    `structs:"memory_working_set_usage"`
	MemoryCacheUsage      float64    `structs:"memory_cache_usage"`
	TcpOOM                float64    `structs:"tcp_oom"`
	ListenOverflows       float64    `structs:"listen_overflows"`
	RxBps                 float64    `structs:"rx_bps"`
	RxPps                 float64    `structs:"rx_pps"`
	TxBps                 float64    `structs:"tx_bps"`
	TxPps                 float64    `structs:"tx_pps"`

	Timestamp time.Time `structs:"timestamp,omitempty"`
}

CgroupStats group cgroup state options

func (*CgroupStats) GetTags

func (cg *CgroupStats) GetTags() []string

GetTags get all tags for the struct

func (*CgroupStats) GetValue

func (cg *CgroupStats) GetValue(resource string) (float64, error)

GetValue get resource data by the struct tag

type CgroupStore

type CgroupStore interface {
	Run(stop <-chan struct{})
	CgroupStoreInterface
}

CgroupStore describe cgroup resource state interface inherit from state store

func NewCgroupStoreManager

func NewCgroupStoreManager(config types.MetricsContainerConfig,
	podInformer cache.SharedIndexInformer) CgroupStore

NewCgroupStoreManager create a ContainerStats instance to collect container metrics

type CgroupStoreInterface

type CgroupStoreInterface interface {
	MachineInfo() (*cadvisorapi.MachineInfo, error)

	GetCgroupResourceRangeStats(podName, podNamespace string, start, end time.Time, count int) ([]*CgroupStats, error)
	GetCgroupResourceRecentState(podName, podNamespace string, updateStats bool) (*CgroupStats, error)
	GetCgroupResourceRecentStateByPath(cgPath string, updateStats bool) (*CgroupStats, error)

	ListCgroupResourceRangeStats(start, end time.Time, count int, classFilter sets.String) (
		map[string][]*CgroupStats, error)
	ListCgroupResourceRecentState(updateStats bool, classFilter sets.String) (map[string]*CgroupStats, error)
	ListAllCgroups(classFilter sets.String) (map[string]*CgroupRef, error)

	// AddExtraCgroups will restart cadvisor manager with high cost, so should try not call the function
	AddExtraCgroups(extraCgs []string) error

	GetCgroupStoreSupportedTags() []string
}

CgroupStoreInterface describe cgroup resource state interface

Jump to

Keyboard shortcuts

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