receiverhelper

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 10 Imported by: 64

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory(
	cfgType configmodels.Type,
	createDefaultConfig CreateDefaultConfig,
	options ...FactoryOption) component.ReceiverFactory

NewFactory returns a component.ReceiverFactory.

func NewScraperControllerReceiver added in v0.13.0

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

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

Types

type BaseScraper added in v0.13.0

type BaseScraper interface {
	// Initialize performs any timely initialization tasks such as
	// setting up performance counters for initial collection.
	Initialize(ctx context.Context) error

	// Close should clean up any unmanaged resources such as
	// performance counter handles.
	Close(ctx context.Context) error
}

type Close added in v0.13.0

type Close func(ctx context.Context) error

Close should clean up any unmanaged resources such as performance counter handles.

type CreateDefaultConfig

type CreateDefaultConfig func() configmodels.Receiver

CreateDefaultConfig is the equivalent of component.ReceiverFactory.CreateDefaultConfig()

type CreateLogsReceiver added in v0.7.0

CreateLogsReceiver is the equivalent of component.ReceiverFactory.CreateLogsReceiver()

type CreateMetricsReceiver

CreateMetricsReceiver is the equivalent of component.ReceiverFactory.CreateMetricsReceiver()

type CreateTraceReceiver

CreateTraceReceiver is the equivalent of component.ReceiverFactory.CreateTraceReceiver()

type FactoryOption

type FactoryOption func(o *factory)

FactoryOption apply changes to ReceiverOptions.

func WithCustomUnmarshaler

func WithCustomUnmarshaler(customUnmarshaler component.CustomUnmarshaler) FactoryOption

WithCustomUnmarshaler implements component.ConfigUnmarshaler.

func WithLogs added in v0.7.0

func WithLogs(createLogsReceiver CreateLogsReceiver) FactoryOption

WithLogs overrides the default "error not supported" implementation for CreateLogsReceiver.

func WithMetrics

func WithMetrics(createMetricsReceiver CreateMetricsReceiver) FactoryOption

WithMetrics overrides the default "error not supported" implementation for CreateMetricsReceiver.

func WithTraces

func WithTraces(createTraceReceiver CreateTraceReceiver) FactoryOption

WithTraces overrides the default "error not supported" implementation for CreateTraceReceiver.

type Initialize added in v0.13.0

type Initialize func(ctx context.Context) error

Initialize performs any timely initialization tasks such as setting up performance counters for initial collection.

type MetricsScraper added in v0.13.0

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

MetricsScraper is an interface for scrapers that scrape metrics.

func NewMetricsScraper added in v0.13.0

func NewMetricsScraper(
	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 added in v0.13.0

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

ResourceMetricsScraper is an interface for scrapers that scrape resource metrics.

func NewResourceMetricsScraper added in v0.13.0

func NewResourceMetricsScraper(
	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 added in v0.13.0

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

Scrape metrics.

type ScrapeResourceMetrics added in v0.13.0

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

Scrape resource metrics.

type ScraperControllerOption added in v0.13.0

type ScraperControllerOption func(*scraperController)

ScraperControllerOption apply changes to internal options.

func AddMetricsScraper added in v0.13.0

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 added in v0.13.0

func AddResourceMetricsScraper(scrape 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 added in v0.13.0

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 added in v0.13.0

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 added in v0.13.0

func DefaultScraperControllerSettings(cfgType configmodels.Type) ScraperControllerSettings

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

type ScraperOption added in v0.13.0

type ScraperOption func(*baseScraper)

ScraperOption apply changes to internal options.

func WithClose added in v0.13.0

func WithClose(close Close) ScraperOption

WithClose sets the function that will be called on shutdown.

func WithInitialize added in v0.13.0

func WithInitialize(initialize Initialize) ScraperOption

WithInitialize sets the function that will be called on startup.

Jump to

Keyboard shortcuts

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