Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineScrapeErrors

func CombineScrapeErrors(errs []error) error

    CombineScrapeErrors converts a list of errors into one error.

    func NewScraperControllerReceiver

    func NewScraperControllerReceiver(
    	cfg *ScraperControllerSettings,
    	logger *zap.Logger,
    	nextConsumer consumer.MetricsConsumer,
    	options ...ScraperControllerOption,
    ) (component.Receiver, error)

      NewScraperControllerReceiver creates a Receiver with the configured options, that can control multiple scrapers.

      Types

      type BaseScraper

      type BaseScraper interface {
      	component.Component
      
      	// Name returns the scraper name
      	Name() string
      }

      type MetricsScraper

      type MetricsScraper interface {
      	BaseScraper
      	Scrape(context.Context, string) (pdata.MetricSlice, error)
      }

        MetricsScraper is an interface for scrapers that scrape metrics.

        func NewMetricsScraper

        func NewMetricsScraper(
        	name string,
        	scrape ScrapeMetrics,
        	options ...ScraperOption,
        ) MetricsScraper

          NewMetricsScraper creates a Scraper that calls Scrape at the specified collection interval, reports observability information, and passes the scraped metrics to the next consumer.

          type ResourceMetricsScraper

          type ResourceMetricsScraper interface {
          	BaseScraper
          	Scrape(context.Context, string) (pdata.ResourceMetricsSlice, error)
          }

            ResourceMetricsScraper is an interface for scrapers that scrape resource metrics.

            func NewResourceMetricsScraper

            func NewResourceMetricsScraper(
            	name string,
            	scrape ScrapeResourceMetrics,
            	options ...ScraperOption,
            ) ResourceMetricsScraper

              NewResourceMetricsScraper creates a Scraper that calls Scrape at the specified collection interval, reports observability information, and passes the scraped resource metrics to the next consumer.

              type ScrapeMetrics

              type ScrapeMetrics func(context.Context) (pdata.MetricSlice, error)

                Scrape metrics.

                type ScrapeResourceMetrics

                type ScrapeResourceMetrics func(context.Context) (pdata.ResourceMetricsSlice, error)

                  Scrape resource metrics.

                  type ScraperControllerOption

                  type ScraperControllerOption func(*controller)

                    ScraperControllerOption apply changes to internal options.

                    func AddMetricsScraper

                    func AddMetricsScraper(scraper MetricsScraper) ScraperControllerOption

                      AddMetricsScraper configures the provided scrape function 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 AddResourceMetricsScraper

                      func AddResourceMetricsScraper(scraper ResourceMetricsScraper) ScraperControllerOption

                        AddResourceMetricsScraper configures the provided scrape function to be called with the specified options, and at the specified collection interval.

                        Observability information will be reported, and the scraped resource metrics will be passed to the next consumer.

                        func WithTickerChannel

                        func WithTickerChannel(tickerCh <-chan time.Time) ScraperControllerOption

                          WithTickerChannel allows you to override the scraper controllers ticker channel to specify when scrape is called. This is only expected to be used by tests.

                          type ScraperControllerSettings

                          type ScraperControllerSettings struct {
                          	configmodels.ReceiverSettings `mapstructure:"squash"`
                          	CollectionInterval            time.Duration `mapstructure:"collection_interval"`
                          }

                            ScraperControllerSettings defines common settings for a scraper controller configuration. Scraper controller receivers can embed this struct, instead of configmodels.ReceiverSettings, and extend it with more fields if needed.

                            func DefaultScraperControllerSettings

                            func DefaultScraperControllerSettings(cfgType configmodels.Type) ScraperControllerSettings

                              DefaultScraperControllerSettings returns default scraper controller settings with a collection interval of one minute.

                              type ScraperOption

                              type ScraperOption func(*componenthelper.ComponentSettings)

                                ScraperOption apply changes to internal options.

                                func WithShutdown

                                func WithShutdown(shutdown componenthelper.Shutdown) ScraperOption

                                  WithShutdown sets the function that will be called on shutdown.

                                  func WithStart

                                  func WithStart(start componenthelper.Start) ScraperOption

                                    WithStart sets the function that will be called on startup.