provider

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CollectionSuccesses is the total number of successful collections.
	CollectionSuccesses = promauto.NewCounter(prometheus.CounterOpts{
		Name: "kube_metrics_adapter_collections_success",
		Help: "The total number of successful collections",
	})
	// CollectionErrors is the total number of failed collection attempts.
	CollectionErrors = promauto.NewCounter(prometheus.CounterOpts{
		Name: "kube_metrics_adapter_collections_error",
		Help: "The total number of failed collection attempts",
	})
	// UpdateSuccesses is the total number of successful HPA updates.
	UpdateSuccesses = promauto.NewCounter(prometheus.CounterOpts{
		Name: "kube_metrics_adapter_updates_success",
		Help: "The total number of successful HPA updates",
	})
	// UpdateErrors is the total number of failed HPA update attempts.
	UpdateErrors = promauto.NewCounter(prometheus.CounterOpts{
		Name: "kube_metrics_adapter_updates_error",
		Help: "The total number of failed HPA update attempts",
	})
)

Functions

func Convert_autoscaling_CrossVersionObjectReference_To_v2beta1_CrossVersionObjectReference

func Convert_autoscaling_CrossVersionObjectReference_To_v2beta1_CrossVersionObjectReference(in *autoscaling.CrossVersionObjectReference, out *v2beta1.CrossVersionObjectReference, s conversion.Scope) error

Convert_autoscaling_CrossVersionObjectReference_To_v2beta1_CrossVersionObjectReference is an autogenerated conversion function.

func Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition

func Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition(in *autoscaling.HorizontalPodAutoscalerCondition, out *v2beta1.HorizontalPodAutoscalerCondition, s conversion.Scope) error

Convert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition is an autogenerated conversion function.

func Convert_autoscaling_HorizontalPodAutoscalerList_To_v2beta1_HorizontalPodAutoscalerList

func Convert_autoscaling_HorizontalPodAutoscalerList_To_v2beta1_HorizontalPodAutoscalerList(in *autoscaling.HorizontalPodAutoscalerList, out *v2beta1.HorizontalPodAutoscalerList, s conversion.Scope) error

Convert_autoscaling_HorizontalPodAutoscalerList_To_v2beta1_HorizontalPodAutoscalerList is an autogenerated conversion function.

func Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v2beta1_HorizontalPodAutoscalerSpec

func Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v2beta1_HorizontalPodAutoscalerSpec(in *autoscaling.HorizontalPodAutoscalerSpec, out *v2beta1.HorizontalPodAutoscalerSpec, s conversion.Scope) error

Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v2beta1_HorizontalPodAutoscalerSpec is an autogenerated conversion function.

func Convert_autoscaling_HorizontalPodAutoscalerStatus_To_v2beta1_HorizontalPodAutoscalerStatus

func Convert_autoscaling_HorizontalPodAutoscalerStatus_To_v2beta1_HorizontalPodAutoscalerStatus(in *autoscaling.HorizontalPodAutoscalerStatus, out *v2beta1.HorizontalPodAutoscalerStatus, s conversion.Scope) error

Convert_autoscaling_HorizontalPodAutoscalerStatus_To_v2beta1_HorizontalPodAutoscalerStatus is an autogenerated conversion function.

func Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler

func Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler(in *autoscaling.HorizontalPodAutoscaler, out *v2beta1.HorizontalPodAutoscaler, s conversion.Scope) error

Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutoscaler is an autogenerated conversion function.

func Convert_autoscaling_MetricSpec_To_v2beta1_MetricSpec

func Convert_autoscaling_MetricSpec_To_v2beta1_MetricSpec(in *autoscaling.MetricSpec, out *v2beta1.MetricSpec, s conversion.Scope) error

Convert_autoscaling_MetricSpec_To_v2beta1_MetricSpec is an autogenerated conversion function.

func Convert_autoscaling_MetricStatus_To_v2beta1_MetricStatus

func Convert_autoscaling_MetricStatus_To_v2beta1_MetricStatus(in *autoscaling.MetricStatus, out *v2beta1.MetricStatus, s conversion.Scope) error

Convert_autoscaling_MetricStatus_To_v2beta1_MetricStatus is an autogenerated conversion function.

func Convert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource

func Convert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource(in *autoscaling.PodsMetricSource, out *autoscalingv2beta1.PodsMetricSource, s conversion.Scope) error

func Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus

func Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus(in *autoscaling.PodsMetricStatus, out *autoscalingv2beta1.PodsMetricStatus, s conversion.Scope) error

func Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference

func Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference(in *v2beta1.CrossVersionObjectReference, out *autoscaling.CrossVersionObjectReference, s conversion.Scope) error

Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference is an autogenerated conversion function.

func Convert_v2beta1_HorizontalPodAutoscalerCondition_To_autoscaling_HorizontalPodAutoscalerCondition

func Convert_v2beta1_HorizontalPodAutoscalerCondition_To_autoscaling_HorizontalPodAutoscalerCondition(in *v2beta1.HorizontalPodAutoscalerCondition, out *autoscaling.HorizontalPodAutoscalerCondition, s conversion.Scope) error

Convert_v2beta1_HorizontalPodAutoscalerCondition_To_autoscaling_HorizontalPodAutoscalerCondition is an autogenerated conversion function.

func Convert_v2beta1_HorizontalPodAutoscalerList_To_autoscaling_HorizontalPodAutoscalerList

func Convert_v2beta1_HorizontalPodAutoscalerList_To_autoscaling_HorizontalPodAutoscalerList(in *v2beta1.HorizontalPodAutoscalerList, out *autoscaling.HorizontalPodAutoscalerList, s conversion.Scope) error

Convert_v2beta1_HorizontalPodAutoscalerList_To_autoscaling_HorizontalPodAutoscalerList is an autogenerated conversion function.

func Convert_v2beta1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscalerSpec

func Convert_v2beta1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscalerSpec(in *v2beta1.HorizontalPodAutoscalerSpec, out *autoscaling.HorizontalPodAutoscalerSpec, s conversion.Scope) error

Convert_v2beta1_HorizontalPodAutoscalerSpec_To_autoscaling_HorizontalPodAutoscalerSpec is an autogenerated conversion function.

func Convert_v2beta1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodAutoscalerStatus

func Convert_v2beta1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodAutoscalerStatus(in *v2beta1.HorizontalPodAutoscalerStatus, out *autoscaling.HorizontalPodAutoscalerStatus, s conversion.Scope) error

Convert_v2beta1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodAutoscalerStatus is an autogenerated conversion function.

func Convert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler

func Convert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler(in *v2beta1.HorizontalPodAutoscaler, out *autoscaling.HorizontalPodAutoscaler, s conversion.Scope) error

Convert_v2beta1_HorizontalPodAutoscaler_To_autoscaling_HorizontalPodAutoscaler is an autogenerated conversion function.

func Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec

func Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec(in *v2beta1.MetricSpec, out *autoscaling.MetricSpec, s conversion.Scope) error

Convert_v2beta1_MetricSpec_To_autoscaling_MetricSpec is an autogenerated conversion function.

func Convert_v2beta1_MetricStatus_To_autoscaling_MetricStatus

func Convert_v2beta1_MetricStatus_To_autoscaling_MetricStatus(in *v2beta1.MetricStatus, out *autoscaling.MetricStatus, s conversion.Scope) error

Convert_v2beta1_MetricStatus_To_autoscaling_MetricStatus is an autogenerated conversion function.

func Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource

func Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *autoscalingv2beta1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error

func Convert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus

func Convert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus(in *autoscalingv2beta1.PodsMetricStatus, out *autoscaling.PodsMetricStatus, s conversion.Scope) error

Types

type CollectorScheduler

type CollectorScheduler struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CollectorScheduler is a scheduler for running metric collection jobs. It keeps track of all running collectors and stops them if they are to be removed.

func NewCollectorScheduler

func NewCollectorScheduler(ctx context.Context, metricsc chan<- metricCollection) *CollectorScheduler

NewCollectorScheudler initializes a new CollectorScheduler.

func (*CollectorScheduler) Add

func (t *CollectorScheduler) Add(resourceRef resourceReference, typeName collector.MetricTypeName, metricCollector collector.Collector)

Add adds a new collector to the collector scheduler. Once the collector is added it will be started to collect metrics.

func (*CollectorScheduler) Remove

func (t *CollectorScheduler) Remove(resourceRef resourceReference)

Remove removes a collector from the Collector schduler. The collector is stopped before it's removed.

type HPAProvider

type HPAProvider struct {
	// contains filtered or unexported fields
}

HPAProvider is a base provider for initializing metric collectors based on HPA resources.

func NewHPAProvider

func NewHPAProvider(client kubernetes.Interface, interval, collectorInterval time.Duration, collectorFactory *collector.CollectorFactory) *HPAProvider

NewHPAProvider initializes a new HPAProvider.

func (*HPAProvider) GetExternalMetric

func (p *HPAProvider) GetExternalMetric(namespace string, metricSelector labels.Selector, info provider.ExternalMetricInfo) (*external_metrics.ExternalMetricValueList, error)

func (*HPAProvider) GetMetricByName

GetMetricByName gets a single metric by name.

func (*HPAProvider) GetMetricBySelector

func (p *HPAProvider) GetMetricBySelector(namespace string, selector labels.Selector, info provider.CustomMetricInfo) (*custom_metrics.MetricValueList, error)

GetMetricBySelector returns metrics for namespaced resources by label selector.

func (*HPAProvider) ListAllExternalMetrics

func (p *HPAProvider) ListAllExternalMetrics() []provider.ExternalMetricInfo

func (*HPAProvider) ListAllMetrics

func (p *HPAProvider) ListAllMetrics() []provider.CustomMetricInfo

ListAllMetrics list all available metrics from the provicer.

func (*HPAProvider) Run

func (p *HPAProvider) Run(ctx context.Context)

Run runs the HPA resource discovery and metric collection.

type MetricStore

type MetricStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MetricStore is a simple in-memory Metrics Store for HPA metrics.

func NewMetricStore

func NewMetricStore(ttlCalculator func() time.Time) *MetricStore

NewMetricStore initializes an empty Metrics Store.

func (*MetricStore) GetExternalMetric

func (s *MetricStore) GetExternalMetric(namespace string, selector labels.Selector, info provider.ExternalMetricInfo) (*external_metrics.ExternalMetricValueList, error)

GetExternalMetric gets external metric from the store by metric name and selector.

func (*MetricStore) GetMetricsByName

GetMetricsByName looks up metrics in the customMetricsStore by resource name.

func (*MetricStore) GetMetricsBySelector

func (s *MetricStore) GetMetricsBySelector(namespace string, selector labels.Selector, info provider.CustomMetricInfo) *custom_metrics.MetricValueList

GetMetricsBySelector gets metric from the customMetricsStore using a label selector to find metrics for matching resources.

func (*MetricStore) Insert

func (s *MetricStore) Insert(value collector.CollectedMetric)

Insert inserts a collected metric into the metric customMetricsStore.

func (*MetricStore) ListAllExternalMetrics

func (s *MetricStore) ListAllExternalMetrics() []provider.ExternalMetricInfo

ListAllExternalMetrics lists all external metrics in the Metrics Store.

func (*MetricStore) ListAllMetrics

func (s *MetricStore) ListAllMetrics() []provider.CustomMetricInfo

ListAllMetrics lists all custom metrics in the Metrics Store.

func (*MetricStore) RemoveExpired

func (s *MetricStore) RemoveExpired()

RemoveExpired removes expired metrics from the Metrics Store. A metric is considered expired if its metricsTTL is before time.Now().

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL