Tons of movement. See notes.

* Renamed `MetricNamer` to `SeriesConverter` and renamed `MetricNameConverter` to `MetricNamer`.
* Simplified the `metricConverter` code.
* Greatly simplified the `externalSeriesRegistry` and removed the `externalInfoMap` code.
* Fixed doc comment format.
* Still several `TODO`s to address.
This commit is contained in:
Tony Compton 2018-08-29 14:30:26 -04:00
parent a94494337e
commit d1827c5611
28 changed files with 1106 additions and 1006 deletions

View file

@ -46,10 +46,10 @@ type prometheusProvider struct {
SeriesRegistry
}
//NewPrometheusProvider creates an CustomMetricsProvider capable of responding to Kubernetes requests for custom metric data.
func NewPrometheusProvider(mapper apimeta.RESTMapper, kubeClient dynamic.Interface, promClient prom.Client, namers []MetricNamer, updateInterval time.Duration) (provider.CustomMetricsProvider, Runnable) {
//TODO: AC - Consider injecting these objects and calling .Run() before calling this function.
basicLister := NewBasicMetricLister(promClient, namers, updateInterval)
// NewPrometheusProvider creates an CustomMetricsProvider capable of responding to Kubernetes requests for custom metric data.
func NewPrometheusProvider(mapper apimeta.RESTMapper, kubeClient dynamic.Interface, promClient prom.Client, converters []SeriesConverter, updateInterval time.Duration) (provider.CustomMetricsProvider, Runnable) {
// TODO: Consider injecting these objects and calling .Run() on the runnables before calling this function.
basicLister := NewBasicMetricLister(promClient, converters, updateInterval)
periodicLister, _ := NewPeriodicMetricLister(basicLister, updateInterval)
seriesRegistry := NewBasicSeriesRegistry(periodicLister, mapper)