metrics

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerMetricsSnapshot

type ContainerMetricsSnapshot struct {
	// ID identifies a specific container those metrics are coming from.
	ID model.ContainerID
	// End time of the measurement interval.
	SnapshotTime time.Time
	// Duration of the measurement interval, which is [SnapshotTime - SnapshotWindow, SnapshotTime].
	SnapshotWindow time.Duration
	// Actual usage of the resources over the measurement interval.
	Usage model.Resources
}

ContainerMetricsSnapshot contains information about usage of certain container within defined time window.

type ExternalClientOptions added in v1.0.0

type ExternalClientOptions struct {
	ResourceMetrics map[k8sapiv1.ResourceName]string
	// Label to use for the container name.
	ContainerNameLabel string
}

ExternalClientOptions specifies parameters for using an External Metrics Client.

type MetricsClient

type MetricsClient interface {
	// GetContainersMetrics returns an array of ContainerMetricsSnapshots,
	// representing resource usage for every running container in the cluster
	GetContainersMetrics() ([]*ContainerMetricsSnapshot, error)
}

MetricsClient provides simple metrics on resources usage on container level.

func NewMetricsClient

func NewMetricsClient(source PodMetricsLister, namespace, clientName string) MetricsClient

NewMetricsClient creates new instance of MetricsClient, which is used by recommender. namespace limits queries to particular namespace, use k8sapiv1.NamespaceAll to select all namespaces.

type PodMetricsLister added in v1.0.0

type PodMetricsLister interface {
	List(ctx context.Context, namespace string, opts v1.ListOptions) (*v1beta1.PodMetricsList, error)
}

PodMetricsLister wraps both metrics-client and External Metrics

func NewExternalClient added in v1.0.0

func NewExternalClient(c *rest.Config, clusterState *model.ClusterState, options ExternalClientOptions) PodMetricsLister

NewExternalClient returns a Source for an External Metrics Client.

func NewPodMetricsesSource added in v1.0.0

func NewPodMetricsesSource(source resourceclient.PodMetricsesGetter) PodMetricsLister

NewPodMetricsesSource Returns a Source-wrapper around PodMetricsesGetter.

Jump to

Keyboard shortcuts

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