Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricNamer ¶
type MetricNamer interface { // Selector produces the appropriate Prometheus series selector to match all // series handlable by this namer. Selector() prom.Selector // FilterSeries checks to see which of the given series match any additional // constrains beyond the series query. It's assumed that the series given // already matche the series query. FilterSeries(series []prom.Series) []prom.Series // MetricNameForSeries returns the name (as presented in the API) for a given series. MetricNameForSeries(series prom.Series) (string, error) // QueryForSeries returns the query for a given series (not API metric name), with // the given namespace name (if relevant), resource, and resource names. QueryForSeries(series string, resource schema.GroupResource, namespace string, names ...string) (prom.Selector, error) naming.ResourceConverter }
MetricNamer knows how to convert Prometheus series names and label names to metrics API resources, and vice-versa. MetricNamers should be safe to access concurrently. Returned group-resources are "normalized" as per the MetricInfo#Normalized method. Group-resources passed as arguments must themselves be normalized.
func NamersFromConfig ¶
func NamersFromConfig(cfg *config.MetricsDiscoveryConfig, mapper apimeta.RESTMapper) ([]MetricNamer, error)
NamersFromConfig produces a MetricNamer for each rule in the given config.
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 NewPrometheusProvider ¶
func NewPrometheusProvider(mapper apimeta.RESTMapper, kubeClient dynamic.Interface, promClient prom.Client, namers []MetricNamer, updateInterval time.Duration) (provider.CustomMetricsProvider, Runnable)
type SeriesRegistry ¶
type SeriesRegistry interface { // SetSeries replaces the known series in this registry. // Each slice in series should correspond to a MetricNamer in namers. SetSeries(series [][]prom.Series, namers []MetricNamer) error // ListAllMetrics lists all metrics known to this registry ListAllMetrics() []provider.CustomMetricInfo // SeriesForMetric looks up the minimum required series information to make a query for the given metric // against the given resource (namespace may be empty for non-namespaced resources) QueryForMetric(info provider.CustomMetricInfo, namespace string, resourceNames ...string) (query prom.Selector, found bool) // MatchValuesToNames matches result values to resource names for the given metric and value set MatchValuesToNames(metricInfo provider.CustomMetricInfo, values pmodel.Vector) (matchedValues map[string]pmodel.SampleValue, found bool) }
SeriesRegistry provides conversions between Prometheus series and MetricInfo
type SeriesType ¶
type SeriesType int
SeriesType represents the kind of series backing a metric.
const ( CounterSeries SeriesType = iota SecondsCounterSeries GaugeSeries )
Click to show internal directories.
Click to hide internal directories.