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(apicalls *APIResponsiveness) *e2eperftype.PerfData
APICallToPerfData transforms APIResponsiveness to PerfData.
func GrabAfterEach(ctx context.Context, f *framework.Framework, before *Collection)
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.
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"` }
APIResponsiveness is a struct for managing multiple API calls.
type APIResponsiveness struct { APICalls []APICall `json:"apicalls"` }
func (a *APIResponsiveness) Len() int
func (a *APIResponsiveness) Less(i, j int) bool
func (a *APIResponsiveness) PrintHumanReadable() string
PrintHumanReadable returns metrics with JSON format.
func (a *APIResponsiveness) PrintJSON() string
PrintJSON returns metrics of PerfData(50, 90 and 99th percentiles) with JSON format.
func (a *APIResponsiveness) SummaryKind() string
SummaryKind returns the summary of API responsiveness.
func (a *APIResponsiveness) Swap(i, j int)
APIServerMetrics is metrics for API server
type APIServerMetrics testutil.Metrics
func (m *APIServerMetrics) Equal(o APIServerMetrics) bool
Equal returns true if all metrics are the same as the arguments.
ClusterAutoscalerMetrics is metrics for cluster autoscaler
type ClusterAutoscalerMetrics testutil.Metrics
func (m *ClusterAutoscalerMetrics) Equal(o ClusterAutoscalerMetrics) bool
Equal returns true if all metrics are the same as the arguments.
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(ctx context.Context, f *framework.Framework) (result *Collection)
ComponentCollection is metrics collection of components.
type ComponentCollection Collection
func (m *ComponentCollection) ComputeClusterAutoscalerMetricsDelta(before Collection)
ComputeClusterAutoscalerMetricsDelta computes the change in cluster autoscaler metrics.
func (m *ComponentCollection) PrintHumanReadable() string
PrintHumanReadable returns e2e metrics with JSON format.
func (m *ComponentCollection) PrintJSON() string
PrintJSON returns e2e metrics with JSON format.
func (m *ComponentCollection) SummaryKind() string
SummaryKind returns the summary of e2e metrics.
ControllerManagerMetrics is metrics for controller manager
type ControllerManagerMetrics testutil.Metrics
func (m *ControllerManagerMetrics) Equal(o ControllerManagerMetrics) bool
Equal returns true if all metrics are the same as the arguments.
Grabber provides functions which grab metrics from components
type Grabber struct {
// contains filtered or unexported fields
}
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 (g *Grabber) Grab(ctx context.Context) (Collection, error)
Grab returns metrics from corresponding component
func (g *Grabber) GrabFromAPIServer(ctx context.Context) (APIServerMetrics, error)
GrabFromAPIServer returns metrics from API server
func (g *Grabber) GrabFromClusterAutoscaler(ctx context.Context) (ClusterAutoscalerMetrics, error)
GrabFromClusterAutoscaler returns metrics from cluster autoscaler
func (g *Grabber) GrabFromControllerManager(ctx context.Context) (ControllerManagerMetrics, error)
GrabFromControllerManager returns metrics from controller manager
func (g *Grabber) GrabFromKubelet(ctx context.Context, nodeName string) (KubeletMetrics, error)
GrabFromKubelet returns metrics from kubelet
func (g *Grabber) GrabFromScheduler(ctx context.Context) (SchedulerMetrics, error)
GrabFromScheduler returns metrics from scheduler
func (g *Grabber) GrabFromSnapshotController(ctx context.Context, podName string, port int) (SnapshotControllerMetrics, error)
GrabFromSnapshotController returns metrics from controller manager
func (g *Grabber) GrabMetricsSLIsFromAPIServer(ctx context.Context) (APIServerMetrics, error)
GrabMetricsSLIsFromAPIServer returns metrics from API server
func (g *Grabber) GrabResourceMetricsFromKubelet(ctx context.Context, nodeName string) (KubeletMetrics, error)
GrabresourceMetricsFromKubelet returns resource metrics from kubelet
func (g *Grabber) HasControlPlanePods() bool
HasControlPlanePods returns true if metrics grabber was able to find control-plane pods
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 }
KubeletLatencyMetrics implements sort.Interface for []KubeletMetric based on the latency field.
type KubeletLatencyMetrics []KubeletLatencyMetric
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(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(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 (a KubeletLatencyMetrics) Len() int
func (a KubeletLatencyMetrics) Less(i, j int) bool
func (a KubeletLatencyMetrics) Swap(i, j int)
KubeletMetrics is metrics for kubelet
type KubeletMetrics testutil.Metrics
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(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() KubeletMetrics
NewKubeletMetrics returns new metrics which are initialized.
func (m *KubeletMetrics) Equal(o KubeletMetrics) bool
Equal returns true if all metrics are the same as the arguments.
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"` }
LatencySlice is an array of PodLatencyData which encapsulates pod startup latency information.
type LatencySlice []PodLatencyData
func (a LatencySlice) Len() int
func (a LatencySlice) Less(i, j int) bool
func (a LatencySlice) Swap(i, j int)
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 }
SchedulerMetrics is metrics for scheduler
type SchedulerMetrics testutil.Metrics
func (m *SchedulerMetrics) Equal(o SchedulerMetrics) bool
Equal returns true if all metrics are the same as the arguments.
SnapshotControllerMetrics is metrics for controller manager
type SnapshotControllerMetrics testutil.Metrics
func (m *SnapshotControllerMetrics) Equal(o SnapshotControllerMetrics) bool
Equal returns true if all metrics are the same as the arguments.