Documentation ¶
Index ¶
- func NewStackdriverProvider(kubeClient *corev1.CoreV1Client, mapper apimeta.RESTMapper, ...) provider.CustomMetricsProvider
- type StackdriverProvider
- func (p *StackdriverProvider) GetNamespacedMetricByName(groupResource schema.GroupResource, namespace string, name string, ...) (*custom_metrics.MetricValue, error)
- func (p *StackdriverProvider) GetNamespacedMetricBySelector(groupResource schema.GroupResource, namespace string, selector labels.Selector, ...) (*custom_metrics.MetricValueList, error)
- func (p *StackdriverProvider) GetRootScopedMetricByName(groupResource schema.GroupResource, name string, metricName string) (*custom_metrics.MetricValue, error)
- func (p *StackdriverProvider) GetRootScopedMetricBySelector(groupResource schema.GroupResource, selector labels.Selector, ...) (*custom_metrics.MetricValueList, error)
- func (p *StackdriverProvider) ListAllMetrics() []provider.MetricInfo
- type Translator
- func (t *Translator) GetMetricsFromSDDescriptorsResp(response *stackdriver.ListMetricDescriptorsResponse) []provider.MetricInfo
- func (t *Translator) GetRespForPod(response *stackdriver.ListTimeSeriesResponse, ...) (*custom_metrics.MetricValue, error)
- func (t *Translator) GetRespForPods(response *stackdriver.ListTimeSeriesResponse, podList *v1.PodList, ...) ([]custom_metrics.MetricValue, error)
- func (t *Translator) GetSDReqForPods(podList *v1.PodList, metricName string) (*stackdriver.ProjectsTimeSeriesListCall, error)
- func (t *Translator) ListMetricDescriptors() *stackdriver.ProjectsMetricDescriptorsListCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStackdriverProvider ¶
func NewStackdriverProvider(kubeClient *corev1.CoreV1Client, mapper apimeta.RESTMapper, stackdriverService *stackdriver.Service, rateInterval time.Duration) provider.CustomMetricsProvider
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) GetNamespacedMetricByName ¶
func (p *StackdriverProvider) GetNamespacedMetricByName(groupResource schema.GroupResource, namespace string, name string, metricName 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, metricName 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, metricName 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, metricName 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) ListAllMetrics ¶
func (p *StackdriverProvider) ListAllMetrics() []provider.MetricInfo
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) GetMetricsFromSDDescriptorsResp ¶
func (t *Translator) GetMetricsFromSDDescriptorsResp(response *stackdriver.ListMetricDescriptorsResponse) []provider.MetricInfo
GetMetricsFromSDDescriptorsResp returns an array of MetricInfo for all metric descriptors returned by Stackdriver API that satisfy the requirements: - metricKind is "GAUGE" - valueType is "INT64" or "DOUBLE" - metric name doesn't contain "/" character after "custom.googleapis.com/" prefix
func (*Translator) GetRespForPod ¶
func (t *Translator) GetRespForPod(response *stackdriver.ListTimeSeriesResponse, groupResource schema.GroupResource, metricName string, namespace string, name string) (*custom_metrics.MetricValue, error)
GetRespForPod returns translates Stackdriver response to a Custom Metric associated with a single pod.
func (*Translator) GetRespForPods ¶
func (t *Translator) GetRespForPods(response *stackdriver.ListTimeSeriesResponse, podList *v1.PodList, groupResource schema.GroupResource, metricName string, namespace string) ([]custom_metrics.MetricValue, error)
GetRespForPods translates Stackdriver response to a Custom Metric associated with multiple pods.
func (*Translator) GetSDReqForPods ¶
func (t *Translator) GetSDReqForPods(podList *v1.PodList, metricName string) (*stackdriver.ProjectsTimeSeriesListCall, error)
GetSDReqForPods returns Stackdriver request for query for multiple pods. podList is required to be no longer than 100 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.