Documentation ¶
Overview ¶
Package collector includes all individual collectors to gather and export system metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoData = errors.New("collector returned no data")
ErrNoData indicates the collector found no data to collect, but had no other error.
Functions ¶
func DisableDefaultCollectors ¶
func DisableDefaultCollectors()
DisableDefaultCollectors sets the collector state to false for all collectors which have not been explicitly enabled on the command line.
func IsNoDataError ¶
func SanitizeMetricName ¶
SanitizeMetricName sanitize the given metric name by replacing invalid characters by underscores.
OpenMetrics and the Prometheus exposition format require the metric name to consist only of alphanumericals and "_", ":" and they must not start with digits. Since colons in MetricFamily are reserved to signal that the MetricFamily is the result of a calculation or aggregation of a general purpose monitoring system, colons will be replaced as well.
Note: If not subsequently prepending a namespace and/or subsystem (e.g., with prometheus.BuildFQName), the caller must ensure that the supplied metricName does not begin with a digit.
Types ¶
type BaseCollector ¶
type BaseCollector struct {
// contains filtered or unexported fields
}
func (*BaseCollector) Update ¶
func (c *BaseCollector) Update(ch chan<- prometheus.Metric) error
type Collector ¶
type Collector interface { // Get new metrics and expose them via prometheus registry. Update(ch chan<- prometheus.Metric) error }
Collector is the interface a collector has to implement.
func NewBaseCollector ¶
NewBaseCollector returns a new Collector exposing base average stats.
func NewCPUCollector ¶
NewCPUCollector returns a new Collector exposing kernel/system statistics.
func NewMeminfoCollector ¶
NewMeminfoCollector returns a new Collector exposing memory stats.
type NodeCollector ¶
type NodeCollector struct { Collectors map[string]Collector // contains filtered or unexported fields }
NodeCollector implements the prometheus.Collector interface.
func NewNodeCollector ¶
func NewNodeCollector(logger log.Logger, filters ...string) (*NodeCollector, error)
NewNodeCollector creates a new NodeCollector.
func (NodeCollector) Collect ¶
func (n NodeCollector) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (NodeCollector) Describe ¶
func (n NodeCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.