metric

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeMetricsFetcher

type FakeMetricsFetcher struct {
	// contains filtered or unexported fields
}

func (*FakeMetricsFetcher) DeRegisterNotifier

func (f *FakeMetricsFetcher) DeRegisterNotifier(scope MetricsScope, key string)

func (*FakeMetricsFetcher) GetCPUMetric

func (f *FakeMetricsFetcher) GetCPUMetric(coreID int, metricName string) (float64, error)

func (*FakeMetricsFetcher) GetContainerMetric

func (f *FakeMetricsFetcher) GetContainerMetric(podUID, containerName, metricName string) (float64, error)

func (*FakeMetricsFetcher) GetContainerNumaMetric

func (f *FakeMetricsFetcher) GetContainerNumaMetric(podUID, containerName, numaNode, metricName string) (float64, error)

func (*FakeMetricsFetcher) GetDeviceMetric

func (f *FakeMetricsFetcher) GetDeviceMetric(deviceName string, metricName string) (float64, error)

func (*FakeMetricsFetcher) GetNodeMetric

func (f *FakeMetricsFetcher) GetNodeMetric(metricName string) (float64, error)

func (*FakeMetricsFetcher) GetNumaMetric

func (f *FakeMetricsFetcher) GetNumaMetric(numaID int, metricName string) (float64, error)

func (*FakeMetricsFetcher) RegisterNotifier

func (f *FakeMetricsFetcher) RegisterNotifier(scope MetricsScope, req NotifiedRequest, response chan NotifiedResponse) string

func (*FakeMetricsFetcher) Run

func (f *FakeMetricsFetcher) Run(ctx context.Context)

func (*FakeMetricsFetcher) SetContainerMetric

func (f *FakeMetricsFetcher) SetContainerMetric(podUID, containerName, metricName string, value float64)

func (*FakeMetricsFetcher) SetContainerNumaMetric

func (f *FakeMetricsFetcher) SetContainerNumaMetric(podUID, containerName, numaNode, metricName string, value float64)

func (*FakeMetricsFetcher) SetNodeMetric

func (f *FakeMetricsFetcher) SetNodeMetric(metricName string, value float64)

func (*FakeMetricsFetcher) SetNumaMetric

func (f *FakeMetricsFetcher) SetNumaMetric(numaID int, metricName string, value float64)

type MalachiteMetricsFetcher

type MalachiteMetricsFetcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*MalachiteMetricsFetcher) DeRegisterNotifier

func (m *MalachiteMetricsFetcher) DeRegisterNotifier(scope MetricsScope, key string)

func (*MalachiteMetricsFetcher) GetCPUMetric

func (m *MalachiteMetricsFetcher) GetCPUMetric(coreID int, metricName string) (float64, error)

func (*MalachiteMetricsFetcher) GetContainerMetric

func (m *MalachiteMetricsFetcher) GetContainerMetric(podUID, containerName, metricName string) (float64, error)

func (*MalachiteMetricsFetcher) GetContainerNumaMetric

func (m *MalachiteMetricsFetcher) GetContainerNumaMetric(podUID, containerName, numaNode, metricName string) (float64, error)

func (*MalachiteMetricsFetcher) GetDeviceMetric

func (m *MalachiteMetricsFetcher) GetDeviceMetric(deviceName string, metricName string) (float64, error)

func (*MalachiteMetricsFetcher) GetNodeMetric

func (m *MalachiteMetricsFetcher) GetNodeMetric(metricName string) (float64, error)

func (*MalachiteMetricsFetcher) GetNumaMetric

func (m *MalachiteMetricsFetcher) GetNumaMetric(numaID int, metricName string) (float64, error)

func (*MalachiteMetricsFetcher) RegisterNotifier

func (m *MalachiteMetricsFetcher) RegisterNotifier(scope MetricsScope, req NotifiedRequest, response chan NotifiedResponse) string

func (*MalachiteMetricsFetcher) Run

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)

	// GetNodeMetric get metric of node.
	GetNodeMetric(metricName string) (float64, error)

	// GetNumaMetric get metric of numa.
	GetNumaMetric(numaID int, metricName string) (float64, error)

	// GetDeviceMetric get metric of device.
	GetDeviceMetric(deviceName string, metricName string) (float64, error)

	// GetCPUMetric get metric of cpu.
	GetCPUMetric(coreID int, metricName string) (float64, error)

	// GetContainerMetric get metric of container.
	GetContainerMetric(podUID, containerName, metricName string) (float64, error)

	// GetContainerNumaMetric get metric of container per numa.
	GetContainerNumaMetric(podUID, containerName, numaNode, metricName string) (float64, error)
}

MetricsFetcher is used to get Node and Pod metrics.

func NewFakeMetricsFetcher

func NewFakeMetricsFetcher(emitter metrics.MetricEmitter) MetricsFetcher

NewFakeMetricsFetcher returns a fake MetricsFetcher.

func NewMalachiteMetricsFetcher

func NewMalachiteMetricsFetcher(emitter metrics.MetricEmitter) MetricsFetcher

NewMalachiteMetricsFetcher returns the default implementation of MetricsFetcher.

type MetricsScope

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

type NotifiedData

type NotifiedData struct {
	// contains filtered or unexported fields
}

type NotifiedRequest

type NotifiedRequest struct {
	MetricName string

	DeviceID string
	NumaID   int
	CoreID   int

	PodUID        string
	ContainerName string
	NumaNode      string
}

type NotifiedResponse

type NotifiedResponse struct {
	Req       NotifiedRequest
	Result    float64
	Timestamp time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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