metriccache

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: Apache-2.0 Imports: 16 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 {
	// TODO only support node resource metric now
	MetricStart *time.Time
	MetricEnd   *time.Time

	MetricsCount int64
}

func (*AggregateInfo) TimeRangeDuration added in v1.1.0

func (a *AggregateInfo) TimeRangeDuration() time.Duration

type AggregateParam

type AggregateParam struct {
	ValueFieldName string
	TimeFieldName  string
}

type AggregationFunc added in v0.6.0

type AggregationFunc func(interface{}, AggregateParam) (float64, error)

type AggregationType

type AggregationType string
const (
	AggregationTypeAVG   AggregationType = "avg"
	AggregationTypeP99   AggregationType = "p99"
	AggregationTypeP95   AggregationType = "P95"
	AggregationTypeP90   AggregationType = "P90"
	AggregationTypeP50   AggregationType = "p50"
	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 CPIMetric added in v1.0.0

type CPIMetric struct {
	Cycles       uint64
	Instructions uint64
}

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 ContainerInterferenceMetric added in v1.0.0

type ContainerInterferenceMetric struct {
	MetricName  InterferenceMetricName
	PodUID      string
	ContainerID string
	MetricValue interface{}
}

type ContainerInterferenceQueryResult added in v1.0.0

type ContainerInterferenceQueryResult struct {
	QueryResult
	Metric *ContainerInterferenceMetric
}

type ContainerResourceMetric

type ContainerResourceMetric struct {
	ContainerID string
	CPUUsed     CPUMetric
	MemoryUsed  MemoryMetric
	GPUs        []GPUMetric
}

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 GPUMetric added in v0.6.0

type GPUMetric struct {
	Minor       int32             // index starting from 0
	DeviceUUID  string            // device UUID
	SMUtil      uint32            // current utilization rate for the device
	MemoryUsed  resource.Quantity // used memory on the device, in bytes
	MemoryTotal resource.Quantity // total memory on device, in bytes
}

type GPUMetricsArray added in v0.6.0

type GPUMetricsArray []gpuResourceMetric

func (*GPUMetricsArray) Scan added in v0.6.0

func (array *GPUMetricsArray) Scan(value interface{}) error

Implement gorm customize data type. Read data from database.

func (GPUMetricsArray) Value added in v0.6.0

func (array GPUMetricsArray) Value() (driver.Value, error)

Implement gorm customize data type. Write data to database.

type InterferenceMetricName added in v1.0.0

type InterferenceMetricName string
const (
	MetricNameContainerCPI InterferenceMetricName = "ContainerCPI"
	MetricNameContainerPSI InterferenceMetricName = "ContainerPSI"

	MetricNamePodCPI InterferenceMetricName = "PodCPI"
	MetricNamePodPSI InterferenceMetricName = "PodPSI"
)

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
	GetContainerInterferenceMetric(metricName InterferenceMetricName, podUID *string, containerID *string, param *QueryParam) ContainerInterferenceQueryResult
	GetPodInterferenceMetric(metricName InterferenceMetricName, podUID *string, param *QueryParam) PodInterferenceQueryResult
	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
	InsertContainerInterferenceMetrics(t time.Time, metric *ContainerInterferenceMetric) error
	InsertPodInterferenceMetrics(t time.Time, metric *PodInterferenceMetric) 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
	GPUs       []GPUMetric
}

type NodeResourceQueryResult

type NodeResourceQueryResult struct {
	QueryResult
	Metric *NodeResourceMetric
}

type PSIMetric added in v1.1.0

type PSIMetric struct {
	SomeCPUAvg10 float64
	SomeMemAvg10 float64
	SomeIOAvg10  float64

	FullCPUAvg10 float64
	FullMemAvg10 float64
	FullIOAvg10  float64

	CPUFullSupported bool
}

type PodInterferenceMetric added in v1.0.0

type PodInterferenceMetric struct {
	MetricName  InterferenceMetricName
	PodUID      string
	MetricValue interface{}
}

type PodInterferenceQueryResult added in v1.0.0

type PodInterferenceQueryResult struct {
	QueryResult
	Metric *PodInterferenceMetric
}

type PodResourceMetric

type PodResourceMetric struct {
	PodUID     string
	CPUUsed    CPUMetric
	MemoryUsed MemoryMetric
	GPUs       []GPUMetric
}

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