Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPeriodicMetricLister ¶
func NewPeriodicMetricLister(realLister MetricLister, updateInterval time.Duration) (MetricListerWithNotification, Runnable)
NewPeriodicMetricLister creates a MetricLister that periodically pulls the list of available metrics at the provided interval, but defers the actual act of retrieving the metrics to the supplied MetricLister.
Types ¶
type ExternalSeriesRegistry ¶
type ExternalSeriesRegistry interface { // ListAllMetrics lists all metrics known to this registry ListAllMetrics() []provider.ExternalMetricInfo QueryForMetric(namespace string, metricName string, metricSelector labels.Selector) (prom.Selector, bool, error) }
ExternalSeriesRegistry acts as the top-level converter for transforming Kubernetes requests for external metrics into Prometheus queries.
func NewExternalSeriesRegistry ¶
func NewExternalSeriesRegistry(lister MetricListerWithNotification) ExternalSeriesRegistry
NewExternalSeriesRegistry creates an ExternalSeriesRegistry driven by the data from the provided MetricLister.
type MetricConverter ¶
type MetricConverter interface {
Convert(queryResult prom.QueryResult) (*external_metrics.ExternalMetricValueList, error)
}
MetricConverter provides a unified interface for converting the results of Prometheus queries into external metric types.
func NewMetricConverter ¶
func NewMetricConverter() MetricConverter
NewMetricConverter creates a MetricCoverter, capable of converting any of the three metric types returned by the Prometheus client into external metrics types.
type MetricLister ¶
type MetricLister interface {
ListAllMetrics() (MetricUpdateResult, error)
}
A MetricLister provides a window into all of the metrics that are available within a given Prometheus instance, classified as either Custom or External metrics, but presented generically so that it can manage both types simultaneously.
func NewBasicMetricLister ¶
func NewBasicMetricLister(promClient prom.Client, namers []naming.MetricNamer, lookback time.Duration) MetricLister
NewBasicMetricLister creates a MetricLister that is capable of interactly directly with Prometheus to list metrics.
type MetricListerWithNotification ¶
type MetricListerWithNotification interface { MetricLister Runnable // AddNotificationReceiver registers a callback to be invoked when new metric data is available. AddNotificationReceiver(MetricUpdateCallback) // UpdateNow forces an immediate refresh from the source data. Primarily for test purposes. UpdateNow() }
A MetricListerWithNotification is a MetricLister that has the ability to notify listeners when new metric data is available.
type MetricUpdateCallback ¶
type MetricUpdateCallback func(MetricUpdateResult)
MetricUpdateCallback is a function signature for receiving periodic updates about available metrics.
type MetricUpdateResult ¶
type MetricUpdateResult struct {
// contains filtered or unexported fields
}
MetricUpdateResult represents the output of a periodic inspection of metrics found to be available in Prometheus. It includes both the series data the Prometheus exposed, as well as the configurational object that led to their discovery.
type Runnable ¶
type Runnable interface { // Run runs the runnable forever. Run() // RunUntil runs the runnable until the given channel is closed. RunUntil(stopChan <-chan struct{}) }
Runnable represents something that can be run until told to stop.
func NewExternalPrometheusProvider ¶
func NewExternalPrometheusProvider(promClient prom.Client, namers []naming.MetricNamer, updateInterval time.Duration) (provider.ExternalMetricsProvider, Runnable)
NewExternalPrometheusProvider creates an ExternalMetricsProvider capable of responding to Kubernetes requests for external metric data