provider

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfigMaps

func CheckConfigMaps(kubeClient *corev1.CoreV1Client, provider *CirconusProvider) error

func CreateURLWithQuery

func CreateURLWithQuery(uri string, param map[string]interface{}) (string, error)

func NewCirconusProvider

func NewCirconusProvider(kubeClient *corev1.CoreV1Client, circonusAPIURL string, configFile string) provider.MetricsProvider

NewCirconusProvider creates a CirconusProvider

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 ReadConfigMap

func ReadConfigMap(provider *CirconusProvider, cm kcorev1.ConfigMap, field string) error

Types

type AdapterConfig

type AdapterConfig struct {
	// Queries specifies how to name and map CAQL statements to external metrics
	Queries []Query `yaml:"queries"`
}

func FromYAML

func FromYAML(contents []byte) (*AdapterConfig, error)

FromYAML loads the configuration from a blob of YAML.

type CirconusProvider

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

CirconusProvider is a provider of custom metrics from Circonus CAQL.

func (*CirconusProvider) GetExternalMetric

func (p *CirconusProvider) GetExternalMetric(ctx context.Context, namespace string, metricSelector labels.Selector, info provider.ExternalMetricInfo) (*external_metrics.ExternalMetricValueList, error)

GetExternalMetric queries Circonus using CAQL to fetch data namespace is ignored as well as labels.Selector

func (*CirconusProvider) GetMetricByName

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

func (*CirconusProvider) GetMetricBySelector

func (p *CirconusProvider) GetMetricBySelector(ctx context.Context, 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 (*CirconusProvider) ListAllExternalMetrics

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

ListAllExternalMetrics returns a list of available external metrics. Returns the names of everything configured.

func (*CirconusProvider) ListAllMetrics

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

ListAllMetrics returns all custom metrics available. Not implemented (currently returns empty list).

type Query

type Query struct {
	// CAQL specifies the statement to execute
	CAQL string `yaml:"caql"`
	// CirconusAPIKey specifies the key to use when calling the Circonus /caql endpoint
	CirconusAPIKey string `yaml:"circonus_api_key"`
	// ExternalName describes the name to give this query for purposes of referring to it
	// in the HPA config
	ExternalName string `yaml:"external_name"`
	// Window specifies the start/end times of the CAQL query fetch where end == time.Now()
	// and start == time.Now() - Window.  It allows for fetching multiple datapoints.
	// default is "5m"
	Window time.Duration `yaml:"window"`
	// Stride specifies the granularity of the data to return, defaults to "1m".
	Stride time.Duration `yaml:"stride"`
	// The function to use to combine the data in `window`, one of `average`, `min`, `max`, defaults
	// to `average`
	Aggregate string `yaml:"aggregate"`
}

Query describes a query, the api key, the name to give it and query related parameters

Jump to

Keyboard shortcuts

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