util

package
v0.0.0-...-be347a3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PerfMetrics = NewPerfMetricsCache()

PerfMetrics stores known metrics from Kubernetes nodes and containers

Functions

func ContainerUID

func ContainerUID(namespace, pod, container string) string

ContainerUID creates an unique ID for from namespace, pod name and container name

func GetLabel

func GetLabel(m *dto.Metric, label string) string

GetLabel returns desired label from the given metric, or "" if not present

func GetWatcher

func GetWatcher(base mb.BaseMetricSet, resource kubernetes.Resource, nodeScope bool) (kubernetes.Watcher, error)

GetWatcher initializes a kubernetes watcher with the given scope (node or cluster), and resource type

Types

type Enricher

type Enricher interface {
	// Start will start the Kubernetes watcher on the first call, does nothing on the rest
	// errors are logged as warning
	Start()

	// Stop will stop the Kubernetes watcher
	Stop()

	// Enrich the given list of events
	Enrich([]common.MapStr)
}

Enricher takes Kubernetes events and enrich them with k8s metadata

func NewContainerMetadataEnricher

func NewContainerMetadataEnricher(
	base mb.BaseMetricSet,
	nodeScope bool) Enricher

NewContainerMetadataEnricher returns an Enricher configured for container events

func NewResourceMetadataEnricher

func NewResourceMetadataEnricher(
	base mb.BaseMetricSet,
	res kubernetes.Resource,
	nodeScope bool) Enricher

NewResourceMetadataEnricher returns an Enricher configured for kubernetes resource events

type PerfMetricsCache

type PerfMetricsCache struct {
	NodeMemAllocatable   *valueMap
	NodeCoresAllocatable *valueMap

	ContainerMemLimit   *valueMap
	ContainerCoresLimit *valueMap
}

PerfMetricsCache stores known metrics from Kubernetes nodes and containers

func NewPerfMetricsCache

func NewPerfMetricsCache() *PerfMetricsCache

NewPerfMetricsCache initializes and returns a new PerfMetricsCache

func (*PerfMetricsCache) Start

func (c *PerfMetricsCache) Start()

Start cache workers

func (*PerfMetricsCache) Stop

func (c *PerfMetricsCache) Stop()

Stop cache workers

Jump to

Keyboard shortcuts

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