metrics

package
v1.17.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: Apache-2.0 Imports: 31 Imported by: 115

Documentation

Index

Constants

View Source
const (
	// SingleCallTimeout is how long to try single API calls (like 'get' or 'list'). Used to prevent
	// transient failures from failing tests.
	// TODO: client should not apply this timeout to Watch calls. Increased from 30s until that is fixed.
	SingleCallTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

func APICallToPerfData added in v1.16.0

func APICallToPerfData(apicalls *APIResponsiveness) *e2eperftype.PerfData

APICallToPerfData transforms APIResponsiveness to PerfData.

func LogSuspiciousLatency added in v1.16.0

func LogSuspiciousLatency(latencyData []PodLatencyData, latencyDataLag []PodLatencyData, nodeCount int, c clientset.Interface)

LogSuspiciousLatency logs metrics/docker errors from all nodes that had slow startup times If latencyDataLag is nil then it will be populated from latencyData

func PodStartupLatencyToPerfData added in v1.16.0

func PodStartupLatencyToPerfData(latency *PodStartupLatency) *e2eperftype.PerfData

PodStartupLatencyToPerfData transforms PodStartupLatency to PerfData.

func PrettyPrintJSON added in v1.16.0

func PrettyPrintJSON(metrics interface{}) string

PrettyPrintJSON converts metrics to JSON format.

func PrintLatencies added in v1.16.0

func PrintLatencies(latencies []PodLatencyData, header string)

PrintLatencies outputs latencies to log with readable format.

func ResetMetrics added in v1.16.0

func ResetMetrics(c clientset.Interface) error

ResetMetrics resets latency metrics in apiserver.

func ResetSchedulerMetrics added in v1.16.0

func ResetSchedulerMetrics(c clientset.Interface, provider, cloudMasterName, masterHostname string) error

ResetSchedulerMetrics sends a DELETE request to kube-scheduler for resetting metrics.

func VerifyLatencyWithinThreshold added in v1.16.0

func VerifyLatencyWithinThreshold(threshold, actual LatencyMetric, metricName string) error

VerifyLatencyWithinThreshold verifies whether 50, 90 and 99th percentiles of a latency metric are within the expected threshold.

Types

type APICall added in v1.16.0

type APICall struct {
	Resource    string        `json:"resource"`
	Subresource string        `json:"subresource"`
	Verb        string        `json:"verb"`
	Scope       string        `json:"scope"`
	Latency     LatencyMetric `json:"latency"`
	Count       int           `json:"count"`
}

APICall is a struct for managing API call.

type APIResponsiveness added in v1.16.0

type APIResponsiveness struct {
	APICalls []APICall `json:"apicalls"`
}

APIResponsiveness is a struct for managing multiple API calls.

func HighLatencyRequests added in v1.16.0

func HighLatencyRequests(c clientset.Interface, nodeCount int) (int, *APIResponsiveness, error)

HighLatencyRequests prints top five summary metrics for request types with latency and returns number of such request types above threshold. We use a higher threshold for list calls if nodeCount is above a given threshold (i.e. cluster is big).

func (*APIResponsiveness) Len added in v1.16.0

func (a *APIResponsiveness) Len() int

func (*APIResponsiveness) Less added in v1.16.0

func (a *APIResponsiveness) Less(i, j int) bool

func (*APIResponsiveness) PrintHumanReadable added in v1.16.0

func (a *APIResponsiveness) PrintHumanReadable() string

PrintHumanReadable returns metrics with JSON format.

func (*APIResponsiveness) PrintJSON added in v1.16.0

func (a *APIResponsiveness) PrintJSON() string

PrintJSON returns metrics of PerfData(50, 90 and 99th percentiles) with JSON format.

func (*APIResponsiveness) SummaryKind added in v1.16.0

func (a *APIResponsiveness) SummaryKind() string

SummaryKind returns the summary of API responsiveness.

func (*APIResponsiveness) Swap added in v1.16.0

func (a *APIResponsiveness) Swap(i, j int)

type APIServerMetrics added in v1.14.0

type APIServerMetrics Metrics

APIServerMetrics is metrics for API server

func (*APIServerMetrics) Equal added in v1.14.0

Equal returns true if all metrics are the same as the arguments.

type ClusterAutoscalerMetrics

type ClusterAutoscalerMetrics Metrics

ClusterAutoscalerMetrics is metrics for cluster autoscaler

func (*ClusterAutoscalerMetrics) Equal

Equal returns true if all metrics are the same as the arguments.

type Collection added in v1.14.0

type Collection struct {
	APIServerMetrics         APIServerMetrics
	ControllerManagerMetrics ControllerManagerMetrics
	KubeletMetrics           map[string]KubeletMetrics
	SchedulerMetrics         SchedulerMetrics
	ClusterAutoscalerMetrics ClusterAutoscalerMetrics
}

Collection is metrics collection of components

type ControllerManagerMetrics

type ControllerManagerMetrics Metrics

ControllerManagerMetrics is metrics for controller manager

func (*ControllerManagerMetrics) Equal

Equal returns true if all metrics are the same as the arguments.

type EtcdMetrics added in v1.16.0

type EtcdMetrics struct {
	BackendCommitDuration     HistogramVec `json:"backendCommitDuration"`
	SnapshotSaveTotalDuration HistogramVec `json:"snapshotSaveTotalDuration"`
	PeerRoundTripTime         HistogramVec `json:"peerRoundTripTime"`
	WalFsyncDuration          HistogramVec `json:"walFsyncDuration"`
	MaxDatabaseSize           float64      `json:"maxDatabaseSize"`
}

EtcdMetrics is a struct for managing etcd metrics.

func (*EtcdMetrics) PrintHumanReadable added in v1.16.0

func (l *EtcdMetrics) PrintHumanReadable() string

PrintHumanReadable returns etcd metrics with JSON format.

func (*EtcdMetrics) PrintJSON added in v1.16.0

func (l *EtcdMetrics) PrintJSON() string

PrintJSON returns etcd metrics with JSON format.

func (*EtcdMetrics) SummaryKind added in v1.16.0

func (l *EtcdMetrics) SummaryKind() string

SummaryKind returns the summary of etcd metrics.

type EtcdMetricsCollector added in v1.16.0

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

EtcdMetricsCollector is a struct for managing etcd metrics collector.

func NewEtcdMetricsCollector added in v1.16.0

func NewEtcdMetricsCollector() *EtcdMetricsCollector

NewEtcdMetricsCollector creates a new etcd metrics collector.

func (*EtcdMetricsCollector) GetMetrics added in v1.16.0

func (mc *EtcdMetricsCollector) GetMetrics() *EtcdMetrics

GetMetrics returns metrics of etcd metrics collector.

func (*EtcdMetricsCollector) StartCollecting added in v1.16.0

func (mc *EtcdMetricsCollector) StartCollecting(interval time.Duration, provider string, masterHostname string)

StartCollecting starts to collect etcd db size metric periodically and updates MaxDatabaseSize accordingly.

func (*EtcdMetricsCollector) StopAndSummarize added in v1.16.0

func (mc *EtcdMetricsCollector) StopAndSummarize(provider string, masterHostname string) error

StopAndSummarize stops etcd metrics collector and summarizes the metrics.

type Grabber added in v1.14.0

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

Grabber provides functions which grab metrics from components

func NewMetricsGrabber

func NewMetricsGrabber(c clientset.Interface, ec clientset.Interface, kubelets bool, scheduler bool, controllers bool, apiServer bool, clusterAutoscaler bool) (*Grabber, error)

NewMetricsGrabber returns new metrics which are initialized.

func (*Grabber) Grab added in v1.14.0

func (g *Grabber) Grab() (Collection, error)

Grab returns metrics from corresponding component

func (*Grabber) GrabFromAPIServer added in v1.14.0

func (g *Grabber) GrabFromAPIServer() (APIServerMetrics, error)

GrabFromAPIServer returns metrics from API server

func (*Grabber) GrabFromClusterAutoscaler added in v1.14.0

func (g *Grabber) GrabFromClusterAutoscaler() (ClusterAutoscalerMetrics, error)

GrabFromClusterAutoscaler returns metrics from cluster autoscaler

func (*Grabber) GrabFromControllerManager added in v1.14.0

func (g *Grabber) GrabFromControllerManager() (ControllerManagerMetrics, error)

GrabFromControllerManager returns metrics from controller manager

func (*Grabber) GrabFromKubelet added in v1.14.0

func (g *Grabber) GrabFromKubelet(nodeName string) (KubeletMetrics, error)

GrabFromKubelet returns metrics from kubelet

func (*Grabber) GrabFromScheduler added in v1.14.0

func (g *Grabber) GrabFromScheduler() (SchedulerMetrics, error)

GrabFromScheduler returns metrics from scheduler

func (*Grabber) HasRegisteredMaster added in v1.14.0

func (g *Grabber) HasRegisteredMaster() bool

HasRegisteredMaster returns if metrics grabber was able to find a master node

type Histogram added in v1.16.0

type Histogram struct {
	Labels  map[string]string `json:"labels"`
	Buckets map[string]int    `json:"buckets"`
}

Histogram is a struct for managing histogram.

type HistogramVec added in v1.16.0

type HistogramVec []Histogram

HistogramVec is an array of Histogram.

type KubeletLatencyMetric added in v1.16.0

type KubeletLatencyMetric struct {
	// eg: list, info, create
	Operation string
	// eg: sync_pods, pod_worker
	Method string
	// 0 <= quantile <=1, e.g. 0.95 is 95%tile, 0.5 is median.
	Quantile float64
	Latency  time.Duration
}

KubeletLatencyMetric stores metrics scraped from the kubelet server's /metric endpoint. TODO: Get some more structure around the metrics and this type

type KubeletLatencyMetrics added in v1.16.0

type KubeletLatencyMetrics []KubeletLatencyMetric

KubeletLatencyMetrics implements sort.Interface for []KubeletMetric based on the latency field.

func GetDefaultKubeletLatencyMetrics added in v1.16.0

func GetDefaultKubeletLatencyMetrics(ms KubeletMetrics) KubeletLatencyMetrics

GetDefaultKubeletLatencyMetrics calls GetKubeletLatencyMetrics with a set of default metricNames identifying common latency metrics. Note that the KubeletMetrics passed in should not contain subsystem prefix.

func GetKubeletLatencyMetrics added in v1.16.0

func GetKubeletLatencyMetrics(ms KubeletMetrics, filterMetricNames sets.String) KubeletLatencyMetrics

GetKubeletLatencyMetrics filters ms to include only those contained in the metricNames set, then constructs a KubeletLatencyMetrics list based on the samples associated with those metrics.

func HighLatencyKubeletOperations added in v1.16.0

func HighLatencyKubeletOperations(c clientset.Interface, threshold time.Duration, nodeName string, logFunc func(fmt string, args ...interface{})) (KubeletLatencyMetrics, error)

HighLatencyKubeletOperations logs and counts the high latency metrics exported by the kubelet server via /metrics.

func (KubeletLatencyMetrics) Len added in v1.16.0

func (a KubeletLatencyMetrics) Len() int

func (KubeletLatencyMetrics) Less added in v1.16.0

func (a KubeletLatencyMetrics) Less(i, j int) bool

func (KubeletLatencyMetrics) Swap added in v1.16.0

func (a KubeletLatencyMetrics) Swap(i, j int)

type KubeletMetrics

type KubeletMetrics Metrics

KubeletMetrics is metrics for kubelet

func GetKubeletMetrics added in v1.16.0

func GetKubeletMetrics(c clientset.Interface, nodeName string) (KubeletMetrics, error)

GetKubeletMetrics gets all metrics in kubelet subsystem from specified node and trims the subsystem prefix.

func GrabKubeletMetricsWithoutProxy

func GrabKubeletMetricsWithoutProxy(nodeName, path string) (KubeletMetrics, error)

GrabKubeletMetricsWithoutProxy retrieve metrics from the kubelet on the given node using a simple GET over http. Currently only used in integration tests.

func NewKubeletMetrics

func NewKubeletMetrics() KubeletMetrics

NewKubeletMetrics returns new metrics which are initialized.

func (*KubeletMetrics) Equal

func (m *KubeletMetrics) Equal(o KubeletMetrics) bool

Equal returns true if all metrics are the same as the arguments.

type LatencyMetric added in v1.16.0

type LatencyMetric struct {
	Perc50  time.Duration `json:"Perc50"`
	Perc90  time.Duration `json:"Perc90"`
	Perc99  time.Duration `json:"Perc99"`
	Perc100 time.Duration `json:"Perc100"`
}

LatencyMetric is a struct for dashboard metrics.

func ExtractLatencyMetrics added in v1.16.0

func ExtractLatencyMetrics(latencies []PodLatencyData) LatencyMetric

ExtractLatencyMetrics returns latency metrics for each percentile(50th, 90th and 99th).

type LatencySlice added in v1.16.0

type LatencySlice []PodLatencyData

LatencySlice is an array of PodLatencyData which encapsulates pod startup latency information.

func (LatencySlice) Len added in v1.16.0

func (a LatencySlice) Len() int

func (LatencySlice) Less added in v1.16.0

func (a LatencySlice) Less(i, j int) bool

func (LatencySlice) Swap added in v1.16.0

func (a LatencySlice) Swap(i, j int)

type Metrics

type Metrics map[string]model.Samples

Metrics is generic metrics for other specific metrics

func NewMetrics

func NewMetrics() Metrics

NewMetrics returns new metrics which are initialized.

func (*Metrics) Equal

func (m *Metrics) Equal(o Metrics) bool

Equal returns true if all metrics are the same as the arguments.

type MetricsForE2E

type MetricsForE2E Collection

MetricsForE2E is metrics collection of components.

func (*MetricsForE2E) ComputeClusterAutoscalerMetricsDelta

func (m *MetricsForE2E) ComputeClusterAutoscalerMetricsDelta(before Collection)

ComputeClusterAutoscalerMetricsDelta computes the change in cluster autoscaler metrics.

func (*MetricsForE2E) PrintHumanReadable

func (m *MetricsForE2E) PrintHumanReadable() string

PrintHumanReadable returns e2e metrics with JSON format.

func (*MetricsForE2E) PrintJSON

func (m *MetricsForE2E) PrintJSON() string

PrintJSON returns e2e metrics with JSON format.

func (*MetricsForE2E) SummaryKind

func (m *MetricsForE2E) SummaryKind() string

SummaryKind returns the summary of e2e metrics.

type PodLatencyData added in v1.16.0

type PodLatencyData struct {
	// Name of the pod
	Name string
	// Node this pod was running on
	Node string
	// Latency information related to pod startuptime
	Latency time.Duration
}

PodLatencyData encapsulates pod startup latency information.

type PodStartupLatency added in v1.16.0

type PodStartupLatency struct {
	CreateToScheduleLatency LatencyMetric `json:"createToScheduleLatency"`
	ScheduleToRunLatency    LatencyMetric `json:"scheduleToRunLatency"`
	RunToWatchLatency       LatencyMetric `json:"runToWatchLatency"`
	ScheduleToWatchLatency  LatencyMetric `json:"scheduleToWatchLatency"`
	E2ELatency              LatencyMetric `json:"e2eLatency"`
}

PodStartupLatency is a struct for managing latency of pod startup.

func (*PodStartupLatency) PrintHumanReadable added in v1.16.0

func (l *PodStartupLatency) PrintHumanReadable() string

PrintHumanReadable returns pod startup letency with JSON format.

func (*PodStartupLatency) PrintJSON added in v1.16.0

func (l *PodStartupLatency) PrintJSON() string

PrintJSON returns pod startup letency with JSON format.

func (*PodStartupLatency) SummaryKind added in v1.16.0

func (l *PodStartupLatency) SummaryKind() string

SummaryKind returns the summary of pod startup latency.

type SchedulerMetrics

type SchedulerMetrics Metrics

SchedulerMetrics is metrics for scheduler

func (*SchedulerMetrics) Equal

Equal returns true if all metrics are the same as the arguments.

type SchedulingMetrics added in v1.16.0

type SchedulingMetrics struct {
	PredicateEvaluationLatency  LatencyMetric `json:"predicateEvaluationLatency"`
	PriorityEvaluationLatency   LatencyMetric `json:"priorityEvaluationLatency"`
	PreemptionEvaluationLatency LatencyMetric `json:"preemptionEvaluationLatency"`
	BindingLatency              LatencyMetric `json:"bindingLatency"`
	ThroughputAverage           float64       `json:"throughputAverage"`
	ThroughputPerc50            float64       `json:"throughputPerc50"`
	ThroughputPerc90            float64       `json:"throughputPerc90"`
	ThroughputPerc99            float64       `json:"throughputPerc99"`
}

SchedulingMetrics is a struct for managing scheduling metrics.

func VerifySchedulerLatency added in v1.16.0

func VerifySchedulerLatency(c clientset.Interface, provider, cloudMasterName, masterHostname string) (*SchedulingMetrics, error)

VerifySchedulerLatency verifies (currently just by logging them) the scheduling latencies.

func (*SchedulingMetrics) PrintHumanReadable added in v1.16.0

func (l *SchedulingMetrics) PrintHumanReadable() string

PrintHumanReadable returns scheduling metrics with JSON format.

func (*SchedulingMetrics) PrintJSON added in v1.16.0

func (l *SchedulingMetrics) PrintJSON() string

PrintJSON returns scheduling metrics with JSON format.

func (*SchedulingMetrics) SummaryKind added in v1.16.0

func (l *SchedulingMetrics) SummaryKind() string

SummaryKind returns the summary of scheduling metrics.

Jump to

Keyboard shortcuts

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