Documentation
¶
Index ¶
Constants ¶
View Source
const Version = "0.0.2"
Variables ¶
View Source
var DefaultScrapeType = "value"
View Source
var ScrapeTypes = map[string]*ScrapeType{ "object": { Configure: func(config *Config, reg *harness.MetricRegistry) { for subName := range config.Values { name := harness.MakeMetricName(config.Name, subName) reg.Register( name, prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: name, Help: config.Help + " - " + subName, }, config.labelNames()), ) } }, NewScraper: NewObjectScraper, }, "value": { Configure: func(config *Config, reg *harness.MetricRegistry) { reg.Register( config.Name, prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: config.Name, Help: config.Help, }, config.labelNames()), ) }, NewScraper: NewValueScraper, }, }
Functions ¶
Types ¶
type Collector ¶
type Collector struct { Endpoint string // contains filtered or unexported fields }
func NewCollector ¶
func NewCollector(endpoint string, scrapers []JsonScraper) *Collector
func (*Collector) Collect ¶
func (col *Collector) Collect(reg *harness.MetricRegistry)
type JsonScraper ¶
type JsonScraper interface {
Scrape(data []byte, reg *harness.MetricRegistry) error
}
func NewObjectScraper ¶
func NewObjectScraper(config *Config) (JsonScraper, error)
func NewValueScraper ¶
func NewValueScraper(config *Config) (JsonScraper, error)
type ObjectScraper ¶
type ObjectScraper struct { *ValueScraper // contains filtered or unexported fields }
func (*ObjectScraper) Scrape ¶
func (obsc *ObjectScraper) Scrape(data []byte, reg *harness.MetricRegistry) error
type ScrapeType ¶
type ScrapeType struct { Configure func(*Config, *harness.MetricRegistry) NewScraper func(*Config) (JsonScraper, error) }
type ValueScraper ¶
type ValueScraper struct { *Config // contains filtered or unexported fields }
func (*ValueScraper) Scrape ¶
func (vs *ValueScraper) Scrape(data []byte, reg *harness.MetricRegistry) error
Click to show internal directories.
Click to hide internal directories.