internal

package
v0.121.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ExporterKey used to identify exporters in metrics and traces.
	ExporterKey = "exporter"

	// DataTypeKey used to identify the data type in the queue size metric.
	DataTypeKey = "data_type"

	// ItemsSent used to track number of items sent by exporters.
	ItemsSent = "items.sent"
	// ItemsFailed used to track number of items that failed to be sent by exporters.
	ItemsFailed = "items.failed"
)

Variables

This section is empty.

Functions

func NewThrottleRetry added in v0.110.0

func NewThrottleRetry(err error, delay time.Duration) error

NewThrottleRetry creates a new throttle retry error.

Types

type BaseExporter added in v0.110.0

type BaseExporter struct {
	component.StartFunc
	component.ShutdownFunc

	Set exporter.Settings

	// Message for the user to be added with an export failure message.
	ExportFailureMessage string

	// Chain of senders that the exporter helper applies before passing the data to the actual exporter.
	// The data is handled by each sender in the respective order starting from the queueSender.
	// Most of the senders are optional, and initialized with a no-op path-through sender.
	QueueSender Sender[request.Request]
	RetrySender Sender[request.Request]

	ConsumerOptions []consumer.Option
	// contains filtered or unexported fields
}

func NewBaseExporter added in v0.110.0

func NewBaseExporter(set exporter.Settings, signal pipeline.Signal, options ...Option) (*BaseExporter, error)

func (*BaseExporter) Send added in v0.110.0

func (be *BaseExporter) Send(ctx context.Context, req request.Request) error

Send sends the request using the first sender in the chain.

func (*BaseExporter) Shutdown added in v0.110.0

func (be *BaseExporter) Shutdown(ctx context.Context) error

func (*BaseExporter) Start added in v0.110.0

func (be *BaseExporter) Start(ctx context.Context, host component.Host) error

type MockHost added in v0.110.0

type MockHost struct {
	component.Host
	Ext map[component.ID]component.Component
}

func (*MockHost) GetExtensions added in v0.110.0

func (nh *MockHost) GetExtensions() map[component.ID]component.Component

type Option added in v0.110.0

type Option func(*BaseExporter) error

Option apply changes to BaseExporter.

func WithBatcher added in v0.110.0

func WithBatcher(cfg exporterbatcher.Config) Option

WithBatcher enables batching for an exporter based on custom request types. For now, it can be used only with the New[Traces|Metrics|Logs]RequestExporter exporter helpers and WithRequestBatchFuncs provided. This API is at the early stage of development and may change without backward compatibility until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.

func WithCapabilities added in v0.110.0

func WithCapabilities(capabilities consumer.Capabilities) Option

WithCapabilities overrides the default Capabilities() function for a Consumer. The default is non-mutable data. TODO: Verify if we can change the default to be mutable as we do for processors.

func WithEncoding added in v0.121.0

func WithEncoding(encoding exporterqueue.Encoding[request.Request]) Option

WithEncoding is used to set the request encoding for the new exporter helper. It must be provided as the first option when creating a new exporter helper.

func WithQueue added in v0.110.0

func WithQueue(cfg exporterqueue.Config) Option

WithQueue overrides the default QueueConfig for an exporter. The default QueueConfig is to disable queueing. This option cannot be used with the new exporter helpers New[Traces|Metrics|Logs]RequestExporter.

func WithRequestQueue added in v0.110.0

func WithRequestQueue(cfg exporterqueue.Config, encoding exporterqueue.Encoding[request.Request]) Option

WithRequestQueue enables queueing for an exporter. This option should be used with the new exporter helpers New[Traces|Metrics|Logs]RequestExporter. Experimental: This API is at the early stage of development and may change without backward compatibility until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved.

func WithRetry added in v0.110.0

func WithRetry(config configretry.BackOffConfig) Option

WithRetry overrides the default configretry.BackOffConfig for an exporter. The default configretry.BackOffConfig is to disable retries.

func WithShutdown added in v0.110.0

func WithShutdown(shutdown component.ShutdownFunc) Option

WithShutdown overrides the default Shutdown function for an exporter. The default shutdown function does nothing and always returns nil.

func WithStart added in v0.110.0

func WithStart(start component.StartFunc) Option

WithStart overrides the default Start function for an exporter. The default start function does nothing and always returns nil.

func WithTimeout added in v0.110.0

func WithTimeout(timeoutConfig TimeoutConfig) Option

WithTimeout overrides the default TimeoutConfig for an exporter. The default TimeoutConfig is 5 seconds.

type QueueSender added in v0.110.0

type QueueSender struct {
	// contains filtered or unexported fields
}

func NewQueueSender added in v0.110.0

func NewQueueSender(
	qSet exporterqueue.Settings[request.Request],
	qCfg exporterqueue.Config,
	bCfg exporterbatcher.Config,
	exportFailureMessage string,
	next Sender[request.Request],
) (*QueueSender, error)

func (*QueueSender) Send added in v0.110.0

func (qs *QueueSender) Send(ctx context.Context, req request.Request) error

Send implements the requestSender interface. It puts the request in the queue.

func (*QueueSender) Shutdown added in v0.110.0

func (qs *QueueSender) Shutdown(ctx context.Context) error

Shutdown is invoked during service shutdown.

func (*QueueSender) Start added in v0.110.0

func (qs *QueueSender) Start(ctx context.Context, host component.Host) error

Start is invoked during service startup.

type SendFunc added in v0.119.0

type SendFunc[K any] func(ctx context.Context, data K) error

type Sender added in v0.117.0

type Sender[K any] interface {
	component.Component
	Send(context.Context, K) error
}

type TimeoutConfig added in v0.110.0

type TimeoutConfig struct {
	// Timeout is the timeout for every attempt to send data to the backend.
	// A zero timeout means no timeout.
	Timeout time.Duration `mapstructure:"timeout"`
}

TimeoutConfig for timeout. The timeout applies to individual attempts to send data to the backend.

func NewDefaultTimeoutConfig added in v0.110.0

func NewDefaultTimeoutConfig() TimeoutConfig

NewDefaultTimeoutConfig returns the default config for TimeoutConfig.

func (*TimeoutConfig) Validate added in v0.110.0

func (ts *TimeoutConfig) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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