provider

package
v0.0.0-...-b984a18 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExternalMetricNotFoundError

func NewExternalMetricNotFoundError(metricName string) *apierr.StatusError

NewExternalMetricNotFoundError returns a status error indicating that the given metric could not be found. It is similar to NewNotFound, but more specialized.

func NewLabelNotAllowedError

func NewLabelNotAllowedError(label string) *apierr.StatusError

NewLabelNotAllowedError returns a status error indicating that the given label is forbidden.

func NewMetricNotFoundError

func NewMetricNotFoundError(resource schema.GroupResource, metricName string) *apierr.StatusError

NewMetricNotFoundError returns a StatusError indicating that the given metric could not be found. It is similar to NewNotFound, but more specialized.

func NewMetricNotFoundForError

func NewMetricNotFoundForError(resource schema.GroupResource, metricName string, resourceName string) *apierr.StatusError

NewMetricNotFoundForError returns a StatusError indicating that the given metric could not be found for the given named object. It is similar to NewNotFound, but more specialized.

func NewNoSuchMetricError

func NewNoSuchMetricError(metricName string, err error) *apierr.StatusError

NewNoSuchMetricError returns a StatusError indicating that the given metric could not be found. It is similar to NewNotFound, but more specialized.

func NewOperationNotSupportedError

func NewOperationNotSupportedError(operation string) *apierr.StatusError

NewOperationNotSupportedError returns a StatusError indicating that the invoked API call is not supported.

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, metricSelector labels.Selector, info provider.ExternalMetricInfo) (*external_metrics.ExternalMetricValueList, error)

GetExternalMetric queries Stackdriver for external metrics.

func (*StackdriverProvider) GetMetricByName

GetMetricByName fetches a particular metric for a particular object. The namespace will be empty if the metric is root-scoped.

func (*StackdriverProvider) GetMetricBySelector

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

GetMetricBySelector fetches a particular metric for a set of objects matching the given label selector. The namespace will be empty if the metric is root-scoped.

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, metricSelector labels.Selector) ([]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, metricSelector labels.Selector, 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, metricSelector labels.Selector) (*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 string, metricSelector labels.Selector, 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