...

Package metrics

import "k8s.io/kubernetes/test/e2e/framework/metrics"
Overview
Index
Subdirectories

Overview ▾

Index ▾

Variables
func APICallToPerfData(apicalls *APIResponsiveness) *e2eperftype.PerfData
func GrabAfterEach(ctx context.Context, f *framework.Framework, before *Collection)
func PrettyPrintJSON(metrics interface{}) string
type APICall
type APIResponsiveness
    func (a *APIResponsiveness) Len() int
    func (a *APIResponsiveness) Less(i, j int) bool
    func (a *APIResponsiveness) PrintHumanReadable() string
    func (a *APIResponsiveness) PrintJSON() string
    func (a *APIResponsiveness) SummaryKind() string
    func (a *APIResponsiveness) Swap(i, j int)
type APIServerMetrics
    func (m *APIServerMetrics) Equal(o APIServerMetrics) bool
type ClusterAutoscalerMetrics
    func (m *ClusterAutoscalerMetrics) Equal(o ClusterAutoscalerMetrics) bool
type Collection
    func GrabBeforeEach(ctx context.Context, f *framework.Framework) (result *Collection)
type ComponentCollection
    func (m *ComponentCollection) ComputeClusterAutoscalerMetricsDelta(before Collection)
    func (m *ComponentCollection) PrintHumanReadable() string
    func (m *ComponentCollection) PrintJSON() string
    func (m *ComponentCollection) SummaryKind() string
type ControllerManagerMetrics
    func (m *ControllerManagerMetrics) Equal(o ControllerManagerMetrics) bool
type Grabber
    func NewMetricsGrabber(ctx context.Context, c clientset.Interface, ec clientset.Interface, config *rest.Config, kubelets bool, scheduler bool, controllers bool, apiServer bool, clusterAutoscaler bool, snapshotController bool) (*Grabber, error)
    func (g *Grabber) Grab(ctx context.Context) (Collection, error)
    func (g *Grabber) GrabFromAPIServer(ctx context.Context) (APIServerMetrics, error)
    func (g *Grabber) GrabFromClusterAutoscaler(ctx context.Context) (ClusterAutoscalerMetrics, error)
    func (g *Grabber) GrabFromControllerManager(ctx context.Context) (ControllerManagerMetrics, error)
    func (g *Grabber) GrabFromKubelet(ctx context.Context, nodeName string) (KubeletMetrics, error)
    func (g *Grabber) GrabFromScheduler(ctx context.Context) (SchedulerMetrics, error)
    func (g *Grabber) GrabFromSnapshotController(ctx context.Context, podName string, port int) (SnapshotControllerMetrics, error)
    func (g *Grabber) GrabMetricsSLIsFromAPIServer(ctx context.Context) (APIServerMetrics, error)
    func (g *Grabber) GrabResourceMetricsFromKubelet(ctx context.Context, nodeName string) (KubeletMetrics, error)
    func (g *Grabber) HasControlPlanePods() bool
type KubeletLatencyMetric
type KubeletLatencyMetrics
    func GetDefaultKubeletLatencyMetrics(ms KubeletMetrics) KubeletLatencyMetrics
    func GetKubeletLatencyMetrics(ms KubeletMetrics, filterMetricNames sets.String) KubeletLatencyMetrics
    func HighLatencyKubeletOperations(ctx context.Context, c clientset.Interface, threshold time.Duration, nodeName string, logFunc func(fmt string, args ...interface{})) (KubeletLatencyMetrics, error)
    func (a KubeletLatencyMetrics) Len() int
    func (a KubeletLatencyMetrics) Less(i, j int) bool
    func (a KubeletLatencyMetrics) Swap(i, j int)
type KubeletMetrics
    func GetKubeletMetrics(ctx context.Context, c clientset.Interface, nodeName string) (KubeletMetrics, error)
    func GrabKubeletMetricsWithoutProxy(ctx context.Context, nodeName, path string) (KubeletMetrics, error)
    func NewKubeletMetrics() KubeletMetrics
    func (m *KubeletMetrics) Equal(o KubeletMetrics) bool
type LatencyMetric
type LatencySlice
    func (a LatencySlice) Len() int
    func (a LatencySlice) Less(i, j int) bool
    func (a LatencySlice) Swap(i, j int)
type PodLatencyData
type SchedulerMetrics
    func (m *SchedulerMetrics) Equal(o SchedulerMetrics) bool
type SnapshotControllerMetrics
    func (m *SnapshotControllerMetrics) Equal(o SnapshotControllerMetrics) bool

Package files

api.go api_server_metrics.go cluster_autoscaler_metrics.go controller_manager_metrics.go e2e_metrics.go grab.go interesting_metrics.go kubelet_metrics.go latencies.go metrics_grabber.go pod.go scheduler_metrics.go snapshot_controller_metrics.go

Variables

MetricsGrabbingDisabledError is an error that is wrapped by the different MetricsGrabber.Wrap functions when metrics grabbing is not supported. Tests that check metrics data should then skip the check.

var MetricsGrabbingDisabledError = errors.New("metrics grabbing disabled")

func APICallToPerfData

func APICallToPerfData(apicalls *APIResponsiveness) *e2eperftype.PerfData

APICallToPerfData transforms APIResponsiveness to PerfData.

func GrabAfterEach

func GrabAfterEach(ctx context.Context, f *framework.Framework, before *Collection)

func PrettyPrintJSON

func PrettyPrintJSON(metrics interface{}) string

PrettyPrintJSON converts metrics to JSON format. TODO: This function should be replaced with framework.PrettyPrintJSON after solving circulary dependency between core framework and this metrics subpackage.

type APICall

APICall is a struct for managing API call.

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"`
}

type APIResponsiveness

APIResponsiveness is a struct for managing multiple API calls.

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

func (*APIResponsiveness) Len

func (a *APIResponsiveness) Len() int

func (*APIResponsiveness) Less

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

func (*APIResponsiveness) PrintHumanReadable

func (a *APIResponsiveness) PrintHumanReadable() string

PrintHumanReadable returns metrics with JSON format.

func (*APIResponsiveness) PrintJSON

func (a *APIResponsiveness) PrintJSON() string

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

func (*APIResponsiveness) SummaryKind

func (a *APIResponsiveness) SummaryKind() string

SummaryKind returns the summary of API responsiveness.

func (*APIResponsiveness) Swap

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

type APIServerMetrics

APIServerMetrics is metrics for API server

type APIServerMetrics testutil.Metrics

func (*APIServerMetrics) Equal

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

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

type ClusterAutoscalerMetrics

ClusterAutoscalerMetrics is metrics for cluster autoscaler

type ClusterAutoscalerMetrics testutil.Metrics

func (*ClusterAutoscalerMetrics) Equal

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

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

type Collection

Collection is metrics collection of components

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

func GrabBeforeEach

func GrabBeforeEach(ctx context.Context, f *framework.Framework) (result *Collection)

type ComponentCollection

ComponentCollection is metrics collection of components.

type ComponentCollection Collection

func (*ComponentCollection) ComputeClusterAutoscalerMetricsDelta

func (m *ComponentCollection) ComputeClusterAutoscalerMetricsDelta(before Collection)

ComputeClusterAutoscalerMetricsDelta computes the change in cluster autoscaler metrics.

func (*ComponentCollection) PrintHumanReadable

func (m *ComponentCollection) PrintHumanReadable() string

PrintHumanReadable returns e2e metrics with JSON format.

func (*ComponentCollection) PrintJSON

func (m *ComponentCollection) PrintJSON() string

PrintJSON returns e2e metrics with JSON format.

func (*ComponentCollection) SummaryKind

func (m *ComponentCollection) SummaryKind() string

SummaryKind returns the summary of e2e metrics.

type ControllerManagerMetrics

ControllerManagerMetrics is metrics for controller manager

type ControllerManagerMetrics testutil.Metrics

func (*ControllerManagerMetrics) Equal

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

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

type Grabber

Grabber provides functions which grab metrics from components

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

func NewMetricsGrabber

func NewMetricsGrabber(ctx context.Context, c clientset.Interface, ec clientset.Interface, config *rest.Config, kubelets bool, scheduler bool, controllers bool, apiServer bool, clusterAutoscaler bool, snapshotController bool) (*Grabber, error)

NewMetricsGrabber prepares for grabbing metrics data from several different components. It should be called when those components are running because it needs to communicate with them to determine for which components metrics data can be retrieved.

Collecting metrics data is an optional debug feature. Not all clusters will support it. If disabled for a component, the corresponding Grab function will immediately return an error derived from MetricsGrabbingDisabledError.

func (*Grabber) Grab

func (g *Grabber) Grab(ctx context.Context) (Collection, error)

Grab returns metrics from corresponding component

func (*Grabber) GrabFromAPIServer

func (g *Grabber) GrabFromAPIServer(ctx context.Context) (APIServerMetrics, error)

GrabFromAPIServer returns metrics from API server

func (*Grabber) GrabFromClusterAutoscaler

func (g *Grabber) GrabFromClusterAutoscaler(ctx context.Context) (ClusterAutoscalerMetrics, error)

GrabFromClusterAutoscaler returns metrics from cluster autoscaler

func (*Grabber) GrabFromControllerManager

func (g *Grabber) GrabFromControllerManager(ctx context.Context) (ControllerManagerMetrics, error)

GrabFromControllerManager returns metrics from controller manager

func (*Grabber) GrabFromKubelet

func (g *Grabber) GrabFromKubelet(ctx context.Context, nodeName string) (KubeletMetrics, error)

GrabFromKubelet returns metrics from kubelet

func (*Grabber) GrabFromScheduler

func (g *Grabber) GrabFromScheduler(ctx context.Context) (SchedulerMetrics, error)

GrabFromScheduler returns metrics from scheduler

func (*Grabber) GrabFromSnapshotController

func (g *Grabber) GrabFromSnapshotController(ctx context.Context, podName string, port int) (SnapshotControllerMetrics, error)

GrabFromSnapshotController returns metrics from controller manager

func (*Grabber) GrabMetricsSLIsFromAPIServer

func (g *Grabber) GrabMetricsSLIsFromAPIServer(ctx context.Context) (APIServerMetrics, error)

GrabMetricsSLIsFromAPIServer returns metrics from API server

func (*Grabber) GrabResourceMetricsFromKubelet

func (g *Grabber) GrabResourceMetricsFromKubelet(ctx context.Context, nodeName string) (KubeletMetrics, error)

GrabresourceMetricsFromKubelet returns resource metrics from kubelet

func (*Grabber) HasControlPlanePods

func (g *Grabber) HasControlPlanePods() bool

HasControlPlanePods returns true if metrics grabber was able to find control-plane pods

type KubeletLatencyMetric

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

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
}

type KubeletLatencyMetrics

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

type KubeletLatencyMetrics []KubeletLatencyMetric

func GetDefaultKubeletLatencyMetrics

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

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

func HighLatencyKubeletOperations(ctx context.Context, 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

func (a KubeletLatencyMetrics) Len() int

func (KubeletLatencyMetrics) Less

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

func (KubeletLatencyMetrics) Swap

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

type KubeletMetrics

KubeletMetrics is metrics for kubelet

type KubeletMetrics testutil.Metrics

func GetKubeletMetrics

func GetKubeletMetrics(ctx context.Context, 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(ctx context.Context, nodeName, path string) (KubeletMetrics, error)

GrabKubeletMetricsWithoutProxy retrieve metrics from the kubelet on the given node using a simple GET over http.

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

LatencyMetric is a struct for dashboard metrics.

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

type LatencySlice

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

type LatencySlice []PodLatencyData

func (LatencySlice) Len

func (a LatencySlice) Len() int

func (LatencySlice) Less

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

func (LatencySlice) Swap

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

type PodLatencyData

PodLatencyData encapsulates pod startup latency information.

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
}

type SchedulerMetrics

SchedulerMetrics is metrics for scheduler

type SchedulerMetrics testutil.Metrics

func (*SchedulerMetrics) Equal

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

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

type SnapshotControllerMetrics

SnapshotControllerMetrics is metrics for controller manager

type SnapshotControllerMetrics testutil.Metrics

func (*SnapshotControllerMetrics) Equal

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

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

Subdirectories

Name Synopsis
..
init Package init installs GrabBeforeEach and GrabAfterEach as callbacks for gathering data before and after a test.