sensor

package
v0.0.0-...-7a46cad Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2016 License: GPL-3.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableCollectors = make(map[string]CollectorEntry)

The list of available collectors

Functions

func GetIncident

func GetIncident() uint64

GetIncident gets atomically the number of incidents for the program. Although exposed, its primary target is the log sensor.

func Incident

func Incident()

Incident increases atomically the number of incidents for the program. This can be used by the sensors and the main package to export statistics about serious but not fatal errors (e.g a scrape taking too long or failing). If the user loads the sensor "log", then these statistics will be exported as a counter value.

func RegisterCollector

func RegisterCollector(name string, f func(string) (Collector, error),
	suggestedInterval time.Duration, sensorsType, sensorsHelp []string, description string)

RegisterCollector shoukd be called at the init function of each sensor package to register itself to sensor_exporter. It is like golang's image and image/jpg, image/gif relation.

Types

type Collector

type Collector interface {
	Scrape() (string, error)
}

A Collector Every sensor must implement this interface. When called the sensor must read data from its source and return a prometheus compatible values string.

type CollectorEntry

type CollectorEntry struct {
	New             func(string) (Collector, error)
	DefaultInterval time.Duration
	Type            []string
	Help            []string
	Description     string
}

A CollectorEntry contains information about a Collector:

  • the function that creates a new Collector
  • the suggested scrape interval for this Collector
  • a list of Prometheus TYPE and HELP strings for the Collector see <https://prometheus.io/docs/instrumenting/exposition_formats/>
  • a description of the Collector. It is a good idea to document its opts here too.

Jump to

Keyboard shortcuts

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