Documentation ¶
Overview ¶
Package autoscrape implements a scraper for integrations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultGlobal = Global{ Enable: true, MetricsInstance: "default", }
DefaultGlobal holds default values for Global.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Enable *bool `yaml:"enable,omitempty"` // Whether self-scraping should be enabled. MetricsInstance string `yaml:"metrics_instance,omitempty"` // Metrics instance name to send metrics to. ScrapeInterval model.Duration `yaml:"scrape_interval,omitempty"` // Self-scraping frequency. ScrapeTimeout model.Duration `yaml:"scrape_timeout,omitempty"` // Self-scraping timeout. RelabelConfigs []*relabel.Config `yaml:"relabel_configs,omitempty"` // Relabel the autoscrape job MetricRelabelConfigs []*relabel.Config `yaml:"metric_relabel_configs,omitempty"` // Relabel individual autoscrape metrics }
Config configure autoscrape for an individual integration. Override defaults.
type Global ¶
type Global struct { Enable bool `yaml:"enable,omitempty"` // Whether self-scraping should be enabled. MetricsInstance string `yaml:"metrics_instance,omitempty"` // Metrics instance name to send metrics to. ScrapeInterval model.Duration `yaml:"scrape_interval,omitempty"` // Self-scraping frequency. ScrapeTimeout model.Duration `yaml:"scrape_timeout,omitempty"` // Self-scraping timeout. }
Global holds default settings for metrics integrations that support autoscraping. Integrations may override their settings.
func (*Global) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.
type InstanceStore ¶
type InstanceStore interface { // GetInstance retrieves a ManagedInstance by name. GetInstance(name string) (instance.ManagedInstance, error) }
InstanceStore is used to find instances to send metrics to. It is a subset of the pkg/metrics/instance.Manager interface.
type ScrapeConfig ¶
type ScrapeConfig struct { Instance string Config prom_config.ScrapeConfig }
ScrapeConfig bind a Prometheus scrape config with an instance to send scraped metrics to.
type Scraper ¶
type Scraper struct {
// contains filtered or unexported fields
}
Scraper is a metrics autoscraper.
func NewScraper ¶
func NewScraper(l log.Logger, is InstanceStore, dialerFunc server.DialContextFunc) *Scraper
NewScraper creates a new autoscraper. Scraper will run until Stop is called. Instances to send scraped metrics to will be looked up via im. Scraping will use the provided dialerFunc to make connections if non-nil.
func (*Scraper) ApplyConfig ¶
func (s *Scraper) ApplyConfig(jobs []*ScrapeConfig) error
ApplyConfig will apply the given jobs. An error will be returned for any jobs that failed to be applied.