history

package
v0.0.0-...-386b7fa Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 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 HistoryProvider

type HistoryProvider interface {
	GetClusterHistory() (map[model.PodID]*PodHistory, error)
}

HistoryProvider gives history of all pods in a cluster. TODO(schylek): this interface imposes how history is represented which doesn't work well with checkpoints. Consider refactoring to passing ClusterState and create history provider working with checkpoints.

func NewPrometheusHistoryProvider

func NewPrometheusHistoryProvider(config PrometheusHistoryProviderConfig) HistoryProvider

NewPrometheusHistoryProvider contructs a history provider that gets data from Prometheus.

type PodHistory

type PodHistory struct {
	// Current samples if pod is still alive, last known samples otherwise.
	LastLabels map[string]string
	LastSeen   time.Time
	// A map for container name to a list of its usage samples, in chronological
	// order.
	Samples map[string][]model.ContainerUsageSample
}

PodHistory represents history of usage and labels for a given pod.

type PrometheusClient

type PrometheusClient interface {
	// Given a particular query (that's supposed to return range vectors
	// in Prometheus terminology), gets the results from Prometheus.
	GetTimeseries(query string) ([]Timeseries, error)
}

PrometheusClient talks to Prometheus using its HTTP API.

func NewPrometheusClient

func NewPrometheusClient(httpClient httpGetter, address string) PrometheusClient

NewPrometheusClient constructs a prometheusClient.

type PrometheusHistoryProviderConfig

type PrometheusHistoryProviderConfig struct {
	Address                                            string
	HistoryLength, PodLabelPrefix, PodLabelsMetricName string
	PodNamespaceLabel, PodNameLabel                    string
	CtrNamespaceLabel, CtrPodNameLabel, CtrNameLabel   string
	CadvisorMetricsJobName                             string
}

PrometheusHistoryProviderConfig allow to select which metrics should be queried to get real resource utilization.

type Sample

type Sample struct {
	Value     float64
	Timestamp time.Time
}

Sample is a single timestamped value of the metric.

type Timeseries

type Timeseries struct {
	Labels  map[string]string
	Samples []Sample
}

Timeseries represents a metric with given labels, with its values possibly changing in time.

Jump to

Keyboard shortcuts

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