collector

package
v1.1.5-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2016 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCollectorConfigs added in v1.0.5

func GetCollectorConfigs(labels map[string]string) map[string]string

Types

type Collector

type Collector interface {
	// Collect metrics from this collector.
	// Returns the next time this collector should be collected from.
	// Next collection time is always returned, even when an error occurs.
	// A collection time of zero means no more collection.
	Collect(map[string][]v1.MetricVal) (time.Time, map[string][]v1.MetricVal, error)

	// Return spec for all metrics associated with this collector
	GetSpec() []v1.MetricSpec

	// Name of this collector.
	Name() string
}

Metric collector.

type CollectorManager

type CollectorManager interface {
	// Register a collector.
	RegisterCollector(collector Collector) error

	// Collect from collectors that are ready and return the next time
	// at which a collector will be ready to collect from.
	// Next collection time is always returned, even when an error occurs.
	// A collection time of zero means no more collection.
	Collect() (time.Time, map[string][]v1.MetricVal, error)

	// Get metric spec from all registered collectors.
	GetSpec() ([]v1.MetricSpec, error)
}

Manages and runs collectors.

func NewCollectorManager

func NewCollectorManager() (CollectorManager, error)

Returns a new CollectorManager that is thread-compatible.

type Config added in v1.0.5

type Config struct {
	//the endpoint to hit to scrape metrics
	Endpoint string `json:"endpoint"`

	//holds information about different metrics that can be collected
	MetricsConfig []MetricConfig `json:"metrics_config"`
}

type FakeCollectorManager

type FakeCollectorManager struct {
}

func (*FakeCollectorManager) Collect

func (fkm *FakeCollectorManager) Collect(metric map[string][]v1.MetricVal) (time.Time, map[string][]v1.MetricVal, error)

func (*FakeCollectorManager) GetSpec added in v1.0.5

func (fkm *FakeCollectorManager) GetSpec() ([]v1.MetricSpec, error)

func (*FakeCollectorManager) RegisterCollector

func (fkm *FakeCollectorManager) RegisterCollector(collector Collector) error

type GenericCollector added in v1.0.5

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

func NewCollector added in v1.0.5

func NewCollector(collectorName string, configFile []byte) (*GenericCollector, error)

Returns a new collector using the information extracted from the configfile

func (*GenericCollector) Collect added in v1.0.5

func (collector *GenericCollector) Collect(metrics map[string][]v1.MetricVal) (time.Time, map[string][]v1.MetricVal, error)

Returns collected metrics and the next collection time of the collector

func (*GenericCollector) GetSpec added in v1.0.5

func (collector *GenericCollector) GetSpec() []v1.MetricSpec

func (*GenericCollector) Name added in v1.0.5

func (collector *GenericCollector) Name() string

Returns name of the collector

type GenericCollectorManager added in v1.0.5

type GenericCollectorManager struct {
	Collectors         []*collectorData
	NextCollectionTime time.Time
}

func (*GenericCollectorManager) Collect added in v1.0.5

func (cm *GenericCollectorManager) Collect() (time.Time, map[string][]v1.MetricVal, error)

func (*GenericCollectorManager) GetSpec added in v1.0.5

func (cm *GenericCollectorManager) GetSpec() ([]v1.MetricSpec, error)

func (*GenericCollectorManager) RegisterCollector added in v1.0.5

func (cm *GenericCollectorManager) RegisterCollector(collector Collector) error

type MetricConfig added in v1.0.5

type MetricConfig struct {
	//the name of the metric
	Name string `json:"name"`

	//enum type for the metric type
	MetricType v1.MetricType `json:"metric_type"`

	// metric units to display on UI and in storage (eg: MB, cores)
	// this is only used for display.
	Units string `json:"units"`

	//data type of the metric (eg: int, float)
	DataType v1.DataType `json:"data_type"`

	//the frequency at which the metric should be collected
	PollingFrequency time.Duration `json:"polling_frequency"`

	//the regular expression that can be used to extract the metric
	Regex string `json:"regex"`
}

metricConfig holds information extracted from the config file about a metric

type Prometheus added in v1.0.5

type Prometheus struct {
	//the endpoint to hit to scrape metrics
	Endpoint string `json:"endpoint"`

	//the frequency at which metrics should be collected
	PollingFrequency time.Duration `json:"polling_frequency"`

	//holds names of different metrics that can be collected
	MetricsConfig []string `json:"metrics_config"`
}

type PrometheusCollector added in v1.0.5

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

func NewPrometheusCollector added in v1.0.5

func NewPrometheusCollector(collectorName string, configFile []byte) (*PrometheusCollector, error)

Returns a new collector using the information extracted from the configfile

func (*PrometheusCollector) Collect added in v1.0.5

func (collector *PrometheusCollector) Collect(metrics map[string][]v1.MetricVal) (time.Time, map[string][]v1.MetricVal, error)

Returns collected metrics and the next collection time of the collector

func (*PrometheusCollector) GetSpec added in v1.0.5

func (collector *PrometheusCollector) GetSpec() []v1.MetricSpec

func (*PrometheusCollector) Name added in v1.0.5

func (collector *PrometheusCollector) Name() string

Returns name of the collector

Jump to

Keyboard shortcuts

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