autoscrape

package
v1.3.191 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package autoscrape implements a scraper for integrations.

Index

Constants

This section is empty.

Variables

View Source
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

func (g *Global) UnmarshalYAML(f func(interface{}) error) error

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) *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.

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.

func (*Scraper) Stop

func (s *Scraper) Stop()

Stop stops the Scraper.

func (*Scraper) TargetsActive

func (s *Scraper) TargetsActive() map[string]metrics.TargetSet

TargetsActive returns the set of active scrape targets for all target instances.

Jump to

Keyboard shortcuts

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