Documentation
¶
Index ¶
- Constants
- func NewDefaultQueueConfig() queuebatch.Config
- func NewQueueSender(qSet queuebatch.Settings[request.Request], qCfg queuebatch.Config, ...) (sender.Sender[request.Request], error)
- func NewThrottleRetry(err error, delay time.Duration) error
- type BaseExporter
- type BatcherConfig
- type Option
- func WithBatcher(cfg BatcherConfig) Option
- func WithCapabilities(capabilities consumer.Capabilities) Option
- func WithQueue(cfg queuebatch.Config) Option
- func WithQueueBatch(cfg queuebatch.Config, set QueueBatchSettings[request.Request]) Option
- func WithQueueBatchSettings(set QueueBatchSettings[request.Request]) Option
- func WithRetry(config configretry.BackOffConfig) Option
- func WithShutdown(shutdown component.ShutdownFunc) Option
- func WithStart(start component.StartFunc) Option
- func WithTimeout(timeoutConfig TimeoutConfig) Option
- type QueueBatchSettings
- type SizeConfig
- type TimeoutConfig
Constants ¶
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 NewDefaultQueueConfig ¶ added in v0.110.0
func NewDefaultQueueConfig() queuebatch.Config
NewDefaultQueueConfig returns the default config for queuebatch.Config. By default, the queue stores 1000 requests of telemetry and is non-blocking when full.
func NewQueueSender ¶ added in v0.110.0
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 QueueBatch. // Most of the senders are optional, and initialized with a no-op path-through sender. QueueSender sender.Sender[request.Request] RetrySender sender.Sender[request.Request] ConsumerOptions []consumer.Option // contains filtered or unexported fields }
BaseExporter contains common fields between different exporter types.
func NewBaseExporter ¶ added in v0.110.0
func (*BaseExporter) Send ¶ added in v0.110.0
Send sends the request using the first sender in the chain.
type BatcherConfig ¶ added in v0.123.0
type BatcherConfig struct { // Enabled indicates whether to not enqueue batches before sending to the consumerSender. Enabled bool `mapstructure:"enabled"` // FlushTimeout sets the time after which a batch will be sent regardless of its size. FlushTimeout time.Duration `mapstructure:"flush_timeout"` // SizeConfig sets the size limits for a batch. SizeConfig `mapstructure:",squash"` }
BatcherConfig defines a configuration for batching requests based on a timeout and a minimum number of items. 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 NewDefaultBatcherConfig ¶ added in v0.123.0
func NewDefaultBatcherConfig() BatcherConfig
func (*BatcherConfig) Validate ¶ added in v0.123.0
func (c *BatcherConfig) Validate() error
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 BatcherConfig) 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 WithQueue ¶ added in v0.110.0
func WithQueue(cfg queuebatch.Config) Option
WithQueue overrides the default queuebatch.Config for an exporter. The default queuebatch.Config is to disable queueing. This option cannot be used with the new exporter helpers New[Traces|Metrics|Logs]RequestExporter.
func WithQueueBatch ¶ added in v0.123.0
func WithQueueBatch(cfg queuebatch.Config, set QueueBatchSettings[request.Request]) Option
WithQueueBatch 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 WithQueueBatchSettings ¶ added in v0.123.0
func WithQueueBatchSettings(set QueueBatchSettings[request.Request]) Option
WithQueueBatchSettings is used to set the QueueBatchSettings for the new request based exporter helper. It must be provided as the first option when creating a new exporter helper.
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
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 QueueBatchSettings ¶ added in v0.123.0
type QueueBatchSettings[T any] struct { Encoding queuebatch.Encoding[T] Sizers map[request.SizerType]request.Sizer[T] }
QueueBatchSettings is a subset of the queuebatch.Settings that are needed when used within an Exporter.
type SizeConfig ¶ added in v0.123.0
type SizeConfig struct { Sizer request.SizerType `mapstructure:"sizer"` // MinSize defines the configuration for the minimum size of a batch. MinSize int64 `mapstructure:"min_size"` // MaxSize defines the configuration for the maximum size of a batch. MaxSize int64 `mapstructure:"max_size"` }
SizeConfig sets the size limits for a batch.
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
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package queuebatch provides helper functions for exporter's queueing and batching.
|
Package queuebatch provides helper functions for exporter's queueing and batching. |