Documentation ¶
Index ¶
- func AggregateTotals(totals map[TotalKey]int64, last map[TotalKey]int64) map[RateKey][]int64
- func CalculateRates(newRates map[RateKey][]int64, oldRates map[RateKey]int64, period int64, ...) map[RateKey]int64
- func TotalRequests(podMetrics map[string][]UpstreamMetric) map[TotalKey]int64
- type NginxMetricsClient
- func (c *NginxMetricsClient) Do()
- func (c *NginxMetricsClient) Fetch() (map[string][]UpstreamMetric, error)
- func (c *NginxMetricsClient) GetValue(resource, namespace, name, metricName string) (int64, error)
- func (c *NginxMetricsClient) Loop()
- func (c *NginxMetricsClient) LoopForever()
- func (c *NginxMetricsClient) Timestamp() time.Time
- func (c *NginxMetricsClient) UpdateRates(podMetrics map[string][]UpstreamMetric)
- type RateKey
- type TotalKey
- type UpstreamMetric
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregateTotals ¶
func CalculateRates ¶
func CalculateRates(newRates map[RateKey][]int64, oldRates map[RateKey]int64, period int64, ingressPods int64, samples int64) map[RateKey]int64
CalculateRates calculates the moving average rates per service
func TotalRequests ¶
func TotalRequests(podMetrics map[string][]UpstreamMetric) map[TotalKey]int64
Types ¶
type NginxMetricsClient ¶
type NginxMetricsClient struct { Label string Port string Path string Duration time.Duration MovingSamples int64 // contains filtered or unexported fields }
NginxMetricsClient holds some state about the clients
func NewMetricsClient ¶
func NewMetricsClient(label, port, path string, duration time.Duration, movingSamples int64) *NginxMetricsClient
NewMetricsClient returns a new client and starts collecting metrics
func (*NginxMetricsClient) Fetch ¶
func (c *NginxMetricsClient) Fetch() (map[string][]UpstreamMetric, error)
Fetch gets the values from the current ingress pods
func (*NginxMetricsClient) GetValue ¶
func (c *NginxMetricsClient) GetValue(resource, namespace, name, metricName string) (int64, error)
GetValue returns average requests per second * 100 (i.e. int millis)
func (*NginxMetricsClient) Loop ¶
func (c *NginxMetricsClient) Loop()
Loop does the fetch-and-update loop
func (*NginxMetricsClient) LoopForever ¶
func (c *NginxMetricsClient) LoopForever()
LoopForever starts the regular requests
func (*NginxMetricsClient) Timestamp ¶
func (c *NginxMetricsClient) Timestamp() time.Time
func (*NginxMetricsClient) UpdateRates ¶
func (c *NginxMetricsClient) UpdateRates(podMetrics map[string][]UpstreamMetric)
UpdateRates gets the latest totals and calculates the new rates
Click to show internal directories.
Click to hide internal directories.