sources

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDurationMetrics

func RegisterDurationMetrics(scrapeTimeout time.Duration)

RegisterScraperDuration creates and registers a histogram metric for scrape duration, suitable for use in the source manager.

Types

type ContainerMetricsPoint

type ContainerMetricsPoint struct {
	Name string
	MetricsPoint
}

ContainerMetricsPoint contains the metrics for some container at some point in time.

type MetricSource

type MetricSource interface {
	// Collect fetches a batch of metrics.  It may return both a partial result and an error,
	// and non-nil results thus must be well-formed and meaningful even when accompanied by
	// and error.
	Collect(context.Context) (*MetricsBatch, error)
	// Name names the metrics source for identification purposes
	Name() string
}

MetricSource knows how to collect pod, container, and node metrics from some location. It is expected that the batch returned contains unique values (i.e. it does not return the same node, pod, or container as any other source).

func NewSourceManager

func NewSourceManager(srcProv MetricSourceProvider, scrapeTimeout time.Duration) MetricSource

type MetricSourceProvider

type MetricSourceProvider interface {
	// GetMetricSources fetches all sources known to this metrics provider.
	// It may return both partial results and an error.
	GetMetricSources() ([]MetricSource, error)
}

MetricSourceProvider provides metric sources to collect from.

type MetricsBatch

type MetricsBatch struct {
	Nodes []NodeMetricsPoint
	Pods  []PodMetricsPoint
}

MetricsBatch is a single batch of pod, container, and node metrics from some source.

type MetricsPoint

type MetricsPoint struct {
	Timestamp time.Time
	// CpuUsage is the CPU usage rate, in cores
	CpuUsage resource.Quantity
	// MemoryUsage is the working set size, in bytes.
	MemoryUsage resource.Quantity
}

MetricsPoint represents the a set of specific metrics at some point in time.

type NodeMetricsPoint

type NodeMetricsPoint struct {
	Name string
	MetricsPoint
}

NodeMetricsPoint contains the metrics for some node at some point in time.

type PodMetricsPoint

type PodMetricsPoint struct {
	Name      string
	Namespace string

	Containers []ContainerMetricsPoint
}

PodMetricsPoint contains the metrics for some pod's containers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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