testcomponents

package
v0.42.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExampleExporterFactory = exporterhelper.NewFactory(
	expType,
	createExporterDefaultConfig,
	exporterhelper.WithTraces(createTracesExporter),
	exporterhelper.WithMetrics(createMetricsExporter),
	exporterhelper.WithLogs(createLogsExporter))

ExampleExporterFactory is factory for ExampleExporter.

View Source
var ExampleExtensionFactory = extensionhelper.NewFactory(extType, createExtensionDefaultConfig, createExtension)

ExampleExtensionFactory is factory for ExampleExtensionCfg.

View Source
var ExampleProcessorFactory = processorhelper.NewFactory(
	procType,
	createDefaultConfig,
	processorhelper.WithTraces(createTracesProcessor),
	processorhelper.WithMetrics(createMetricsProcessor),
	processorhelper.WithLogs(createLogsProcessor))

ExampleProcessorFactory is factory for exampleProcessor.

View Source
var ExampleReceiverFactory = receiverhelper.NewFactory(
	receiverType,
	createReceiverDefaultConfig,
	receiverhelper.WithTraces(createTracesReceiver),
	receiverhelper.WithMetrics(createMetricsReceiver),
	receiverhelper.WithLogs(createLogsReceiver))

ExampleReceiverFactory is factory for ExampleReceiver.

Functions

func DefaultFactories added in v0.41.0

func DefaultFactories() (
	component.Factories,
	error,
)

DefaultFactories returns the set of components in "testdata/otelcol-config.yaml". This is only used by tests.

func ExampleComponents

func ExampleComponents() (
	factories component.Factories,
	err error,
)

ExampleComponents registers example factories. This is only used by tests.

Types

type ExampleExporter

type ExampleExporter struct {
	config.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
	ExtraInt                int32                    `mapstructure:"extra_int"`
	ExtraSetting            string                   `mapstructure:"extra"`
	ExtraMapSetting         map[string]string        `mapstructure:"extra_map"`
	ExtraListSetting        []string                 `mapstructure:"extra_list"`
}

ExampleExporter is for testing purposes. We are defining an example config and factory for "exampleexporter" exporter type.

func (*ExampleExporter) Unmarshal added in v0.25.0

func (cfg *ExampleExporter) Unmarshal(componentParser *config.Map) error

Unmarshal a viper data into the config struct

type ExampleExporterConsumer

type ExampleExporterConsumer struct {
	Traces           []pdata.Traces
	Metrics          []pdata.Metrics
	Logs             []pdata.Logs
	ExporterStarted  bool
	ExporterShutdown bool
}

ExampleExporterConsumer stores consumed traces and metrics for testing purposes.

func (*ExampleExporterConsumer) Capabilities added in v0.27.0

func (exp *ExampleExporterConsumer) Capabilities() consumer.Capabilities

func (*ExampleExporterConsumer) ConsumeLogs

func (exp *ExampleExporterConsumer) ConsumeLogs(_ context.Context, ld pdata.Logs) error

func (*ExampleExporterConsumer) ConsumeMetrics

func (exp *ExampleExporterConsumer) ConsumeMetrics(_ context.Context, md pdata.Metrics) error

ConsumeMetrics receives pdata.Metrics for processing by the Metrics.

func (*ExampleExporterConsumer) ConsumeTraces

func (exp *ExampleExporterConsumer) ConsumeTraces(_ context.Context, td pdata.Traces) error

ConsumeTraces receives pdata.Traces for processing by the consumer.Traces.

func (*ExampleExporterConsumer) Shutdown

Shutdown is invoked during shutdown.

func (*ExampleExporterConsumer) Start

Start tells the exporter to start. The exporter may prepare for exporting by connecting to the endpoint. Host parameter can be used for communicating with the host after Start() has already returned.

type ExampleExtensionCfg

type ExampleExtensionCfg struct {
	config.ExtensionSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
	ExtraSetting             string                   `mapstructure:"extra"`
	ExtraMapSetting          map[string]string        `mapstructure:"extra_map"`
	ExtraListSetting         []string                 `mapstructure:"extra_list"`
}

ExampleExtensionCfg is for testing purposes. We are defining an example config and factory for "exampleextension" extension type.

type ExampleProcessorCfg

type ExampleProcessorCfg struct {
	config.ProcessorSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
	ExtraSetting             string                   `mapstructure:"extra"`
	ExtraMapSetting          map[string]string        `mapstructure:"extra_map"`
	ExtraListSetting         []string                 `mapstructure:"extra_list"`
}

ExampleProcessorCfg is for testing purposes. We are defining an example config and factory for "exampleprocessor" processor type.

type ExampleReceiver

type ExampleReceiver struct {
	config.ReceiverSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
	// Configures the receiver server protocol.
	confignet.TCPAddr `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct

	ExtraSetting     string            `mapstructure:"extra"`
	ExtraMapSetting  map[string]string `mapstructure:"extra_map"`
	ExtraListSetting []string          `mapstructure:"extra_list"`
}

ExampleReceiver is for testing purposes. We are defining an example config and factory for "examplereceiver" receiver type.

type ExampleReceiverProducer

type ExampleReceiverProducer struct {
	Started bool
	Stopped bool
	consumer.Traces
	consumer.Metrics
	consumer.Logs
}

ExampleReceiverProducer allows producing traces and metrics for testing purposes.

func (*ExampleReceiverProducer) Shutdown

Shutdown tells the receiver that should stop reception,

func (*ExampleReceiverProducer) Start

Start tells the receiver to start its processing.

Jump to

Keyboard shortcuts

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