Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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() (time.Time, []v1.Metric, error) // 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, []v1.Metric, error) }
Manages and runs collectors.
func NewCollectorManager ¶
func NewCollectorManager() (CollectorManager, error)
Returns a new CollectorManager that is thread-compatible.
type Config ¶
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) RegisterCollector ¶
func (fkm *FakeCollectorManager) RegisterCollector(collector Collector) error
type GenericCollector ¶
type GenericCollector struct {
// contains filtered or unexported fields
}
func NewCollector ¶
func NewCollector(collectorName string, configfile string) (*GenericCollector, error)
Returns a new collector using the information extracted from the configfile
func (*GenericCollector) Collect ¶
Returns collected metrics and the next collection time of the collector
func (*GenericCollector) Name ¶
func (collector *GenericCollector) Name() string
Returns name of the collector
type GenericCollectorManager ¶
func (*GenericCollectorManager) RegisterCollector ¶
func (cm *GenericCollectorManager) RegisterCollector(collector Collector) error
type MetricConfig ¶
type MetricConfig struct { //the name of the metric Name string `json:"name"` //enum type for the metric type MetricType MetricType `json:"metric_type"` //data type of the metric (eg: integer, string) Units string `json:"units"` //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 MetricType ¶
type MetricType string
MetricType is an enum type that lists the possible type of the metric
const ( Counter MetricType = "counter" Gauge MetricType = "gauge" )
Click to show internal directories.
Click to hide internal directories.