Documentation ¶
Index ¶
- Constants
- func ValidateQuery(query string) bool
- type CPUUtilizationBreachQuery
- type CPUUtilizationQuery
- type CompositeQuery
- type CompositeQueryBuilder
- type DataPoint
- type MetricsTransformer
- type PodReadyLatencyQuery
- type PrometheusInstance
- type PrometheusQueryResult
- type PrometheusScraper
- func (ps *PrometheusScraper) GetACLByWorkload(namespace string, workload string) (time.Duration, error)
- func (ps *PrometheusScraper) GetAverageCPUUtilizationByWorkload(namespace string, workload string, start time.Time, end time.Time, ...) ([]DataPoint, error)
- func (ps *PrometheusScraper) GetCPUUtilizationBreachDataPoints(namespace, workloadType, workload string, redLineUtilization float64, ...) ([]DataPoint, error)
- type QueryComponent
- type QueryComponentBuilder
- type RangeQuerySplitter
- type Scraper
Constants ¶
const ( CPUUtilizationDataPointsQuery = "cpuUtilizationDataPointsQuery" BreachDataPointsQuery = "breachDataPointsQuery" )
Variables ¶
This section is empty.
Functions ¶
func ValidateQuery ¶
Types ¶
type CPUUtilizationBreachQuery ¶
type CPUUtilizationBreachQuery CompositeQuery
type CPUUtilizationQuery ¶
type CPUUtilizationQuery CompositeQuery
type CompositeQuery ¶
type CompositeQuery struct {
// contains filtered or unexported fields
}
func NewPrometheusCompositeQueries ¶
func NewPrometheusCompositeQueries() *CompositeQuery
type CompositeQueryBuilder ¶
type CompositeQueryBuilder CompositeQuery
func NewCompositeQueryBuilder ¶
func NewCompositeQueryBuilder() *CompositeQueryBuilder
func (*CompositeQueryBuilder) Build ¶
func (qb *CompositeQueryBuilder) Build() *CompositeQuery
func (*CompositeQueryBuilder) WithQuery ¶
func (qb *CompositeQueryBuilder) WithQuery(name string, query *QueryComponent) *CompositeQueryBuilder
type MetricsTransformer ¶
type PodReadyLatencyQuery ¶
type PodReadyLatencyQuery CompositeQuery
type PrometheusInstance ¶
type PrometheusInstance struct {
// contains filtered or unexported fields
}
type PrometheusQueryResult ¶
type PrometheusQueryResult struct {
// contains filtered or unexported fields
}
type PrometheusScraper ¶
type PrometheusScraper struct { CPUUtilizationQuery *CPUUtilizationQuery CPUUtilizationBreachQuery *CPUUtilizationBreachQuery PodReadyLatencyQuery *PodReadyLatencyQuery // contains filtered or unexported fields }
PrometheusScraper is a Scraper implementation that scrapes metrics data from Prometheus.
func NewPrometheusScraper ¶
func (*PrometheusScraper) GetACLByWorkload ¶
func (*PrometheusScraper) GetAverageCPUUtilizationByWorkload ¶
func (ps *PrometheusScraper) GetAverageCPUUtilizationByWorkload(namespace string, workload string, start time.Time, end time.Time, step time.Duration) ([]DataPoint, error)
GetAverageCPUUtilizationByWorkload returns the average CPU utilization for the given workload type and name in the specified namespace, in the given time range.
func (*PrometheusScraper) GetCPUUtilizationBreachDataPoints ¶
func (ps *PrometheusScraper) GetCPUUtilizationBreachDataPoints(namespace, workloadType, workload string, redLineUtilization float64, start time.Time, end time.Time, step time.Duration) ([]DataPoint, error)
GetCPUUtilizationBreachDataPoints returns the data points where avg CPU utilization for a workload goes above the redLineUtilization while no of ready pods for the workload were < maxReplicas defined in the HPA.
type QueryComponent ¶
type QueryComponent struct {
// contains filtered or unexported fields
}
type QueryComponentBuilder ¶
type QueryComponentBuilder QueryComponent
func NewQueryComponentBuilder ¶
func NewQueryComponentBuilder() *QueryComponentBuilder
func (*QueryComponentBuilder) Build ¶
func (qb *QueryComponentBuilder) Build() *QueryComponent
func (*QueryComponentBuilder) WithLabelKeys ¶
func (qb *QueryComponentBuilder) WithLabelKeys(labelKeys []string) *QueryComponentBuilder
func (*QueryComponentBuilder) WithMetric ¶
func (qb *QueryComponentBuilder) WithMetric(metric string) *QueryComponentBuilder
type RangeQuerySplitter ¶
type RangeQuerySplitter struct {
// contains filtered or unexported fields
}
RangeQuerySplitter splits a given queryRange into multiple range queries of width splitInterval. This is done to avoid loading too many samples into P8s memory.
func NewRangeQuerySplitter ¶
func NewRangeQuerySplitter(splitInterval time.Duration) *RangeQuerySplitter
func (*RangeQuerySplitter) QueryRangeByInterval ¶
type Scraper ¶
type Scraper interface { GetAverageCPUUtilizationByWorkload(namespace, workload string, start time.Time, end time.Time, step time.Duration) ([]DataPoint, error) GetCPUUtilizationBreachDataPoints(namespace, workloadType, workload string, redLineUtilization float64, start time.Time, end time.Time, step time.Duration) ([]DataPoint, error) GetACLByWorkload(namespace, workload string) (time.Duration, error) }
Scraper is an interface for scraping metrics data.