collector

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package collector includes all individual collectors to gather and export system metrics.

Index

Constants

This section is empty.

Variables

View Source
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 GetData

func GetData() (map[string]float64, error)

func IsNoDataError

func IsNoDataError(err error) bool

func SanitizeMetricName

func SanitizeMetricName(metricName string) string

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.

func Values

func Values(data []*storage.DataPoint) []float64

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

func NewBaseCollector(logger log.Logger) (Collector, error)

NewBaseCollector returns a new Collector exposing base average stats.

func NewCPUCollector

func NewCPUCollector(logger log.Logger) (Collector, error)

NewCPUCollector returns a new Collector exposing kernel/system statistics.

func NewMeminfoCollector

func NewMeminfoCollector(logger log.Logger) (Collector, error)

NewMeminfoCollector returns a new Collector exposing memory stats.

func NewMeminfoNumaCollector

func NewMeminfoNumaCollector(logger log.Logger) (Collector, error)

NewMeminfoNumaCollector 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.

Jump to

Keyboard shortcuts

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