providers

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoValuesFound = errors.New("no values found")
)

Functions

This section is empty.

Types

type CloudWatchProvider

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

func NewCloudWatchProvider

func NewCloudWatchProvider(metricInterval string, provider flaggerv1.MetricTemplateProvider) (*CloudWatchProvider, error)

NewCloudWatchProvider takes a metricInterval, a provider spec and the credentials map, and returns a cloudWatchProvider ready to execute queries against the AWS CloudWatch metrics

func (*CloudWatchProvider) IsOnline

func (p *CloudWatchProvider) IsOnline() (bool, error)

IsOnline calls GetMetricData endpoint with the empty query and returns an error if the returned status code is NOT http.StatusBadRequests. For example, if the flagger does not have permission to perform `cloudwatch:GetMetricData`, the returned status code would be http.StatusForbidden

func (*CloudWatchProvider) RunQuery

func (p *CloudWatchProvider) RunQuery(query string) (float64, error)

RunQuery executes the aws cloud watch metrics query against GetMetricData endpoint and returns the the first result as float64

type DatadogProvider

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

DatadogProvider executes datadog queries

func NewDatadogProvider

func NewDatadogProvider(metricInterval string,
	provider flaggerv1.MetricTemplateProvider,
	credentials map[string][]byte) (*DatadogProvider, error)

NewDatadogProvider takes a canary spec, a provider spec and the credentials map, and returns a Datadog client ready to execute queries against the API

func (*DatadogProvider) IsOnline

func (p *DatadogProvider) IsOnline() (bool, error)

IsOnline calls the Datadog's validation endpoint with api keys and returns an error if the validation fails

func (*DatadogProvider) RunQuery

func (p *DatadogProvider) RunQuery(query string) (float64, error)

RunQuery executes the datadog query against DatadogProvider.metricsQueryEndpoint and returns the the first result as float64

type Factory

type Factory struct{}

func (Factory) Provider

func (factory Factory) Provider(
	metricInterval string,
	provider flaggerv1.MetricTemplateProvider,
	credentials map[string][]byte,
) (Interface, error)

type GraphiteProvider added in v1.10.0

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

GraphiteProvider executes Graphite render URL API queries.

func NewGraphiteProvider added in v1.10.0

func NewGraphiteProvider(provider flaggerv1.MetricTemplateProvider, credentials map[string][]byte) (*GraphiteProvider, error)

NewGraphiteProvider takes a provider spec and credentials map, validates the address, extracts the credentials map's username and password values if provided, and returns a Graphite client ready to execute queries against the Graphite render URL API.

func (*GraphiteProvider) IsOnline added in v1.10.0

func (g *GraphiteProvider) IsOnline() (bool, error)

IsOnline runs a simple Graphite render URL API query and returns an error if the API is unreachable.

func (*GraphiteProvider) RunQuery added in v1.10.0

func (g *GraphiteProvider) RunQuery(query string) (float64, error)

RunQuery executes the Graphite render URL API query and returns the the first result as float64.

type Interface

type Interface interface {
	// RunQuery executes the query and converts the first result to float64
	RunQuery(query string) (float64, error)

	// IsOnline calls the provider endpoint and returns an error if the API is unreachable
	IsOnline() (bool, error)
}

type NewRelicProvider

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

NewRelicProvider executes newrelic queries

func NewNewRelicProvider

func NewNewRelicProvider(
	metricInterval string,
	provider flaggerv1.MetricTemplateProvider,
	credentials map[string][]byte,
) (*NewRelicProvider, error)

NewNewRelicProvider takes a canary spec, a provider spec and the credentials map, and returns a NewRelic client ready to execute queries against the Insights API

func (*NewRelicProvider) IsOnline

func (p *NewRelicProvider) IsOnline() (bool, error)

IsOnline calls the NewRelic's insights API with and returns an error if the request is rejected

func (*NewRelicProvider) RunQuery

func (p *NewRelicProvider) RunQuery(query string) (float64, error)

RunQuery executes the new relic query against the New Relic Insights API and returns the the first result

type PrometheusProvider

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

PrometheusProvider executes promQL queries

func NewPrometheusProvider

func NewPrometheusProvider(provider flaggerv1.MetricTemplateProvider, credentials map[string][]byte) (*PrometheusProvider, error)

NewPrometheusProvider takes a provider spec and the credentials map, validates the address, extracts the username and password values if provided and returns a Prometheus client ready to execute queries against the API

func (*PrometheusProvider) IsOnline

func (p *PrometheusProvider) IsOnline() (bool, error)

IsOnline run simple Prometheus query and returns an error if the API is unreachable

func (*PrometheusProvider) RunQuery

func (p *PrometheusProvider) RunQuery(query string) (float64, error)

RunQuery executes the promQL query and returns the the first result as float64

Jump to

Keyboard shortcuts

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