Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrQueueIsFull = errors.New("sending queue is full")
ErrQueueIsFull is the error returned when an item is offered to the Queue and the queue is full. 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.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Enabled indicates whether to not enqueue batches before exporting. Enabled bool `mapstructure:"enabled"` // NumConsumers is the number of consumers from the queue. NumConsumers int `mapstructure:"num_consumers"` // QueueSize is the maximum number of requests allowed in queue at any given time. QueueSize int `mapstructure:"queue_size"` }
Config defines configuration for queueing requests before exporting. It's supposed to 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 NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig returns the default Config. 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.
type Factory ¶
Factory is a function that creates a new queue. 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 NewMemoryQueueFactory ¶
NewMemoryQueueFactory returns a factory to create a new memory queue. 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 NewPersistentQueueFactory ¶
func NewPersistentQueueFactory[T any](storageID *component.ID, factorySettings PersistentQueueSettings[T]) Factory[T]
NewPersistentQueueFactory returns a factory to create a new persistent queue. If cfg.storageID is nil then it falls back to memory queue. 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.
type Marshaler ¶
Marshaler is a function that can marshal a request into bytes. 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.
type PersistentQueueConfig ¶
type PersistentQueueConfig struct { Config `mapstructure:",squash"` // StorageID if not empty, enables the persistent storage and uses the component specified // as a storage extension for the persistent queue StorageID *component.ID `mapstructure:"storage"` }
PersistentQueueConfig defines configuration for queueing requests in a persistent storage. The struct is provided to be added in the exporter configuration as one struct under the "sending_queue" key. The exporter helper Go interface requires the fields to be provided separately to WithRequestQueue and NewPersistentQueueFactory. 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.
type PersistentQueueSettings ¶
type PersistentQueueSettings[T any] struct { // Marshaler is used to serialize queue elements before storing them in the persistent storage. Marshaler Marshaler[T] // Unmarshaler is used to deserialize requests after reading them from the persistent storage. Unmarshaler Unmarshaler[T] }
PersistentQueueSettings defines developer settings for the persistent queue factory. 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.
type Queue ¶
type Queue[T any] interface { component.Component // Offer inserts the specified element into this queue if it is possible to do so immediately // without violating capacity restrictions. If success returns no error. // It returns ErrQueueIsFull if no space is currently available. Offer(ctx context.Context, item T) error // Size returns the current Size of the queue Size() int // Capacity returns the capacity of the queue. Capacity() int // Read pulls the next available item from the queue along with its index. Once processing is // finished, the index should be called with OnProcessingFinished to clean up the storage. // The function blocks until an item is available or if the queue is stopped. // Returns false if reading failed or if the queue is stopped. Read(context.Context) (uint64, context.Context, T, bool) // OnProcessingFinished should be called to remove the item of the given index from the queue once processing is finished. OnProcessingFinished(index uint64, consumeErr error) }
Queue defines a producer-consumer exchange which can be backed by e.g. the memory-based ring buffer queue (boundedMemoryQueue) or via a disk-based queue (persistentQueue) 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.
type Unmarshaler ¶
Unmarshaler is a function that can unmarshal bytes into a request. 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.