collector

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AWSSQSQueueLengthMetric = "sqs-queue-length"
)
View Source
const (
	PrometheusMetricName = "prometheus-query"
)
View Source
const (
	// ZMONCheckMetric defines the metric name for metrics based on ZMON
	// checks.
	ZMONCheckMetric = "zmon-check"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSCollectorPlugin

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

func NewAWSCollectorPlugin

func NewAWSCollectorPlugin(sessions map[string]*session.Session) *AWSCollectorPlugin

func (*AWSCollectorPlugin) NewCollector

NewCollector initializes a new skipper collector from the specified HPA.

type AWSSQSCollector

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

func NewAWSSQSCollector

func NewAWSSQSCollector(sessions map[string]*session.Session, config *MetricConfig, interval time.Duration) (*AWSSQSCollector, error)

func (*AWSSQSCollector) GetMetrics

func (c *AWSSQSCollector) GetMetrics() ([]CollectedMetric, error)

func (*AWSSQSCollector) Interval

func (c *AWSSQSCollector) Interval() time.Duration

Interval returns the interval at which the collector should run.

type Collector

type Collector interface {
	GetMetrics() ([]CollectedMetric, error)
	Interval() time.Duration
}

type CollectorFactory

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

func NewCollectorFactory

func NewCollectorFactory() *CollectorFactory

func (*CollectorFactory) NewCollector

func (c *CollectorFactory) NewCollector(hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (Collector, error)

func (*CollectorFactory) RegisterExternalCollector

func (c *CollectorFactory) RegisterExternalCollector(metrics []string, plugin CollectorPlugin)

func (*CollectorFactory) RegisterObjectCollector

func (c *CollectorFactory) RegisterObjectCollector(kind, metricCollector string, plugin CollectorPlugin) error

func (*CollectorFactory) RegisterPodsCollector

func (c *CollectorFactory) RegisterPodsCollector(metricCollector string, plugin CollectorPlugin) error

type CollectorPlugin

type CollectorPlugin interface {
	NewCollector(hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (Collector, error)
}

type JSONPathMetricsGetter

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

JSONPathMetricsGetter is a metrics getter which looks up pod metrics by querying the pods metrics endpoint and lookup the metric value as defined by the json path query.

func NewJSONPathMetricsGetter

func NewJSONPathMetricsGetter(config map[string]string) (*JSONPathMetricsGetter, error)

NewJSONPathMetricsGetter initializes a new JSONPathMetricsGetter.

func (*JSONPathMetricsGetter) GetMetric

func (g *JSONPathMetricsGetter) GetMetric(pod *corev1.Pod) (float64, error)

GetMetric gets metric from pod by fetching json metrics from the pods metric endpoint and extracting the desired value using the specified json path query.

type MaxWeightedCollector

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

MaxWeightedCollector is a simple aggregator collector that returns the maximum value of metrics from all collectors.

func NewMaxWeightedCollector

func NewMaxWeightedCollector(interval time.Duration, weight float64, collectors ...Collector) *MaxWeightedCollector

NewMaxWeightedCollector initializes a new MaxWeightedCollector.

func (*MaxWeightedCollector) GetMetrics

func (c *MaxWeightedCollector) GetMetrics() ([]CollectedMetric, error)

GetMetrics gets metrics from all collectors and return the higest value.

func (*MaxWeightedCollector) Interval

func (c *MaxWeightedCollector) Interval() time.Duration

Interval returns the interval at which the collector should run.

type MetricConfig

type MetricConfig struct {
	MetricTypeName
	CollectorName   string
	Config          map[string]string
	ObjectReference custom_metrics.ObjectReference
	PerReplica      bool
	Interval        time.Duration
}

func ParseHPAMetrics

func ParseHPAMetrics(hpa *autoscalingv2.HorizontalPodAutoscaler) ([]*MetricConfig, error)

ParseHPAMetrics parses the HPA object into a list of metric configurations.

type MetricTypeName

type MetricTypeName struct {
	Type   autoscalingv2.MetricSourceType
	Metric autoscalingv2.MetricIdentifier
}

type NoResultError

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

func (NoResultError) Error

func (r NoResultError) Error() string

type ObjectReference

type ObjectReference struct {
	autoscalingv2.CrossVersionObjectReference
	Namespace string
}

type PodCollector

type PodCollector struct {
	Getter PodMetricsGetter
	// contains filtered or unexported fields
}

func (*PodCollector) GetMetrics

func (c *PodCollector) GetMetrics() ([]CollectedMetric, error)

func (*PodCollector) Interval

func (c *PodCollector) Interval() time.Duration

type PodCollectorPlugin

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

func NewPodCollectorPlugin

func NewPodCollectorPlugin(client kubernetes.Interface) *PodCollectorPlugin

func (*PodCollectorPlugin) NewCollector

type PodMetricsGetter

type PodMetricsGetter interface {
	GetMetric(pod *corev1.Pod) (float64, error)
}

type PrometheusCollector

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

func NewPrometheusCollector

func NewPrometheusCollector(client kubernetes.Interface, promAPI promv1.API, hpa *autoscalingv2.HorizontalPodAutoscaler, config *MetricConfig, interval time.Duration) (*PrometheusCollector, error)

func (*PrometheusCollector) GetMetrics

func (c *PrometheusCollector) GetMetrics() ([]CollectedMetric, error)

func (*PrometheusCollector) Interval

func (c *PrometheusCollector) Interval() time.Duration

type PrometheusCollectorPlugin

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

func NewPrometheusCollectorPlugin

func NewPrometheusCollectorPlugin(client kubernetes.Interface, prometheusServer string) (*PrometheusCollectorPlugin, error)

func (*PrometheusCollectorPlugin) NewCollector

type SkipperCollector

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

SkipperCollector is a metrics collector for getting skipper ingress metrics. It depends on the prometheus collector for getting the metrics.

func NewSkipperCollector

func NewSkipperCollector(client kubernetes.Interface, plugin CollectorPlugin, hpa *autoscalingv2.HorizontalPodAutoscaler,
	config *MetricConfig, interval time.Duration, backendAnnotations []string, backend string) (*SkipperCollector, error)

NewSkipperCollector initializes a new SkipperCollector.

func (*SkipperCollector) GetMetrics

func (c *SkipperCollector) GetMetrics() ([]CollectedMetric, error)

GetMetrics gets skipper metrics from prometheus.

func (*SkipperCollector) Interval

func (c *SkipperCollector) Interval() time.Duration

Interval returns the interval at which the collector should run.

type SkipperCollectorPlugin

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

SkipperCollectorPlugin is a collector plugin for initializing metrics collectors for getting skipper ingress metrics.

func NewSkipperCollectorPlugin

func NewSkipperCollectorPlugin(client kubernetes.Interface, prometheusPlugin *PrometheusCollectorPlugin, backendAnnotations []string) (*SkipperCollectorPlugin, error)

NewSkipperCollectorPlugin initializes a new SkipperCollectorPlugin.

func (*SkipperCollectorPlugin) NewCollector

NewCollector initializes a new skipper collector from the specified HPA.

type ZMONCollector

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

ZMONCollector defines a collector that is able to collect metrics from ZMON.

func NewZMONCollector

func NewZMONCollector(zmon zmon.ZMON, config *MetricConfig, annotations map[string]string, interval time.Duration) (*ZMONCollector, error)

NewZMONCollector initializes a new ZMONCollector.

func (*ZMONCollector) GetMetrics

func (c *ZMONCollector) GetMetrics() ([]CollectedMetric, error)

GetMetrics returns a list of collected metrics for the ZMON check.

func (*ZMONCollector) Interval

func (c *ZMONCollector) Interval() time.Duration

Interval returns the interval at which the collector should run.

type ZMONCollectorPlugin

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

ZMONCollectorPlugin defines a plugin for creating collectors that can get metrics from ZMON.

func NewZMONCollectorPlugin

func NewZMONCollectorPlugin(zmon zmon.ZMON) (*ZMONCollectorPlugin, error)

NewZMONCollectorPlugin initializes a new ZMONCollectorPlugin.

func (*ZMONCollectorPlugin) NewCollector

NewCollector initializes a new ZMON collector from the specified HPA.

Jump to

Keyboard shortcuts

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