metrics

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerMetrics

type ContainerMetrics struct {
	Name  string `json:"name,omitempty"`
	Usage map[corev1.ResourceName]int64
}

container metrics object

type MetricsHandler

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

metrics handler, used to get metrics from node or pod

func NewMetrics

func NewMetrics(ctx context.Context, namespace, kubeconfig string) (metrics *MetricsHandler, err error)

NewMetrics new a metrics handler from kubeconfig or in-cluster config

func (*MetricsHandler) DeepCopy

func (in *MetricsHandler) DeepCopy() *MetricsHandler

DeepCopy copy a new MetricsHandler

func (*MetricsHandler) Namespace

func (m *MetricsHandler) Namespace() string

Namespace return the the MetricsHandler working namespace. namespace will be required when query pods metrics

func (*MetricsHandler) Node

func (m *MetricsHandler) Node(name string) (*NodeMetrics, error)

Node query k8s node metrics by name

func (*MetricsHandler) NodeAllRaw

func (m *MetricsHandler) NodeAllRaw() ([]NodeMetrics, error)

NodeAllRaw query all k8s node metrics using REST API

func (*MetricsHandler) NodeRaw

func (m *MetricsHandler) NodeRaw(name string) (*NodeMetrics, error)

NodeRaw query k8s node metrics by name using REST API

func (*MetricsHandler) Nodes

func (m *MetricsHandler) Nodes(label string) ([]NodeMetrics, error)

Nodes query multiple k8s node metrics by label

func (*MetricsHandler) Pod

func (m *MetricsHandler) Pod(name string) (*PodMetrics, error)

Pod query pod metrics by name

func (*MetricsHandler) PodAllRaw

func (m *MetricsHandler) PodAllRaw() ([]PodMetrics, error)

PodAllRaw query the metrics of all pods in the k8s cluster where the pod running, using REST API

func (*MetricsHandler) PodRaw

func (m *MetricsHandler) PodRaw(name string) (*PodMetrics, error)

PodRaw query pod metrics by name using REST API

func (*MetricsHandler) Pods

func (m *MetricsHandler) Pods(label string) ([]PodMetrics, error)

Pods query multiple pod metrics by labels

func (*MetricsHandler) PodsRaw

func (m *MetricsHandler) PodsRaw() ([]PodMetrics, error)

PodsRaw query the metrics of all pods in the namespace where the pod running, using REST API

func (*MetricsHandler) WithNamespace

func (m *MetricsHandler) WithNamespace(namespace string) *MetricsHandler

WithNamespace working with specific namespace

type NodeMetrics

type NodeMetrics struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Timestamp         string `json:"timpstamp"`
	Window            string `json:"window"`
	Usage             map[corev1.ResourceName]int64
}

node metrics object

type PodMetrics

type PodMetrics struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Timestamp         string `json:"timestamp"`
	Window            string `json:"window"`

	Containers []ContainerMetrics `json:"containers"`
}

pod metrics object

Jump to

Keyboard shortcuts

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