metriccache

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeCPUInfoRecordType = "NodeCPUInfo"
)

Variables

This section is empty.

Functions

func NewCacheNotShareStorage

func NewCacheNotShareStorage() (*storage, error)

func NewStorage

func NewStorage() (*storage, error)

Types

type AggregateInfo

type AggregateInfo struct {
	MetricsCount int64
}

type AggregateParam

type AggregateParam struct {
	ValueFieldName string
	TimeFieldName  string
}

type AggregationType

type AggregationType string
const (
	AggregationTypeAVG   AggregationType = "AVG"
	AggregationTypeP90   AggregationType = "P90"
	AggregationTypeLast  AggregationType = "last"
	AggregationTypeCount AggregationType = "count"
)

type BECPUResourceMetric

type BECPUResourceMetric struct {
	CPUUsed      resource.Quantity // cpuUsed cores for BestEffort Cgroup
	CPURealLimit resource.Quantity // suppressCPUQuantity: if suppress by cfs_quota then this  value is cfs_quota/cfs_period
	CPURequest   resource.Quantity // sum(extendResources_Cpu:request) by all qos:BE pod
}

type BECPUResourceQueryResult

type BECPUResourceQueryResult struct {
	QueryResult
	Metric *BECPUResourceMetric
}

type CPUMetric

type CPUMetric struct {
	CPUUsed resource.Quantity
}

type CPUThrottledMetric

type CPUThrottledMetric struct {
	ThrottledRatio float64
}

type Config

type Config struct {
	MetricGCIntervalSeconds int
	MetricExpireSeconds     int
}

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) InitFlags

func (c *Config) InitFlags(fs *flag.FlagSet)

type ContainerResourceMetric

type ContainerResourceMetric struct {
	ContainerID string
	CPUUsed     CPUMetric
	MemoryUsed  MemoryMetric
}

type ContainerResourceQueryResult

type ContainerResourceQueryResult struct {
	QueryResult
	Metric *ContainerResourceMetric
}

type ContainerThrottledMetric

type ContainerThrottledMetric struct {
	ContainerID        string
	CPUThrottledMetric *CPUThrottledMetric
}

type ContainerThrottledQueryResult

type ContainerThrottledQueryResult struct {
	QueryResult
	Metric *ContainerThrottledMetric
}

type MemoryMetric

type MemoryMetric struct {
	MemoryWithoutCache resource.Quantity
}

type MetricCache

type MetricCache interface {
	Run(stopCh <-chan struct{}) error
	GetNodeResourceMetric(param *QueryParam) NodeResourceQueryResult
	GetPodResourceMetric(podUID *string, param *QueryParam) PodResourceQueryResult
	GetContainerResourceMetric(containerID *string, param *QueryParam) ContainerResourceQueryResult
	GetNodeCPUInfo(param *QueryParam) (*NodeCPUInfo, error)
	GetBECPUResourceMetric(param *QueryParam) BECPUResourceQueryResult
	GetPodThrottledMetric(podUID *string, param *QueryParam) PodThrottledQueryResult
	GetContainerThrottledMetric(containerID *string, param *QueryParam) ContainerThrottledQueryResult
	InsertNodeResourceMetric(t time.Time, nodeResUsed *NodeResourceMetric) error
	InsertPodResourceMetric(t time.Time, podResUsed *PodResourceMetric) error
	InsertContainerResourceMetric(t time.Time, containerResUsed *ContainerResourceMetric) error
	InsertNodeCPUInfo(info *NodeCPUInfo) error
	InsertBECPUResourceMetric(t time.Time, metric *BECPUResourceMetric) error
	InsertPodThrottledMetrics(t time.Time, metric *PodThrottledMetric) error
	InsertContainerThrottledMetrics(t time.Time, metric *ContainerThrottledMetric) error
}

func NewCacheNotShareMetricCache

func NewCacheNotShareMetricCache(cfg *Config) (MetricCache, error)

func NewMetricCache

func NewMetricCache(cfg *Config) (MetricCache, error)

type NodeCPUInfo

type NodeCPUInfo util.LocalCPUInfo

type NodeResourceMetric

type NodeResourceMetric struct {
	CPUUsed    CPUMetric
	MemoryUsed MemoryMetric
}

type NodeResourceQueryResult

type NodeResourceQueryResult struct {
	QueryResult
	Metric *NodeResourceMetric
}

type PodResourceMetric

type PodResourceMetric struct {
	PodUID     string
	CPUUsed    CPUMetric
	MemoryUsed MemoryMetric
}

type PodResourceQueryResult

type PodResourceQueryResult struct {
	QueryResult
	Metric *PodResourceMetric
}

type PodThrottledMetric

type PodThrottledMetric struct {
	PodUID             string
	CPUThrottledMetric *CPUThrottledMetric
}

type PodThrottledQueryResult

type PodThrottledQueryResult struct {
	QueryResult
	Metric *PodThrottledMetric
}

type QueryParam

type QueryParam struct {
	Aggregate AggregationType
	Start     *time.Time
	End       *time.Time
}

func (*QueryParam) FillDefaultValue

func (q *QueryParam) FillDefaultValue()

type QueryResult

type QueryResult struct {
	AggregateInfo *AggregateInfo
	Error         error
}

Directories

Path Synopsis
Package mock_metriccache is a generated GoMock package.
Package mock_metriccache is a generated GoMock package.

Jump to

Keyboard shortcuts

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