Documentation ¶
Index ¶
Constants ¶
View Source
const ( APNLabel = "apn" DaysLabel = "days" DirectionLabel = "direction" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APThroughputCalculation ¶
type APThroughputCalculation struct { CalculationParams QueryStepSize time.Duration Direction ConsumptionDirection }
func (*APThroughputCalculation) Calculate ¶
func (x *APThroughputCalculation) Calculate(prometheusClient PrometheusAPI) ([]Result, error)
type Analyzer ¶
type Analyzer interface { // Schedule the analyzer to run calculations periodically based on the // cron expression format schedule parameter Schedule(schedule string) error // Run triggers the analyzer's cronjob to start running. This function // blocks. Run() }
func NewPrometheusAnalyzer ¶
func NewPrometheusAnalyzer(prometheusClient v1.API, calculations []Calculation, exporter Exporter) Analyzer
type Calculation ¶
type Calculation interface {
Calculate(PrometheusAPI) ([]Result, error)
}
type CalculationParams ¶
type CalculationParams struct { Days int RegisteredGauge *prometheus.GaugeVec Labels prometheus.Labels Name string }
type ConsumptionDirection ¶
type ConsumptionDirection string
const ( ConsumptionIn ConsumptionDirection = "in" ConsumptionOut ConsumptionDirection = "out" )
type HttpClient ¶
type PrometheusAPI ¶
type PrometheusAnalyzer ¶
type PrometheusAnalyzer struct { Cron *cron.Cron PrometheusClient PrometheusAPI Calculations []Calculation Exporter Exporter }
PrometheusAnalyzer accesses prometheus metrics and performs queries/aggregations to calculate various metrics
func (*PrometheusAnalyzer) Analyze ¶
func (a *PrometheusAnalyzer) Analyze()
func (*PrometheusAnalyzer) Run ¶
func (a *PrometheusAnalyzer) Run()
func (*PrometheusAnalyzer) Schedule ¶
func (a *PrometheusAnalyzer) Schedule(schedule string) error
type UserConsumptionCalculation ¶
type UserConsumptionCalculation struct { CalculationParams Direction ConsumptionDirection }
func (*UserConsumptionCalculation) Calculate ¶
func (x *UserConsumptionCalculation) Calculate(prometheusClient PrometheusAPI) ([]Result, error)
type UserThroughputCalculation ¶
type UserThroughputCalculation struct { CalculationParams QueryStepSize time.Duration Direction ConsumptionDirection }
func (*UserThroughputCalculation) Calculate ¶
func (x *UserThroughputCalculation) Calculate(prometheusClient PrometheusAPI) ([]Result, error)
type XAPCalculation ¶
type XAPCalculation struct { CalculationParams ThresholdBytes int }
XAPCalculation holds the parameters needed to run a XAP query and the registered prometheus gauge that the resulting value should be stored in
func (*XAPCalculation) Calculate ¶
func (x *XAPCalculation) Calculate(prometheusClient PrometheusAPI) ([]Result, error)
Calculate returns the number of unique users who have had a session in the past X days and have used over `thresholdBytes` data in that time
Click to show internal directories.
Click to hide internal directories.