Documentation ¶
Index ¶
- Variables
- func APICallToPerfData(apicalls *APIResponsiveness) *e2eperftype.PerfData
- func PrettyPrintJSON(metrics interface{}) string
- type APICall
- type APIResponsiveness
- type APIServerMetrics
- type ClusterAutoscalerMetrics
- type Collection
- type ComponentCollection
- type ControllerManagerMetrics
- type Grabber
- func (g *Grabber) Grab() (Collection, error)
- func (g *Grabber) GrabFromAPIServer() (APIServerMetrics, error)
- func (g *Grabber) GrabFromClusterAutoscaler() (ClusterAutoscalerMetrics, error)
- func (g *Grabber) GrabFromControllerManager() (ControllerManagerMetrics, error)
- func (g *Grabber) GrabFromKubelet(nodeName string) (KubeletMetrics, error)
- func (g *Grabber) GrabFromScheduler() (SchedulerMetrics, error)
- func (g *Grabber) GrabFromSnapshotController(podName string, port int) (SnapshotControllerMetrics, 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(c clientset.Interface, threshold time.Duration, nodeName string, ...) (KubeletLatencyMetrics, error)
- type KubeletMetrics
- type LatencyMetric
- type LatencySlice
- type PodLatencyData
- type SchedulerMetrics
- type SnapshotControllerMetrics
Constants ¶
This section is empty.
Variables ¶
var MetricsGrabbingDisabledError = errors.New("metrics grabbing disabled")
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.
Functions ¶
func APICallToPerfData ¶
func APICallToPerfData(apicalls *APIResponsiveness) *e2eperftype.PerfData
APICallToPerfData transforms APIResponsiveness to PerfData.
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.
Types ¶
type APICall ¶
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 ¶
type APIResponsiveness struct {
APICalls []APICall `json:"apicalls"`
}
APIResponsiveness is a struct for managing multiple API calls.
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
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
func (*ClusterAutoscalerMetrics) Equal ¶
func (m *ClusterAutoscalerMetrics) Equal(o ClusterAutoscalerMetrics) bool
Equal returns true if all metrics are the same as the arguments.
type Collection ¶
type Collection struct { APIServerMetrics APIServerMetrics ControllerManagerMetrics ControllerManagerMetrics SnapshotControllerMetrics SnapshotControllerMetrics KubeletMetrics map[string]KubeletMetrics SchedulerMetrics SchedulerMetrics ClusterAutoscalerMetrics ClusterAutoscalerMetrics }
Collection is metrics collection of components
type ComponentCollection ¶
type ComponentCollection Collection
ComponentCollection is metrics collection of components.
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
func (*ControllerManagerMetrics) Equal ¶
func (m *ControllerManagerMetrics) Equal(o ControllerManagerMetrics) bool
Equal returns true if all metrics are the same as the arguments.
type Grabber ¶
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, 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() (Collection, error)
Grab returns metrics from corresponding component
func (*Grabber) GrabFromAPIServer ¶
func (g *Grabber) GrabFromAPIServer() (APIServerMetrics, error)
GrabFromAPIServer returns metrics from API server
func (*Grabber) GrabFromClusterAutoscaler ¶
func (g *Grabber) GrabFromClusterAutoscaler() (ClusterAutoscalerMetrics, error)
GrabFromClusterAutoscaler returns metrics from cluster autoscaler
func (*Grabber) GrabFromControllerManager ¶
func (g *Grabber) GrabFromControllerManager() (ControllerManagerMetrics, error)
GrabFromControllerManager returns metrics from controller manager
func (*Grabber) GrabFromKubelet ¶
func (g *Grabber) GrabFromKubelet(nodeName string) (KubeletMetrics, error)
GrabFromKubelet returns metrics from kubelet
func (*Grabber) GrabFromScheduler ¶
func (g *Grabber) GrabFromScheduler() (SchedulerMetrics, error)
GrabFromScheduler returns metrics from scheduler
func (*Grabber) GrabFromSnapshotController ¶
func (g *Grabber) GrabFromSnapshotController(podName string, port int) (SnapshotControllerMetrics, error)
GrabFromSnapshotController returns metrics from controller manager
func (*Grabber) HasControlPlanePods ¶
HasControlPlanePods returns true if metrics grabber was able to find control-plane pods
type KubeletLatencyMetric ¶
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 ¶
type KubeletLatencyMetrics []KubeletLatencyMetric
KubeletLatencyMetrics implements sort.Interface for []KubeletMetric based on the latency field.
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(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
func GetKubeletMetrics ¶
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 ¶
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.
type LatencySlice ¶
type LatencySlice []PodLatencyData
LatencySlice is an array of PodLatencyData which encapsulates pod startup latency information.
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 ¶
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 SchedulerMetrics ¶
SchedulerMetrics is metrics for scheduler
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
func (*SnapshotControllerMetrics) Equal ¶
func (m *SnapshotControllerMetrics) Equal(o SnapshotControllerMetrics) bool
Equal returns true if all metrics are the same as the arguments.