Documentation ¶
Index ¶
- Constants
- func CollectorsHasStarted(collectors map[string]Collector) bool
- func DeviceCollectorsStarted(devices map[string]DeviceCollector) bool
- type AndPodFilter
- type CPUStat
- type Collector
- type CollectorFactory
- type Config
- type Context
- type DeviceCollector
- type DeviceFactory
- type LatestMetric
- type NothingPodFilter
- type Options
- type PodCollector
- type PodFilter
- type SharedState
- func (r *SharedState) GetHostAppUsage() (cpu, memory *metriccache.Point)
- func (r *SharedState) GetNodeUsage() (cpu, memory *metriccache.Point)
- func (r *SharedState) GetPodsUsageByCollector() (cpu, memory map[string]metriccache.Point)
- func (r *SharedState) UpdateHostAppUsage(cpu, memory metriccache.Point)
- func (r *SharedState) UpdateNodeUsage(cpu, memory metriccache.Point)
- func (r *SharedState) UpdatePodUsage(collectorName string, cpu, memory metriccache.Point)
- type TerminatedPodFilter
Constants ¶
View Source
const ( CleanupInterval = 600 * time.Second ContextExpiredRatio = 20 )
Variables ¶
This section is empty.
Functions ¶
func CollectorsHasStarted ¶
func DeviceCollectorsStarted ¶
func DeviceCollectorsStarted(devices map[string]DeviceCollector) bool
Types ¶
type AndPodFilter ¶ added in v1.3.0
type AndPodFilter struct {
Filters []PodFilter
}
func (*AndPodFilter) FilterPod ¶ added in v1.3.0
func (a *AndPodFilter) FilterPod(podMeta *statesinformer.PodMeta) (bool, string)
type CollectorFactory ¶
type Config ¶
type Config struct { CollectResUsedInterval time.Duration CollectSysMetricOutdatedInterval time.Duration CollectNodeCPUInfoInterval time.Duration CollectNodeStorageInfoInterval time.Duration CPICollectorInterval time.Duration PSICollectorInterval time.Duration CPICollectorTimeWindow time.Duration ColdPageCollectorInterval time.Duration EnablePageCacheCollector bool }
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type Context ¶
type Context struct { DeviceCollectors map[string]DeviceCollector Collectors map[string]Collector State *SharedState }
type DeviceCollector ¶
type DeviceCollector interface { Collector Shutdown() Started() bool Infos() metriccache.Devices GetNodeMetric() ([]metriccache.MetricSample, error) GetPodMetric(uid, podParentDir string, cs []corev1.ContainerStatus) ([]metriccache.MetricSample, error) GetContainerMetric(containerID, podParentDir string, c *corev1.ContainerStatus) ([]metriccache.MetricSample, error) }
type DeviceFactory ¶
type DeviceFactory = func(opt *Options) DeviceCollector
type LatestMetric ¶ added in v1.3.0
type LatestMetric struct {
// contains filtered or unexported fields
}
type NothingPodFilter ¶ added in v1.3.0
type NothingPodFilter struct{}
func (*NothingPodFilter) FilterPod ¶ added in v1.3.0
func (n *NothingPodFilter) FilterPod(podMeta *statesinformer.PodMeta) (bool, string)
type Options ¶
type Options struct { Config *Config StatesInformer statesinformer.StatesInformer MetricCache metriccache.MetricCache CgroupReader resourceexecutor.CgroupReader PodFilters map[string]PodFilter }
type PodCollector ¶ added in v1.3.0
type PodFilter ¶ added in v1.3.0
type PodFilter interface { // FilterPod returns true if the collector should skip collecting the pod. FilterPod(podMeta *statesinformer.PodMeta) (shouldSkip bool, msg string) }
var DefaultPodFilter PodFilter = &NothingPodFilter{}
DefaultPodFilter filters nothing and allows collection for all pods.
func NewAndPodFilter ¶ added in v1.3.0
type SharedState ¶ added in v1.3.0
type SharedState struct {
}SharedState is for sharing infos across collectors, for example the system resource collector use the result of pod and node resource collector for calculating system usage
func NewSharedState ¶ added in v1.3.0
func NewSharedState() *SharedState
func (*SharedState) GetHostAppUsage ¶ added in v1.4.0
func (r *SharedState) GetHostAppUsage() (cpu, memory *metriccache.Point)
func (*SharedState) GetNodeUsage ¶ added in v1.3.0
func (r *SharedState) GetNodeUsage() (cpu, memory *metriccache.Point)
func (*SharedState) GetPodsUsageByCollector ¶ added in v1.3.0
func (r *SharedState) GetPodsUsageByCollector() (cpu, memory map[string]metriccache.Point)
func (*SharedState) UpdateHostAppUsage ¶ added in v1.4.0
func (r *SharedState) UpdateHostAppUsage(cpu, memory metriccache.Point)
func (*SharedState) UpdateNodeUsage ¶ added in v1.3.0
func (r *SharedState) UpdateNodeUsage(cpu, memory metriccache.Point)
func (*SharedState) UpdatePodUsage ¶ added in v1.3.0
func (r *SharedState) UpdatePodUsage(collectorName string, cpu, memory metriccache.Point)
type TerminatedPodFilter ¶ added in v1.3.0
type TerminatedPodFilter struct{}
func (*TerminatedPodFilter) FilterPod ¶ added in v1.3.0
func (t *TerminatedPodFilter) FilterPod(podMeta *statesinformer.PodMeta) (bool, string)
Click to show internal directories.
Click to hide internal directories.