Documentation
¶
Overview ¶
Package queuebatch provides helper functions for exporter's queueing and batching.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchConfig ¶
type BatchConfig struct { // FlushTimeout sets the time after which a batch will be sent regardless of its size. FlushTimeout time.Duration `mapstructure:"flush_timeout"` // Sizer determines the type of size measurement used by the batch. // If not configured, use the same configuration as the queue. // It accepts "requests", "items", or "bytes". 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"` }
BatchConfig defines a configuration for batching requests based on a timeout and a minimum number of items.
func (*BatchConfig) Validate ¶
func (cfg *BatchConfig) Validate() error
type Batcher ¶
Batcher is in charge of reading items from the queue and send them out asynchronously.
func NewBatcher ¶ added in v0.128.0
func NewBatcher(cfg configoptional.Optional[BatchConfig], set batcherSettings[request.Request]) (Batcher[request.Request], error)
type Config ¶
type Config struct { // Enabled indicates whether to not enqueue and batch before exporting. Enabled bool `mapstructure:"enabled"` // WaitForResult determines if incoming requests are blocked until the request is processed or not. // Currently, this option is not available when persistent queue is configured using the storage configuration. WaitForResult bool `mapstructure:"wait_for_result"` // Sizer determines the type of size measurement used by this component. // It accepts "requests", "items", or "bytes". Sizer request.SizerType `mapstructure:"sizer"` // QueueSize represents the maximum data size allowed for concurrent storage and processing. QueueSize int64 `mapstructure:"queue_size"` // BlockOnOverflow determines the behavior when the component's TotalSize limit is reached. // If true, the component will wait for space; otherwise, operations will immediately return a retryable error. BlockOnOverflow bool `mapstructure:"block_on_overflow"` // StorageID if not empty, enables the persistent storage and uses the component specified // as a storage extension for the persistent queue. // TODO: This will be changed to Optional when available. StorageID *component.ID `mapstructure:"storage"` // NumConsumers is the maximum number of concurrent consumers from the queue. // This applies across all different optional configurations from above (e.g. wait_for_result, blockOnOverflow, persistent, etc.). // TODO: This will also control the maximum number of shards, when supported: // https://github.com/open-telemetry/opentelemetry-collector/issues/12473. NumConsumers int `mapstructure:"num_consumers"` // BatchConfig it configures how the requests are consumed from the queue and batch together during consumption. Batch configoptional.Optional[BatchConfig] `mapstructure:"batch"` }
Config defines configuration for queueing and batching incoming requests.
type GetKeyFunc ¶ added in v0.125.0
type Partitioner ¶ added in v0.125.0
Partitioner is an interface that returns the the partition key of the given element.
func NewPartitioner ¶ added in v0.125.0
func NewPartitioner( getKeyFunc GetKeyFunc[request.Request], ) Partitioner[request.Request]
type QueueBatch ¶
type QueueBatch struct {
// contains filtered or unexported fields
}
func NewQueueBatch ¶
func (*QueueBatch) Send ¶
Send implements the requestSender interface. It puts the request in the queue.
Click to show internal directories.
Click to hide internal directories.