Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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.