metrics

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeCluster cluster
	TypeCluster = "cluster"
	// TypeNode node
	TypeNode = "node"
	// TypePod pod
	TypePod = "pod"
	// TypePodContainer container in a pod
	TypePodContainer = "pod_container"
	// TypeSysContainer system container
	TypeSysContainer = "sys_container"
)

Variables

This section is empty.

Functions

func GetNodeIP

func GetNodeIP(node *corev1.Node) string

func GetNodeInstanceGroup

func GetNodeInstanceGroup(node corev1.Node) string

func InitMetrics

func InitMetrics(
	client *client.Client,
	nodesProvider NodesProvider,
	entitiesProvider EntitiesProvider,
	kube *kuber.Kube,
	args map[string]interface{},
) error

InitMetrics init metrics source

Types

type Entities

type Entities struct {
	Node        *uuid.UUID
	Application *uuid.UUID
	Service     *uuid.UUID
	Container   *uuid.UUID
}

type EntitiesProvider

type EntitiesProvider interface {
	GetNodes() ([]corev1.Node, error)
	GetPods() ([]corev1.Pod, error)
	FindPodController(namespaceName string, podName string) (string, string, error)
}

type Kubelet

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

Kubelet kubelet client

func NewKubelet

func NewKubelet(
	kubeletClient *KubeletClient,
	resolution time.Duration,
	timeouts kubeletTimeouts,
) (*Kubelet, error)

NewKubelet returns new kubelet

func (*Kubelet) GetMetrics

func (kubelet *Kubelet) GetMetrics(
	entitiesProvider EntitiesProvider, tickTime time.Time,
) (result []*Metric, err error)

GetMetrics gets metrics

type KubeletClient

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

func NewKubeletClient

func NewKubeletClient(
	nodesProvider NodesProvider,
	kube *kuber.Kube,
	args map[string]interface{},
) (*KubeletClient, error)

func (*KubeletClient) Get

func (client *KubeletClient) Get(
	node *corev1.Node,
	path string,
) (*http.Response, error)

func (*KubeletClient) GetBytes

func (client *KubeletClient) GetBytes(
	node *corev1.Node,
	path string,
) ([]byte, error)

func (*KubeletClient) GetJson

func (client *KubeletClient) GetJson(
	node *corev1.Node,
	path string,
	response interface{},
) error

type KubeletSummary

type KubeletSummary struct {
	Node struct {
		CPU struct {
			Time                 time.Time
			UsageCoreNanoSeconds int64
		}

		Memory struct {
			Time     time.Time
			RSSBytes int64
		}
	}
	Pods []struct {
		PodRef struct {
			Name      string
			Namespace string
		}

		Containers []KubeletSummaryContainer
	}
}

KubeletSummary a struct to hold kubelet summary

type KubeletSummaryContainer

type KubeletSummaryContainer struct {
	Name      string
	StartTime time.Time

	CPU struct {
		Time                 time.Time
		UsageCoreNanoSeconds int64
	}

	Memory struct {
		Time            time.Time
		RSSBytes        int64
		WorkingSetBytes int64
	}
}

type KubeletValue

type KubeletValue struct {
	Timestamp time.Time
	Value     int64
}

KubeletValue timestamp value struct

type Metric

type Metric struct {
	Name           string
	Type           string
	NodeName       string
	NodeIP         string
	NamespaceName  string
	ControllerName string
	ControllerKind string
	ContainerName  string
	Timestamp      time.Time
	Value          int64
	PodName        string

	AdditionalTags map[string]interface{}
}

Metric metrics struct

type MetricFamily

type MetricFamily struct {
	Name string
	Help string
	Type string
	Tags []string

	Values []*MetricValue
}

type MetricValue

type MetricValue struct {
	*Entities

	Tags  map[string]string
	Value float64
}

type MetricsBatch

type MetricsBatch struct {
	Timestamp time.Time

	Metrics map[string]*MetricFamily
}

type MetricsSource

type MetricsSource interface {
	GetMetrics(entitiesProvider EntitiesProvider, tickTime time.Time) ([]*Metric, error)
}

in future releases. Consider using Source interface instead. MetricsSource interface for metrics source

type NodePathGetter

type NodePathGetter func(node *corev1.Node, path_ string) string

type NodesProvider

type NodesProvider interface {
	GetNodes() ([]corev1.Node, error)
}

type RawMetric

type RawMetric struct {
	Metric string

	Account uuid.UUID
	Cluster uuid.UUID
	Node    uuid.UUID

	Application *uuid.UUID
	Service     *uuid.UUID
	Container   *uuid.UUID

	Tags  map[string]string
	Value float64

	Timestamp time.Time
}

type RawMetrics

type RawMetrics []*RawMetric

map of metric_name:list of metric points

Jump to

Keyboard shortcuts

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