Documentation ¶
Index ¶
- Constants
- func ComputePercentiles(timeSeries []ResourceUsagePerContainer, percentilesToCompute []int) map[int]ResourceUsagePerContainer
- func ConvertSampleToBucket(sample *model.Sample, h *HistogramVec)
- func ConvertSampleToHistogram(sample *model.Sample, h *Histogram)
- func CreateSelectorsString(namespace, labelSelector, fieldSelector string) string
- func ExtractMetricSamples(metricsBlob string) ([]*model.Sample, error)
- func ExtractMetricSamples2(response []byte) ([]*model.Sample, error)
- func GetMasterHost(host string) (string, error)
- func LeftMergeData(left, right map[int]ResourceUsagePerContainer) map[int]ResourceUsagePerContainer
- func ToPrometheusTime(t time.Duration) string
- func WaitForNodes(clientSet clientset.Interface, stopCh <-chan struct{}, ...) error
- func WaitForPVCs(clientSet clientset.Interface, stopCh <-chan struct{}, ...) error
- func WaitForPVs(clientSet clientset.Interface, stopCh <-chan struct{}, ...) error
- func WaitForPods(clientSet clientset.Interface, stopCh <-chan struct{}, ...) error
- type ContainerResourceUsage
- type DataItem
- type Histogram
- type HistogramVec
- type LatencyData
- type LatencyMetric
- type LatencySlice
- type NodeStore
- type ObjectSelector
- type ObjectStore
- type ObjectTransitionTimes
- func (o *ObjectTransitionTimes) CalculateTransitionsLatency(t map[string]Transition) map[string]*LatencyMetric
- func (o *ObjectTransitionTimes) Count(phase string) int
- func (o *ObjectTransitionTimes) Get(key, phase string) (time.Time, bool)
- func (o *ObjectTransitionTimes) Set(key, phase string, t time.Time)
- type PVCDiff
- type PVCStore
- type PVCsStartupStatus
- type PVDiff
- type PVStore
- type PVsStartupStatus
- type PerfData
- type PodDiff
- type PodStore
- type PodsStartupStatus
- type PodsStatus
- type PrometheusQueryExecutor
- type ResourceConstraint
- type ResourceUsagePerContainer
- type SSHResult
- type SingleContainerSummary
- type Transition
- type UsageDataPerContainer
- type WaitForNodeOptions
- type WaitForPVCOptions
- type WaitForPVOptions
- type WaitForPodOptions
Constants ¶
const PerfResultEnd = "[Finish:Performance]"
PerfResultEnd is the end of generated perfdata. Analyzing tools can find the end of the perf result with this tag.
const PerfResultTag = "[Result:Performance]"
PerfResultTag is the prefix of generated perfdata. Analyzing tools can find the perf result with this tag.
Variables ¶
This section is empty.
Functions ¶
func ComputePercentiles ¶
func ComputePercentiles(timeSeries []ResourceUsagePerContainer, percentilesToCompute []int) map[int]ResourceUsagePerContainer
ComputePercentiles calculates percentiles for given data series.
func ConvertSampleToBucket ¶
func ConvertSampleToBucket(sample *model.Sample, h *HistogramVec)
ConvertSampleToBucket converts prometheus sample into HistogramVec bucket.
func ConvertSampleToHistogram ¶
ConvertSampleToHistogram converts prometheus sample into Histogram.
func CreateSelectorsString ¶
CreateSelectorsString creates a string representation for given namespace, label selector and field selector.
func ExtractMetricSamples ¶
ExtractMetricSamples unpacks metric blob into prometheus model structures.
func ExtractMetricSamples2 ¶
ExtractMetricSamples2 unpacks metric blob into prometheus model structures.
func GetMasterHost ¶
GetMasterHost turns host name (without prefix and port).
func LeftMergeData ¶
func LeftMergeData(left, right map[int]ResourceUsagePerContainer) map[int]ResourceUsagePerContainer
LeftMergeData merges two data structures.
func ToPrometheusTime ¶
ToPrometheusTime returns prometheus string representation of given time.
func WaitForNodes ¶
func WaitForNodes(clientSet clientset.Interface, stopCh <-chan struct{}, options *WaitForNodeOptions) error
WaitForNodes waits till the desired number of nodes is ready. If stopCh is closed before all nodes are ready, the error will be returned.
func WaitForPVCs ¶
func WaitForPVCs(clientSet clientset.Interface, stopCh <-chan struct{}, options *WaitForPVCOptions) error
WaitForPVCs waits till desired number of PVCs is running. PVCs are be specified by namespace, field and/or label selectors. If stopCh is closed before all PVCs are running, the error will be returned.
func WaitForPVs ¶
func WaitForPVs(clientSet clientset.Interface, stopCh <-chan struct{}, options *WaitForPVOptions) error
WaitForPVs waits till desired number of PVs is running. PVs are be specified by field and/or label selectors. If stopCh is closed before all PVs are running, the error will be returned.
func WaitForPods ¶
func WaitForPods(clientSet clientset.Interface, stopCh <-chan struct{}, options *WaitForPodOptions) error
WaitForPods waits till desired number of pods is running. Pods are be specified by namespace, field and/or label selectors. If stopCh is closed before all pods are running, the error will be returned.
Types ¶
type ContainerResourceUsage ¶
type ContainerResourceUsage struct { Name string Timestamp time.Time CPUUsageInCores float64 MemoryUsageInBytes uint64 MemoryWorkingSetInBytes uint64 MemoryRSSInBytes uint64 // The interval used to calculate CPUUsageInCores. CPUInterval time.Duration }
ContainerResourceUsage represents resource usage by a single container.
type DataItem ¶
type DataItem struct { // Data is a map from bucket to real data point (e.g. "Perc90" -> 23.5). Notice // that all data items with the same label combination should have the same buckets. Data map[string]float64 `json:"data"` // Unit is the data unit. Notice that all data items with the same label combination // should have the same unit. Unit string `json:"unit"` // Labels is the labels of the data item. Labels map[string]string `json:"labels,omitempty"` }
DataItem is the data point.
type Histogram ¶
type Histogram struct { Labels map[string]string `json:"labels"` Buckets map[string]int `json:"buckets"` }
Histogram is a structure that represents distribution of data.
func NewHistogram ¶
NewHistogram creates new Histogram instance.
type LatencyData ¶
LatencyData is an interface for latance data structure.
type LatencyMetric ¶
type LatencyMetric struct { Perc50 time.Duration `json:"Perc50"` Perc90 time.Duration `json:"Perc90"` Perc99 time.Duration `json:"Perc99"` }
LatencyMetric represent 50th, 90th and 99th duration quantiles.
func NewLatencyMetric ¶
func NewLatencyMetric(latencies []LatencyData) LatencyMetric
NewLatencyMetric converts latency data array to latency metric.
func NewLatencyMetricPrometheus ¶
func NewLatencyMetricPrometheus(samples []*model.Sample) (*LatencyMetric, error)
NewLatencyMetricPrometheus tries to parse latency data from results of Prometheus query.
func (*LatencyMetric) SetQuantile ¶
func (metric *LatencyMetric) SetQuantile(quantile float64, latency time.Duration)
SetQuantile set quantile value. Only 0.5, 0.9 and 0.99 quantiles are supported.
func (LatencyMetric) String ¶
func (metric LatencyMetric) String() string
func (*LatencyMetric) ToPerfData ¶
func (metric *LatencyMetric) ToPerfData(name string) DataItem
ToPerfData converts latency metric to PerfData.
func (*LatencyMetric) VerifyThreshold ¶
func (metric *LatencyMetric) VerifyThreshold(threshold time.Duration) error
VerifyThreshold verifies latency metric against given percentile thresholds.
type LatencySlice ¶
type LatencySlice []LatencyData
LatencySlice is a sortable latency array.
func (LatencySlice) Len ¶
func (l LatencySlice) Len() int
func (LatencySlice) Less ¶
func (l LatencySlice) Less(i, j int) bool
func (LatencySlice) Swap ¶
func (l LatencySlice) Swap(i, j int)
type NodeStore ¶
type NodeStore struct {
*ObjectStore
}
NodeStore is a convenient wrapper around cache.Store.
func NewNodeStore ¶
func NewNodeStore(c clientset.Interface, selector *ObjectSelector) (*NodeStore, error)
NewNodeStore creates NodeStore based on a given object selector.
type ObjectSelector ¶
ObjectSelector is an aggregation of namespace, labelSelector and fieldSelector.
func NewObjectSelector ¶
func NewObjectSelector() *ObjectSelector
NewObjectSelector creates default object selector.
func (*ObjectSelector) Parse ¶
func (o *ObjectSelector) Parse(params map[string]interface{}) error
Parse parses namespace, labelSelector and fieldSelector from params map.
func (*ObjectSelector) String ¶
func (o *ObjectSelector) String() string
String returns string representation of the selector.
type ObjectStore ¶
type ObjectStore struct { cache.Store Reflector *cache.Reflector // contains filtered or unexported fields }
ObjectStore is a convenient wrapper around cache.Store.
type ObjectTransitionTimes ¶
type ObjectTransitionTimes struct {
// contains filtered or unexported fields
}
ObjectTransitionTimes stores beginning time of each phase. It can calculate transition latency between phases. ObjectTransitionTimes is thread-safe.
func NewObjectTransitionTimes ¶
func NewObjectTransitionTimes(name string) *ObjectTransitionTimes
NewObjectTransitionTimes creates new ObjectTransitionTimes instance.
func (*ObjectTransitionTimes) CalculateTransitionsLatency ¶
func (o *ObjectTransitionTimes) CalculateTransitionsLatency(t map[string]Transition) map[string]*LatencyMetric
CalculateTransitionsLatency returns a latency map for given transitions.
func (*ObjectTransitionTimes) Count ¶
func (o *ObjectTransitionTimes) Count(phase string) int
Count returns number of key having given phase entry.
type PVCDiff ¶
type PVCDiff map[string]*pvcInfo
PVCDiff represets diff between old and new group of pvcs.
func DiffPVCs ¶
func DiffPVCs(oldPVCs []*corev1.PersistentVolumeClaim, curPVCs []*corev1.PersistentVolumeClaim) PVCDiff
DiffPVCs computes a PVCDiff given 2 lists of PVCs.
func (PVCDiff) DeletedPVCs ¶
DeletedPVCs returns a slice of PVCs that were present at the beginning and then disappeared.
type PVCStore ¶
type PVCStore struct {
*ObjectStore
}
PVCStore is a convenient wrapper around cache.Store.
func NewPVCStore ¶
func NewPVCStore(c clientset.Interface, selector *ObjectSelector) (*PVCStore, error)
NewPVCStore creates PVCStore based on a given object selector.
func (*PVCStore) List ¶
func (s *PVCStore) List() []*v1.PersistentVolumeClaim
List returns list of pvcs (that satisfy conditions provided to NewPVCStore).
type PVCsStartupStatus ¶
PVCsStartupStatus represents phase of a pvc group.
func ComputePVCsStartupStatus ¶
func ComputePVCsStartupStatus(pvcs []*corev1.PersistentVolumeClaim, expected int) PVCsStartupStatus
ComputePVCsStartupStatus computes PVCsStartupStatus for a group of PVCs.
func (*PVCsStartupStatus) String ¶
func (s *PVCsStartupStatus) String() string
String returns string representation for PVCsStartupStatus.
type PVDiff ¶
type PVDiff map[string]*pvInfo
PVDiff represents diff between old and new group of PVs.
func DiffPVs ¶
func DiffPVs(oldPVs []*corev1.PersistentVolume, curPVs []*corev1.PersistentVolume) PVDiff
DiffPVs computes a PVDiff given 2 lists of PVs.
func (PVDiff) DeletedPVs ¶
DeletedPVs returns a slice of PVs that were present at the beginning and then disappeared.
type PVStore ¶
type PVStore struct {
*ObjectStore
}
PVStore is a convenient wrapper around cache.Store.
func NewPVStore ¶
func NewPVStore(c clientset.Interface, selector *ObjectSelector) (*PVStore, error)
NewPVStore creates PVStore based on a given object selector.
func (*PVStore) List ¶
func (s *PVStore) List() []*v1.PersistentVolume
List returns list of pvs (that satisfy conditions provided to NewPVStore).
type PVsStartupStatus ¶
type PVsStartupStatus struct { Pending int Available int Bound int Released int Failed int Expected int Created int }
PVsStartupStatus represents phase of a PV group.
func ComputePVsStartupStatus ¶
func ComputePVsStartupStatus(PVs []*corev1.PersistentVolume, expected int) PVsStartupStatus
ComputePVsStartupStatus computes PVsStartupStatus for a group of PVs.
func (*PVsStartupStatus) String ¶
func (s *PVsStartupStatus) String() string
String returns string representation for PVsStartupStatus.
type PerfData ¶
type PerfData struct { // Version is the version of the metrics. The metrics consumer could use the version // to detect metrics version change and decide what version to support. Version string `json:"version"` DataItems []DataItem `json:"dataItems"` // Labels is the labels of the dataset. Labels map[string]string `json:"labels,omitempty"` }
PerfData contains all data items generated in current test.
func LatencyMapToPerfData ¶
func LatencyMapToPerfData(latency map[string]*LatencyMetric) *PerfData
LatencyMapToPerfData converts latency map into PerfData.
type PodDiff ¶
type PodDiff map[string]*podDiffInfo
PodDiff represets diff between old and new group of pods.
func (PodDiff) DeletedPods ¶
DeletedPods returns a slice of pods that were present at the beginning and then disappeared.
type PodStore ¶
type PodStore struct {
*ObjectStore
}
PodStore is a convenient wrapper around cache.Store.
func NewPodStore ¶
func NewPodStore(c clientset.Interface, selector *ObjectSelector) (*PodStore, error)
NewPodStore creates PodStore based on given object selector.
type PodsStartupStatus ¶
type PodsStartupStatus struct { Expected int Terminating int Running int Scheduled int RunningButNotReady int Waiting int Pending int Unknown int Inactive int Created int RunningUpdated int }
PodsStartupStatus represents status of a pods group.
func ComputePodsStartupStatus ¶
func ComputePodsStartupStatus(pods []*corev1.Pod, expected int, isPodUpdated func(*corev1.Pod) bool) PodsStartupStatus
ComputePodsStartupStatus computes PodsStartupStatus for a group of pods.
func (*PodsStartupStatus) String ¶
func (s *PodsStartupStatus) String() string
String returns string representation for podsStartupStatus.
type PodsStatus ¶
type PodsStatus struct {
// contains filtered or unexported fields
}
PodsStatus is a collection of current pod phases and node assignments data.
func ComputePodsStatus ¶
func ComputePodsStatus(pods []*corev1.Pod, expected int) *PodsStatus
ComputePodsStatus computes PodsStatus for a group of pods.
func (*PodsStatus) String ¶
func (ps *PodsStatus) String() string
String returns string representation of a PodsStatus.
type PrometheusQueryExecutor ¶
type PrometheusQueryExecutor struct {
// contains filtered or unexported fields
}
PrometheusQueryExecutor executes queries against Prometheus instance running inside test cluster.
func NewQueryExecutor ¶
func NewQueryExecutor(c clientset.Interface) *PrometheusQueryExecutor
NewQueryExecutor creates instance of PrometheusQueryExecutor.
type ResourceConstraint ¶
type ResourceConstraint struct { CPUConstraint float64 `json: cpuConstraint` MemoryConstraint uint64 `json: memoryConstraint` }
ResourceConstraint specifies constraint on resources.
type ResourceUsagePerContainer ¶
type ResourceUsagePerContainer map[string]*ContainerResourceUsage
ResourceUsagePerContainer is a map of ContainerResourceUsage for containers.
type SingleContainerSummary ¶
SingleContainerSummary is a resource usage summary for a single container.
type Transition ¶
Transition describe transition between two phases.
type UsageDataPerContainer ¶
UsageDataPerContainer contains resource usage data series.
type WaitForNodeOptions ¶
type WaitForNodeOptions struct { Selector *ObjectSelector MinDesiredNodeCount int MaxDesiredNodeCount int EnableLogging bool CallerName string WaitForNodesInterval time.Duration }
WaitForNodeOptions is an options object used by WaitForNodes methods.
type WaitForPVCOptions ¶
type WaitForPVCOptions struct { Selector *ObjectSelector DesiredPVCCount int EnableLogging bool CallerName string WaitForPVCsInterval time.Duration }
WaitForPVCOptions is an options used by WaitForPVCs methods.
type WaitForPVOptions ¶
type WaitForPVOptions struct { Selector *ObjectSelector DesiredPVCount int EnableLogging bool CallerName string WaitForPVsInterval time.Duration }
WaitForPVOptions is an options used by WaitForPVs methods.
type WaitForPodOptions ¶
type WaitForPodOptions struct { Selector *ObjectSelector DesiredPodCount int EnableLogging bool CallerName string WaitForPodsInterval time.Duration // IsPodUpdated can be used to detect which pods have been already updated. // nil value means all pods are updated. IsPodUpdated func(*v1.Pod) bool }
WaitForPodOptions is an options used by WaitForPods methods.