collector

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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.

type Master

type Master struct {
	Collectors        map[string]Collector
	RClient           *rclient.RClient
	CollectorInterval int
}

Master implements the prometheus.Collector interface.

func NewCollectorMaster

func NewCollectorMaster(rcli *rclient.RClient, collectInterval int) (*Master, error)

NewCollectorMaster creates a new NodeCollector.

func (*Master) Collect

func (cm *Master) Collect(ch chan<- prometheus.Metric)

Collect implements required collect function for all promehteus collectors

func (*Master) Describe

func (cm *Master) Describe(ch chan<- *prometheus.Desc)

Describe is a Prometheus implementation to be called by collector. It essentially writes all descriptors to the prometheus desc channel.

type Metric

type Metric struct {
	Prom        *prometheus.Desc
	Name        string
	NameRaw     string
	NameDim     string
	Value       float64
	Type        rclient.MetricType
	Labels      []string
	LabelsValue []string
}

Metric describe the metric attributes

type RMetrics

type RMetrics struct {
	Client            *rclient.RClient
	Metrics           []*Metric
	CollectorInterval int
}

RMetrics keeps the collector info

func NewCollectorMetrics

func NewCollectorMetrics(rcli *rclient.RClient, colInterval int, msEnabled ...string) (*RMetrics, error)

NewCollectorMetrics return the CollectorAnalytics object

func (*RMetrics) InitCollectorsUpdater

func (ca *RMetrics) InitCollectorsUpdater()

InitCollectorsUpdater start the paralel auto update for each collector

func (*RMetrics) InitMetrics

func (ca *RMetrics) InitMetrics(msEnabled ...string) error

InitMetrics initialize a list of metrics names and return error if fails.

func (*RMetrics) Update

func (ca *RMetrics) Update(ch chan<- prometheus.Metric) error

Update implements Collector and exposes related metrics

Jump to

Keyboard shortcuts

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