provider

package
v0.0.0-...-cd71283 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeProvider

func NewFakeProvider() provider.ExternalMetricsProvider

NewFakeProvider returns a fake ExternalMetricsProvider, intended to use for testing purpose

func NewStackdriverProvider

func NewStackdriverProvider(kubeClient *corev1.CoreV1Client, mapper apimeta.RESTMapper, stackdriverService *stackdriver.Service, rateInterval, alignmentPeriod time.Duration, useNewResourceModel bool) provider.MetricsProvider

NewStackdriverProvider creates a StackdriverProvider

Types

type StackdriverProvider

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

StackdriverProvider is a provider of custom metrics from Stackdriver.

func (*StackdriverProvider) GetExternalMetric

func (p *StackdriverProvider) GetExternalMetric(namespace string, metricNameEscaped string, metricSelector labels.Selector) (*external_metrics.ExternalMetricValueList, error)

GetExternalMetric queries Stackdriver for external metrics.

func (*StackdriverProvider) GetNamespacedMetricByName

func (p *StackdriverProvider) GetNamespacedMetricByName(groupResource schema.GroupResource, namespace string, name string, escapedMetricName string) (*custom_metrics.MetricValue, error)

GetNamespacedMetricByName queries Stackdriver for metrics identified by name and associated with a namespace.

func (*StackdriverProvider) GetNamespacedMetricBySelector

func (p *StackdriverProvider) GetNamespacedMetricBySelector(groupResource schema.GroupResource, namespace string, selector labels.Selector, escapedMetricName string) (*custom_metrics.MetricValueList, error)

GetNamespacedMetricBySelector queries Stackdriver for metrics identified by selector and associated with a namespace.

func (*StackdriverProvider) GetRootScopedMetricByName

func (p *StackdriverProvider) GetRootScopedMetricByName(groupResource schema.GroupResource, name string, escapedMetricName string) (*custom_metrics.MetricValue, error)

GetRootScopedMetricByName queries Stackdriver for metrics identified by name and not associated with any namespace. Current implementation doesn't support root scoped metrics.

func (*StackdriverProvider) GetRootScopedMetricBySelector

func (p *StackdriverProvider) GetRootScopedMetricBySelector(groupResource schema.GroupResource, selector labels.Selector, escapedMetricName string) (*custom_metrics.MetricValueList, error)

GetRootScopedMetricBySelector queries Stackdriver for metrics identified by selector and not associated with any namespace. Current implementation doesn't support root scoped metrics.

func (*StackdriverProvider) ListAllExternalMetrics

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

ListAllExternalMetrics returns a list of available external metrics. Not implemented (currently returns empty list).

func (*StackdriverProvider) ListAllMetrics

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

ListAllMetrics returns all custom metrics available from Stackdriver. List only pod metrics

type Translator

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

Translator is a structure used to translate between Custom Metrics API and Stackdriver API

func (*Translator) GetExternalMetricProject

func (t *Translator) GetExternalMetricProject(metricSelector labels.Selector) (string, error)

GetExternalMetricProject If the metric has "resource.labels.project_id" as a selector, then use a different project

func (*Translator) GetExternalMetricRequest

func (t *Translator) GetExternalMetricRequest(metricName string, metricKind string, metricSelector labels.Selector) (*stackdriver.ProjectsTimeSeriesListCall, error)

GetExternalMetricRequest returns Stackdriver request for query for external metric.

func (*Translator) GetMetricKind

func (t *Translator) GetMetricKind(metricName string) (string, error)

GetMetricKind returns metricKind for metric metricName, obtained from Stackdriver Monitoring API.

func (*Translator) GetMetricsFromSDDescriptorsResp

func (t *Translator) GetMetricsFromSDDescriptorsResp(response *stackdriver.ListMetricDescriptorsResponse) []provider.CustomMetricInfo

GetMetricsFromSDDescriptorsResp returns an array of MetricInfo for all metric descriptors returned by Stackdriver API that satisfy the requirements: - valueType is "INT64" or "DOUBLE" - metric name doesn't contain "/" character after "custom.googleapis.com/" prefix

func (*Translator) GetRespForExternalMetric

func (t *Translator) GetRespForExternalMetric(response *stackdriver.ListTimeSeriesResponse, metricName string) ([]external_metrics.ExternalMetricValue, error)

GetRespForExternalMetric translates Stackdriver response to list of External Metrics

func (*Translator) GetRespForMultipleObjects

func (t *Translator) GetRespForMultipleObjects(response *stackdriver.ListTimeSeriesResponse, list []metav1.ObjectMeta, groupResource schema.GroupResource, metricName string) ([]custom_metrics.MetricValue, error)

GetRespForMultipleObjects translates Stackdriver response to a Custom Metric associated with multiple pods.

func (*Translator) GetRespForSingleObject

func (t *Translator) GetRespForSingleObject(response *stackdriver.ListTimeSeriesResponse, groupResource schema.GroupResource, metricName string, namespace string, name string) (*custom_metrics.MetricValue, error)

GetRespForSingleObject returns translates Stackdriver response to a Custom Metric associated with a single object.

func (*Translator) GetSDReqForNodes

func (t *Translator) GetSDReqForNodes(nodeList *v1.NodeList, metricName string, metricKind string) (*stackdriver.ProjectsTimeSeriesListCall, error)

GetSDReqForNodes returns Stackdriver request for query for multiple nodes. nodeList is required to be no longer than oneOfMax items. This is enforced by limitation of "one_of()" operator in Stackdriver filters, see documentation: https://cloud.google.com/monitoring/api/v3/filters

func (*Translator) GetSDReqForPods

func (t *Translator) GetSDReqForPods(podList *v1.PodList, metricName string, metricKind, namespace string) (*stackdriver.ProjectsTimeSeriesListCall, error)

GetSDReqForPods returns Stackdriver request for query for multiple pods. podList is required to be no longer than oneOfMax items. This is enforced by limitation of "one_of()" operator in Stackdriver filters, see documentation: https://cloud.google.com/monitoring/api/v3/filters

func (*Translator) ListMetricDescriptors

func (t *Translator) ListMetricDescriptors() *stackdriver.ProjectsMetricDescriptorsListCall

ListMetricDescriptors returns Stackdriver request for all custom metrics descriptors.

Jump to

Keyboard shortcuts

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