Documentation
¶
Overview ¶
Package scraperhelper provides utilities for scrapers.
Index ¶
- func NewLogsController(cfg *ControllerConfig, rSet receiver.Settings, nextConsumer consumer.Logs, ...) (receiver.Logs, error)
- func NewMetricsController(cfg *ControllerConfig, rSet receiver.Settings, nextConsumer consumer.Metrics, ...) (receiver.Metrics, error)
- type ControllerConfig
- type ControllerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogsController ¶ added in v0.119.0
func NewLogsController(cfg *ControllerConfig, rSet receiver.Settings, nextConsumer consumer.Logs, options ...ControllerOption, ) (receiver.Logs, error)
NewLogsController creates a receiver.Logs with the configured options, that can control multiple scraper.Logs.
func NewMetricsController ¶ added in v0.118.0
func NewMetricsController(cfg *ControllerConfig, rSet receiver.Settings, nextConsumer consumer.Metrics, options ...ControllerOption, ) (receiver.Metrics, error)
NewMetricsController creates a receiver.Metrics with the configured options, that can control multiple scraper.Metrics.
Types ¶
type ControllerConfig ¶
type ControllerConfig struct { // CollectionInterval sets how frequently the scraper // should be called and used as the context timeout // to ensure that scrapers don't exceed the interval. CollectionInterval time.Duration `mapstructure:"collection_interval"` // InitialDelay sets the initial start delay for the scraper, // any non positive value is assumed to be immediately. InitialDelay time.Duration `mapstructure:"initial_delay"` // Timeout is an optional value used to set scraper's context deadline. Timeout time.Duration `mapstructure:"timeout"` }
ControllerConfig defines common settings for a scraper controller configuration. Scraper controller receivers can embed this struct, instead of receiver.Settings, and extend it with more fields if needed.
func NewDefaultControllerConfig ¶
func NewDefaultControllerConfig() ControllerConfig
NewDefaultControllerConfig returns default scraper controller settings with a collection interval of one minute.
func (*ControllerConfig) Validate ¶
func (set *ControllerConfig) Validate() (errs error)
type ControllerOption ¶ added in v0.118.0
type ControllerOption interface {
// contains filtered or unexported methods
}
ControllerOption apply changes to internal options.
func AddFactoryWithConfig ¶ added in v0.118.0
func AddFactoryWithConfig(f scraper.Factory, cfg component.Config) ControllerOption
AddFactoryWithConfig configures the scraper.Factory and associated config that will be used to create a new scraper. The created scraper will be called with the specified options, and at the specified collection interval.
Observability information will be reported, and the scraped metrics will be passed to the next consumer.
func AddScraper ¶
func AddScraper(t component.Type, sc scraper.Metrics) ControllerOption
AddScraper configures the scraper.Metrics to be called with the specified options, and at the specified collection interval.
Observability information will be reported, and the scraped metrics will be passed to the next consumer.
func WithTickerChannel ¶
func WithTickerChannel(tickerCh <-chan time.Time) ControllerOption
WithTickerChannel allows you to override the scraper controller's ticker channel to specify when scrape is called. This is only expected to be used by tests.