Documentation ¶
Overview ¶
Package collection contains implementations of metric collectors and gatherers to perform local metric collection/aggregation.
Collectors generate implementation-specific metrics, which the gatherer periodically collects.
Index ¶
- func MakeMultiGaugeFamily(name string, help string, gaugesByLabel map[MetricLabel]float64) *io_prometheus_client.MetricFamily
- func MakeSingleGaugeFamily(name string, help string, label *MetricLabel, value float64) *io_prometheus_client.MetricFamily
- func MakeSingleGaugeMetric(label *MetricLabel, value float64) *io_prometheus_client.Metric
- type CloudServiceMetricCollector
- type DiskUsageMetricCollector
- type MetricCollector
- type MetricLabel
- type MetricsGatherer
- type ProcMetricsCollector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeMultiGaugeFamily ¶
func MakeMultiGaugeFamily( name string, help string, gaugesByLabel map[MetricLabel]float64, ) *io_prometheus_client.MetricFamily
MakeMultiGaugeFamily returns a single MetricsFamily with multiple labeled gauge metrics.
func MakeSingleGaugeFamily ¶
func MakeSingleGaugeFamily( name string, help string, label *MetricLabel, value float64, ) *io_prometheus_client.MetricFamily
MakeSingleGaugeFamily returns a MetricFamily with a single gauge value as specified by the function arguments. label is nil-able - a nil input will return a gauge metric without a label.
func MakeSingleGaugeMetric ¶
func MakeSingleGaugeMetric( label *MetricLabel, value float64, ) *io_prometheus_client.Metric
MakeSingleGaugeMetric returns a Metric with a single gauge value as specified by the function argument. label is nil-able - a nil input will return a gauge metric without a label.
Types ¶
type CloudServiceMetricCollector ¶
type CloudServiceMetricCollector struct {
// contains filtered or unexported fields
}
CloudServiceMetricCollector is a MetricCollector which uses service303 to collect metrics from a specific cloud service.
func (*CloudServiceMetricCollector) GetMetrics ¶
func (c *CloudServiceMetricCollector) GetMetrics() ([]*io_prometheus_client.MetricFamily, error)
type DiskUsageMetricCollector ¶
type DiskUsageMetricCollector struct{}
DiskUsageMetricCollector is a MetricCollector which return a pair of metric families representing the total available disk space on the system and the total disk space used, respectively
func (*DiskUsageMetricCollector) GetMetrics ¶
func (*DiskUsageMetricCollector) GetMetrics() ([]*io_prometheus_client.MetricFamily, error)
type MetricCollector ¶
type MetricCollector interface { // GetMetrics returns a collection of prometheus MetricFamily structures // which contain collected metrics. GetMetrics() ([]*io_prometheus_client.MetricFamily, error) }
MetricCollector provides an API to query for metrics.
func NewCloudServiceMetricCollector ¶
func NewCloudServiceMetricCollector(service string) MetricCollector
type MetricLabel ¶
type MetricLabel struct {
Name, Value string
}
type MetricsGatherer ¶
type MetricsGatherer struct { Collectors []MetricCollector CollectInterval time.Duration OutputChan chan *prometheus_proto.MetricFamily }
MetricsGatherer wraps a set of MetricCollectors, polling each collector at the configured interval and putting the results onto an output channel.
func NewMetricsGatherer ¶
func NewMetricsGatherer( collectors []MetricCollector, collectInterval time.Duration, outputChan chan *prometheus_proto.MetricFamily, ) (*MetricsGatherer, error)
NewMetricsGatherer validates params and returns a new metrics gatherer.
func (*MetricsGatherer) Run ¶
func (gatherer *MetricsGatherer) Run()
type ProcMetricsCollector ¶
type ProcMetricsCollector struct{}
ProcMetricsCollector is a MetricCollector which queries /proc for the number of open file descriptors across all processes running on the machine, returning a single metric family for the count.
func (*ProcMetricsCollector) GetMetrics ¶
func (s *ProcMetricsCollector) GetMetrics() ([]*io_prometheus_client.MetricFamily, error)