history

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 30

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, error)

NewPrometheusHistoryProvider constructs 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 PrometheusBasicAuthTransport added in v1.0.0

type PrometheusBasicAuthTransport struct {
	Username string
	Password string
}

PrometheusBasicAuthTransport contains the username and password of prometheus server

func (*PrometheusBasicAuthTransport) RoundTrip added in v1.0.0

RoundTrip function injects the username and password in the request's basic auth header

type PrometheusHistoryProviderConfig

type PrometheusHistoryProviderConfig struct {
	Address                                          string
	QueryTimeout                                     time.Duration
	HistoryLength, HistoryResolution                 string
	PodLabelPrefix, PodLabelsMetricName              string
	PodNamespaceLabel, PodNameLabel                  string
	CtrNamespaceLabel, CtrPodNameLabel, CtrNameLabel string
	CadvisorMetricsJobName                           string
	Namespace                                        string
	PrometheusBasicAuthTransport
}

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