types

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExternalMetricManager

type ExternalMetricManager interface {
	// RegisterExternalMetric register a function to set metric that can
	// only be obtained from external sources
	RegisterExternalMetric(f func(store *metric.MetricStore))
	Sample()
}

type MetricsFetcher

type MetricsFetcher interface {
	// Run starts the preparing logic to collect node metadata.
	Run(ctx context.Context)

	// RegisterNotifier register a channel for raw metric, any time when metric
	// changes, send a data into this given channel along with current time, and
	// we will return a unique key to help with deRegister logic.
	//
	// this "current time" may not represent precisely time when this metric
	// is at, but it indeed is the most precise time katalyst system can provide.
	RegisterNotifier(scope MetricsScope, req NotifiedRequest, response chan NotifiedResponse) string
	DeRegisterNotifier(scope MetricsScope, key string)

	// RegisterExternalMetric register a function to set metric that can
	// only be obtained from external sources
	RegisterExternalMetric(f func(store *metric.MetricStore))

	MetricsReader
}

MetricsFetcher is used to get Node and Pod metrics.

type MetricsNotifierManager

type MetricsNotifierManager interface {
	// RegisterNotifier register a channel for raw metric, any time when metric
	// changes, send a data into this given channel along with current time, and
	// we will return a unique key to help with deRegister logic.
	//
	// this "current time" may not represent precisely time when this metric
	// is at, but it indeed is the most precise time katalyst system can provide.
	RegisterNotifier(scope MetricsScope, req NotifiedRequest, response chan NotifiedResponse) string
	DeRegisterNotifier(scope MetricsScope, key string)
	Notify()
}

type MetricsProvisioner

type MetricsProvisioner interface {
	// Run should be a synchronized logic to make sure different provisions
	// keep the same pace to avoid the summarized metrics to be be generated
	// based on difference timestamp.
	Run(ctx context.Context)
}

type MetricsReader

type MetricsReader interface {
	// GetNodeMetric get metric of node.
	GetNodeMetric(metricName string) (metric.MetricData, error)
	// GetNumaMetric get metric of numa.
	GetNumaMetric(numaID int, metricName string) (metric.MetricData, error)
	// GetDeviceMetric get metric of device.
	GetDeviceMetric(deviceName string, metricName string) (metric.MetricData, error)
	// GetCPUMetric get metric of cpu.
	GetCPUMetric(coreID int, metricName string) (metric.MetricData, error)
	// GetContainerMetric get metric of container.
	GetContainerMetric(podUID, containerName, metricName string) (metric.MetricData, error)
	// GetContainerNumaMetric get metric of container per numa.
	GetContainerNumaMetric(podUID, containerName, numaNode, metricName string) (metric.MetricData, error)
	// GetPodVolumeMetric get metric of pod volume.
	GetPodVolumeMetric(podUID, volumeName, metricName string) (metric.MetricData, error)

	// AggregatePodNumaMetric handles numa-level metric for all pods
	AggregatePodNumaMetric(podList []*v1.Pod, numaNode, metricName string, agg metric.Aggregator, filter metric.ContainerMetricFilter) metric.MetricData
	// AggregatePodMetric handles metric for all pods
	AggregatePodMetric(podList []*v1.Pod, metricName string, agg metric.Aggregator, filter metric.ContainerMetricFilter) metric.MetricData
	// AggregateCoreMetric handles metric for all cores
	AggregateCoreMetric(cpuset machine.CPUSet, metricName string, agg metric.Aggregator) metric.MetricData

	// GetCgroupMetric get metric of cgroup path: /kubepods/burstable, /kubepods/besteffort, etc.
	GetCgroupMetric(cgroupPath, metricName string) (metric.MetricData, error)
	// GetCgroupNumaMetric get NUMA metric of qos class: /kubepods/burstable, /kubepods/besteffort, etc.
	GetCgroupNumaMetric(cgroupPath string, numaNode int, metricName string) (metric.MetricData, error)

	HasSynced() bool
}

type MetricsScope

type MetricsScope string
const (
	MetricsScopeNode          MetricsScope = "node"
	MetricsScopeNuma          MetricsScope = "numa"
	MetricsScopeCPU           MetricsScope = "cpu"
	MetricsScopeDevice        MetricsScope = "device"
	MetricsScopeContainer     MetricsScope = "container"
	MetricsScopeContainerNUMA MetricsScope = "container-numa"
)

type NotifiedData

type NotifiedData struct {
	Scope      MetricsScope
	Req        NotifiedRequest
	Response   chan NotifiedResponse
	LastNotify time.Time
}

NotifiedData defines the structure as response data for notifier

type NotifiedRequest

type NotifiedRequest struct {
	MetricName string

	DeviceID string
	NumaID   int
	CoreID   int

	PodUID        string
	ContainerName string
	NumaNode      string
}

NotifiedRequest defines the structure as requests for notifier

type NotifiedResponse

type NotifiedResponse struct {
	Req NotifiedRequest
	metric.MetricData
}

Jump to

Keyboard shortcuts

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