Documentation ¶
Index ¶
- Constants
- func GenericCollect(be *BaseExporter, ch chan<- prometheus.Metric)
- func GenericDescribe(be *BaseExporter, ch chan<- *prometheus.Desc)
- func Register(exporter Exporter) (err error)
- func Unregister(exporter Exporter) error
- type BaseExporter
- type Cache
- type Exporter
- type Metric
- type MetricCollector
- type MetricType
Constants ¶
View Source
const VERSION string = "0.2"
Version
Variables ¶
This section is empty.
Functions ¶
func GenericCollect ¶
func GenericCollect(be *BaseExporter, ch chan<- prometheus.Metric)
GenericCollect generates prom metric from cached metric values
func GenericDescribe ¶
func GenericDescribe(be *BaseExporter, ch chan<- *prometheus.Desc)
GenericDescribe generates prom descriptor from cached metric names
func Unregister ¶
Types ¶
type BaseExporter ¶
type BaseExporter struct { Control chan bool Name string Cache *Cache MetricCollectors []MetricCollector Labels map[string]string }
BaseExporter provides convinient caching and metrics processing. BaseExporter should be embedded into custom exporter struct
func NewBaseExporter ¶
func NewBaseExporter(name string, ttl int, labels map[string]string) *BaseExporter
func (*BaseExporter) AddCollector ¶
func (e *BaseExporter) AddCollector(m MetricCollector)
func (*BaseExporter) Close ¶
func (e *BaseExporter) Close() error
func (*BaseExporter) Collect ¶
func (e *BaseExporter) Collect(ch chan<- prometheus.Metric)
Satisfies Exporter interface and calls GenericCollect which works with cache
func (*BaseExporter) Describe ¶
func (e *BaseExporter) Describe(ch chan<- *prometheus.Desc)
Satisfies Exporter interface and calls GenericDescribe which works with cache
func (*BaseExporter) Process ¶
func (e *BaseExporter) Process()
Process runs metric collection in async mode
func (*BaseExporter) Setup ¶
func (e *BaseExporter) Setup() error
type Cache ¶
Cache for metrics values. Scraping metrics is async.
func (*Cache) MetricNames ¶
type Exporter ¶
type Exporter interface { Setup() error Close() error Process() prometheus.Collector }
type Metric ¶
type Metric struct { Name string Description string Type MetricType Value interface{} Labels map[string]string }
func (*Metric) PromDescription ¶
func (m *Metric) PromDescription(exporterName string) *prometheus.Desc
func (*Metric) PromType ¶
func (m *Metric) PromType() prometheus.ValueType
type MetricCollector ¶
type MetricType ¶
type MetricType int
const ( Counter MetricType = iota Gauge MetricType = iota Untyped MetricType = iota )
func StringToType ¶
func StringToType(s string) MetricType
Click to show internal directories.
Click to hide internal directories.